Skip to content

Commit 21fb366

Browse files
Ravi Bangoriaacmel
authored andcommitted
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 <[email protected]> Suggested-by: Arnaldo Carvalho de Melo <[email protected]> Signed-off-by: Ravi Bangoria <[email protected]> Closes: https://lore.kernel.org/r/aCfuGXUnNIbnYo_r@x1 Link: https://lore.kernel.org/r/[email protected] [1] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 8f454c9 commit 21fb366

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tools/perf/arch/x86/tests/amd-ibs-period.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <sys/syscall.h>
44
#include <sys/mman.h>
55
#include <sys/ioctl.h>
6+
#include <sys/utsname.h>
67
#include <string.h>
78

89
#include "arch-tests.h"
@@ -912,6 +913,29 @@ static unsigned int get_perf_event_max_sample_rate(void)
912913
return max_sample_rate;
913914
}
914915

916+
/*
917+
* Bunch of IBS sample period fixes that this test exercise went in v6.15.
918+
* Skip the test on older kernels to distinguish between test failure due
919+
* to a new bug vs known failure due to older kernel.
920+
*/
921+
static bool kernel_v6_15_or_newer(void)
922+
{
923+
struct utsname utsname;
924+
char *endptr = NULL;
925+
long major, minor;
926+
927+
if (uname(&utsname) < 0) {
928+
pr_debug("uname() failed. [%m]");
929+
return false;
930+
}
931+
932+
major = strtol(utsname.release, &endptr, 10);
933+
endptr++;
934+
minor = strtol(endptr, NULL, 10);
935+
936+
return major >= 6 && minor >= 15;
937+
}
938+
915939
int test__amd_ibs_period(struct test_suite *test __maybe_unused,
916940
int subtest __maybe_unused)
917941
{
@@ -931,6 +955,11 @@ int test__amd_ibs_period(struct test_suite *test __maybe_unused,
931955
if (!x86__is_amd_cpu() || !fetch_pmu || !op_pmu)
932956
return TEST_SKIP;
933957

958+
if (!kernel_v6_15_or_newer()) {
959+
pr_debug("Need v6.15 or newer kernel. Skipping.\n");
960+
return TEST_SKIP;
961+
}
962+
934963
perf_exe(perf, sizeof(perf));
935964

936965
if (sched_affine(0))

0 commit comments

Comments
 (0)