]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
perf test amd: Skip amd-ibs-period test on kernel < v6.15
authorRavi Bangoria <ravi.bangoria@amd.com>
Tue, 20 May 2025 05:32:48 +0000 (05:32 +0000)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 21 May 2025 18:07:13 +0000 (15:07 -0300)
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
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/arch/x86/tests/amd-ibs-period.c

index 7c77d86f369d762e738230389a5d87f9f943df99..223e059e04deb005f564b6beec5539dc4cc700e9 100644 (file)
@@ -3,6 +3,7 @@
 #include <sys/syscall.h>
 #include <sys/mman.h>
 #include <sys/ioctl.h>
+#include <sys/utsname.h>
 #include <string.h>
 
 #include "arch-tests.h"
@@ -912,6 +913,29 @@ out:
        return max_sample_rate;
 }
 
+/*
+ * Bunch of IBS sample period fixes that this test exercise went in v6.15.
+ * Skip the test on older kernels to distinguish between test failure due
+ * to a new bug vs known failure due to older kernel.
+ */
+static bool kernel_v6_15_or_newer(void)
+{
+       struct utsname utsname;
+       char *endptr = NULL;
+       long major, minor;
+
+       if (uname(&utsname) < 0) {
+               pr_debug("uname() failed. [%m]");
+               return false;
+       }
+
+       major = strtol(utsname.release, &endptr, 10);
+       endptr++;
+       minor = strtol(endptr, NULL, 10);
+
+       return major >= 6 && minor >= 15;
+}
+
 int test__amd_ibs_period(struct test_suite *test __maybe_unused,
                         int subtest __maybe_unused)
 {
@@ -931,6 +955,11 @@ int test__amd_ibs_period(struct test_suite *test __maybe_unused,
        if (!x86__is_amd_cpu() || !fetch_pmu || !op_pmu)
                return TEST_SKIP;
 
+       if (!kernel_v6_15_or_newer()) {
+               pr_debug("Need v6.15 or newer kernel. Skipping.\n");
+               return TEST_SKIP;
+       }
+
        perf_exe(perf, sizeof(perf));
 
        if (sched_affine(0))