Commit 21fb366b authored by Ravi Bangoria's avatar Ravi Bangoria Committed by Arnaldo Carvalho de Melo
Browse files

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: default avatarArnaldo Carvalho de Melo <acme@kernel.org>
Suggested-by: default avatarArnaldo Carvalho de Melo <acme@kernel.org>
Signed-off-by: default avatarRavi 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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 8f454c95
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -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 @@ static unsigned int get_perf_event_max_sample_rate(void)
	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))