perf/amd/ibs: Add support for OP Load Latency Filtering
authorRavi Bangoria <ravi.bangoria@amd.com>
Wed, 5 Feb 2025 06:05:41 +0000 (06:05 +0000)
committerPeter Zijlstra <peterz@infradead.org>
Mon, 17 Feb 2025 14:20:05 +0000 (15:20 +0100)
commitd20610c19b4a22bc69085b7eb7a02741d51de30e
tree4ac633ee871942b84260d7cb351e457dfbd6bc05
parent1623ced247f7cb1b48a27cca6b0f17fe5ab5942b
perf/amd/ibs: Add support for OP Load Latency Filtering

IBS Op PMU on Zen5 uarch added new Load Latency filtering capability. It's
advertised by CPUID_Fn8000001B_EAX bit 12. When enabled, IBS HW will raise
interrupt only for sample that had an IbsDcMissLat value greater than N
cycles, where N is a programmable value defined as multiples of 128 (i.e.
128, 256, 384 etc.) from 128-2048 cycles. Similar to L3MissOnly, IBS HW
internally drops the sample and restarts if the sample does not meet the
filtering criteria.

Add support for LdLat filtering in IBS Op PMU. Since hardware supports
threshold in multiple of 128, add a software filter on top to support
latency threshold with the granularity of 1 cycle between [128-2048].

Example usage:
  # perf record -a -e ibs_op/ldlat=128/ -- sleep 5

Signed-off-by: Ravi Bangoria <ravi.bangoria@amd.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20250205060547.1337-2-ravi.bangoria@amd.com
arch/x86/events/amd/ibs.c
arch/x86/include/asm/amd-ibs.h
arch/x86/include/asm/perf_event.h