]> git.ipfire.org Git - thirdparty/linux.git/commit
perf/x86/intel/ds: Factor out functions for PEBS records processing
authorKan Liang <kan.liang@linux.intel.com>
Tue, 19 Nov 2024 13:55:03 +0000 (05:55 -0800)
committerPeter Zijlstra <peterz@infradead.org>
Mon, 2 Dec 2024 11:01:34 +0000 (12:01 +0100)
commit3c00ed344cef4dbb57d8769b961af414132a173a
treec9fa7c34e90cac78a4c6f16860d4d4470edac9bd
parent7087bfb0adc9a12ec3b463b1d38072c5efce5d6c
perf/x86/intel/ds: Factor out functions for PEBS records processing

Factor out functions to process normal and the last PEBS records, which
can be shared with the later patch.

Move the event updating related codes (intel_pmu_save_and_restart())
to the end, where all samples have been processed.
For the current usage, it doesn't matter when perf updates event counts
and reset the counter. Because all counters are stopped when the PEBS
buffer is drained.
Drop the return of the !intel_pmu_save_and_restart(event) check. Because
it never happen. The intel_pmu_save_and_restart(event) only returns 0,
when !hwc->event_base or the period_left > 0.
- The !hwc->event_base is impossible for the PEBS event, since the PEBS
  event is only available on GP and fixed counters, which always have
  a valid hwc->event_base.
- The check only happens for the case of non-AUTO_RELOAD and single
  PEBS, which implies that the event must be overflowed. The period_left
  must be always <= 0 for an overflowed event after the
  x86_pmu_update().

Co-developed-by: "Peter Zijlstra (Intel)" <peterz@infradead.org>
Signed-off-by: "Peter Zijlstra (Intel)" <peterz@infradead.org>
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20241119135504.1463839-4-kan.liang@linux.intel.com
arch/x86/events/intel/ds.c