linux/arch/x86/events
Sandipan Das 88ab25d718 perf/x86/amd/uncore: Prevent UMC counters from saturating
[ Upstream commit 2492e5aba2 ]

Unlike L3 and DF counters, UMC counters (PERF_CTRs) set the Overflow bit
(bit 48) and saturate on overflow. A subsequent pmu->read() of the event
reports an incorrect accumulated count as there is no difference between
the previous and the current values of the counter.

To avoid this, inspect the current counter value and proactively reset
the corresponding PERF_CTR register on every pmu->read(). Combined with
the periodic reads initiated by the hrtimer, the counters never get a
chance saturate but the resolution reduces to 47 bits.

Fixes: 25e5684782 ("perf/x86/amd/uncore: Add memory controller support")
Signed-off-by: Sandipan Das <sandipan.das@amd.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Song Liu <song@kernel.org>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/dee9c8af2c6d66814cf4c6224529c144c620cf2c.1744906694.git.sandipan.das@amd.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2025-06-19 15:31:26 +02:00
..
amd perf/x86/amd/uncore: Prevent UMC counters from saturating 2025-06-19 15:31:26 +02:00
intel perf/x86/intel: Fix segfault with PEBS-via-PT with sample_freq 2025-05-29 11:03:16 +02:00
zhaoxin perf/x86: Support counter mask 2024-07-04 16:00:36 +02:00
core.c perf/x86/intel: Only check the group flag for X86 leader 2025-05-09 09:50:31 +02:00
Kconfig perf/x86/Kconfig: Fix indentation in the Kconfig file 2022-05-25 15:54:26 +02:00
Makefile perf/x86: Move branch classifier 2022-08-27 00:05:44 +02:00
msr.c perf/x86/msr: Switch to new Intel CPU model defines 2024-04-29 10:31:04 +02:00
perf_event.h perf/x86/intel: Only check the group flag for X86 leader 2025-05-09 09:50:31 +02:00
perf_event_flags.h perf/x86/intel: Support branch counters logging 2023-10-27 15:05:11 +02:00
probe.c perf/x86/rapl: Add msr mask support 2021-02-10 14:44:54 +01:00
probe.h perf/x86/rapl: Add msr mask support 2021-02-10 14:44:54 +01:00
rapl.c perf/x86/rapl: Add support for Intel Arrow Lake U 2025-03-22 12:54:21 -07:00
utils.c perf/x86/lbr: Filter vsyscall addresses 2023-10-08 12:25:18 +02:00