]> www.infradead.org Git - users/jedix/linux-maple.git/commit
perf/arch: Record sample last_period before updating on the x86 and PowerPC platforms
authorMark Barnett <mark.barnett@arm.com>
Tue, 8 Apr 2025 17:15:26 +0000 (18:15 +0100)
committerIngo Molnar <mingo@kernel.org>
Wed, 9 Apr 2025 11:45:08 +0000 (13:45 +0200)
commit1734d98fbcce343eafba16e18e3a3001b3e94ab5
tree3777dd56cab213183ebd8134717d56cffbf1198e
parent3256a83335a40b435cc2ea3aed159608879f6ed8
perf/arch: Record sample last_period before updating on the x86 and PowerPC platforms

This change alters the PowerPC and x86 driver implementations to record
the last sample period before the event is updated for the next period.

A common pattern in PMU driver implementations is to have a
"*_event_set_period" function which takes care of updating the various
period-related fields in a perf_event structure. In most cases, the
drivers choose to call this function after initializing a sample data
structure with perf_sample_data_init. The x86 and PowerPC drivers
deviate from this, choosing to update the period before initializing the
sample data. When using an event with an alternate sample period, this
causes an incorrect period to be written to the sample data that gets
reported to userspace.

Signed-off-by: Mark Barnett <mark.barnett@arm.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20250408171530.140858-2-mark.barnett@arm.com
arch/powerpc/perf/core-book3s.c
arch/powerpc/perf/core-fsl-emb.c
arch/x86/events/core.c
arch/x86/events/intel/core.c
arch/x86/events/intel/knc.c