]> www.infradead.org Git - users/jedix/linux-maple.git/commit
perf/x86/amd/uncore: Use hrtimer for handling overflows
authorSandipan Das <sandipan.das@amd.com>
Fri, 18 Apr 2025 03:43:01 +0000 (09:13 +0530)
committerIngo Molnar <mingo@kernel.org>
Fri, 18 Apr 2025 08:35:33 +0000 (10:35 +0200)
commit6d937e044bc9bfd52dc50f7fc06d22018841472e
tree4b0bb253f54f8e0121fcf82b161147f6be7fa3c2
parent05c9b0cbe4b822c42382d27e3f73918600594882
perf/x86/amd/uncore: Use hrtimer for handling overflows

Uncore counters do not provide mechanisms like interrupts to report
overflows and the accumulated user-visible count is incorrect if there
is more than one overflow between two successive read requests for the
same event because the value of prev_count goes out-of-date for
calculating the correct delta.

To avoid this, start a hrtimer to periodically initiate a pmu->read() of
the active counters for keeping prev_count up-to-date. It should be
noted that the hrtimer duration should be lesser than the shortest time
it takes for a counter to overflow for this approach to be effective.

Signed-off-by: Sandipan Das <sandipan.das@amd.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/8ecf5fe20452da1cd19cf3ff4954d3e7c5137468.1744906694.git.sandipan.das@amd.com
arch/x86/events/amd/uncore.c