Re: [PATCH v4 4/4] perf test: Add selftest to test IBS invocation via core pmu events

From: Peter Zijlstra
Date: Fri May 05 2023 - 05:17:24 EST


On Thu, May 04, 2023 at 04:30:03PM +0530, Ravi Bangoria wrote:
> IBS pmu can be invoked via fixed set of core pmu events with 'precise_ip'
> set to 1. Add a simple event open test for all these events.
>
> Without kernel fix:
> $ sudo ./perf test -vv 76
> 76: AMD IBS via core pmu :
> --- start ---
> test child forked, pid 6553
> Using CPUID AuthenticAMD-25-1-1
> type: 0x0, config: 0x0, fd: 3 - Pass
> type: 0x0, config: 0x1, fd: -1 - Pass
> type: 0x4, config: 0x76, fd: -1 - Fail
> type: 0x4, config: 0xc1, fd: -1 - Fail
> type: 0x4, config: 0x12, fd: -1 - Pass
> test child finished with -1
> ---- end ----
> AMD IBS via core pmu: FAILED!
>
> With kernel fix:
> $ sudo ./perf test -vv 76
> 76: AMD IBS via core pmu :
> --- start ---
> test child forked, pid 7526
> Using CPUID AuthenticAMD-25-1-1
> type: 0x0, config: 0x0, fd: 3 - Pass
> type: 0x0, config: 0x1, fd: -1 - Pass
> type: 0x4, config: 0x76, fd: 3 - Pass
> type: 0x4, config: 0xc1, fd: 3 - Pass
> type: 0x4, config: 0x12, fd: -1 - Pass
> test child finished with 0
> ---- end ----
> AMD IBS via core pmu: Ok
>
> Signed-off-by: Ravi Bangoria <ravi.bangoria@xxxxxxx>
> ---
> tools/perf/arch/x86/include/arch-tests.h | 1 +
> tools/perf/arch/x86/tests/Build | 1 +
> .../arch/x86/tests/amd-ibs-via-core-pmu.c | 71 +++++++++++++++++++
> tools/perf/arch/x86/tests/arch-tests.c | 2 +
> 4 files changed, 75 insertions(+)
> create mode 100644 tools/perf/arch/x86/tests/amd-ibs-via-core-pmu.c

Arnaldo, ok if I merge this along with the other patches or would you
rather take it?