Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf test amd: Skip amd-ibs-period test on kernel < v6.15

Bunch of IBS kernel fixes went in v6.15-rc1 [1].

The amd-ibs-period test will fail without those kernel patches.

Skip the test on system running kernel older than v6.15 to distinguish
genuine new failures vs known failure due to old kernel.

Since all the related IBS fixes went in -rc1 itself, the ">= 6.15" check
will work for any custom compiled v6.15-* kernel as well.

Reported-by: Arnaldo Carvalho de Melo <acme@kernel.org>
Suggested-by: Arnaldo Carvalho de Melo <acme@kernel.org>
Signed-off-by: Ravi Bangoria <ravi.bangoria@amd.com>
Closes: https://lore.kernel.org/r/aCfuGXUnNIbnYo_r@x1
Link: https://lore.kernel.org/r/20250115054438.1021-1-ravi.bangoria@amd.com [1]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Ravi Bangoria and committed by
Arnaldo Carvalho de Melo
21fb366b 8f454c95

+29
+29
tools/perf/arch/x86/tests/amd-ibs-period.c
··· 3 3 #include <sys/syscall.h> 4 4 #include <sys/mman.h> 5 5 #include <sys/ioctl.h> 6 + #include <sys/utsname.h> 6 7 #include <string.h> 7 8 8 9 #include "arch-tests.h" ··· 913 912 return max_sample_rate; 914 913 } 915 914 915 + /* 916 + * Bunch of IBS sample period fixes that this test exercise went in v6.15. 917 + * Skip the test on older kernels to distinguish between test failure due 918 + * to a new bug vs known failure due to older kernel. 919 + */ 920 + static bool kernel_v6_15_or_newer(void) 921 + { 922 + struct utsname utsname; 923 + char *endptr = NULL; 924 + long major, minor; 925 + 926 + if (uname(&utsname) < 0) { 927 + pr_debug("uname() failed. [%m]"); 928 + return false; 929 + } 930 + 931 + major = strtol(utsname.release, &endptr, 10); 932 + endptr++; 933 + minor = strtol(endptr, NULL, 10); 934 + 935 + return major >= 6 && minor >= 15; 936 + } 937 + 916 938 int test__amd_ibs_period(struct test_suite *test __maybe_unused, 917 939 int subtest __maybe_unused) 918 940 { ··· 954 930 955 931 if (!x86__is_amd_cpu() || !fetch_pmu || !op_pmu) 956 932 return TEST_SKIP; 933 + 934 + if (!kernel_v6_15_or_newer()) { 935 + pr_debug("Need v6.15 or newer kernel. Skipping.\n"); 936 + return TEST_SKIP; 937 + } 957 938 958 939 perf_exe(perf, sizeof(perf)); 959 940