]> www.infradead.org Git - users/jedix/linux-maple.git/commit
perf/x86/amd/uncore: Prevent UMC counters from saturating
authorSandipan Das <sandipan.das@amd.com>
Fri, 18 Apr 2025 03:43:03 +0000 (09:13 +0530)
committerIngo Molnar <mingo@kernel.org>
Fri, 18 Apr 2025 08:35:34 +0000 (10:35 +0200)
commit2492e5aba2be064d0604ae23ae0770ecc0168192
tree8f27de3ebe5236c79f8f0012674f6b324903aed7
parente1ed37b70fb355abf2e8032a2e972cdba53ae93c
perf/x86/amd/uncore: Prevent UMC counters from saturating

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: 25e56847821f ("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
arch/x86/events/amd/uncore.c