Skip to content

Commit e1dda48

Browse files
namhyungacmel
authored andcommitted
perf test: Skip wp modify test on old kernels
It uses PERF_EVENT_IOC_MODIFY_ATTRIBUTES ioctl. The kernel would return ENOTTY if it's not supported. Update the skip reason in that case. Committer notes: On s/390 the args aren't used, so need to be marked __maybe_unused. Reviewed-by: Ravi Bangoria <ravi.bangoria@amd.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Ravi Bangoria <ravi.bangoria@amd.com> Link: https://lore.kernel.org/r/20220914183338.546357-1-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent babd043 commit e1dda48

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

  • tools/perf/tests

tools/perf/tests/wp.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
#include <stdlib.h>
33
#include <string.h>
44
#include <unistd.h>
5+
#include <errno.h>
56
#include <sys/ioctl.h>
7+
#include <linux/compiler.h>
68
#include <linux/hw_breakpoint.h>
79
#include <linux/kernel.h>
810
#include "tests.h"
@@ -137,8 +139,7 @@ static int test__wp_rw(struct test_suite *test __maybe_unused,
137139
#endif
138140
}
139141

140-
static int test__wp_modify(struct test_suite *test __maybe_unused,
141-
int subtest __maybe_unused)
142+
static int test__wp_modify(struct test_suite *test __maybe_unused, int subtest __maybe_unused)
142143
{
143144
#if defined(__s390x__)
144145
return TEST_SKIP;
@@ -160,6 +161,11 @@ static int test__wp_modify(struct test_suite *test __maybe_unused,
160161
new_attr.disabled = 1;
161162
ret = ioctl(fd, PERF_EVENT_IOC_MODIFY_ATTRIBUTES, &new_attr);
162163
if (ret < 0) {
164+
if (errno == ENOTTY) {
165+
test->test_cases[subtest].skip_reason = "missing kernel support";
166+
ret = TEST_SKIP;
167+
}
168+
163169
pr_debug("ioctl(PERF_EVENT_IOC_MODIFY_ATTRIBUTES) failed\n");
164170
close(fd);
165171
return ret;

0 commit comments

Comments
 (0)