Skip to content

Commit 4935e2c

Browse files
captain5050acmel
authored andcommitted
perf test: BP tests, remove is_supported use
Migrate the is_supported functionality to returning TEST_SKIP. Motivation is kunit has no is_supported function. Signed-off-by: Ian Rogers <[email protected]> Tested-by: Sohaib Mohamed <[email protected]> Acked-by: Jiri Olsa <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Brendan Higgins <[email protected]> Cc: Daniel Latypov <[email protected]> Cc: David Gow <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jin Yao <[email protected]> Cc: John Garry <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Paul Clarke <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent c76ec1c commit 4935e2c

File tree

4 files changed

+51
-74
lines changed

4 files changed

+51
-74
lines changed

tools/perf/tests/bp_account.c

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,19 @@
1919
#include "../perf-sys.h"
2020
#include "cloexec.h"
2121

22+
/*
23+
* PowerPC and S390 do not support creation of instruction breakpoints using the
24+
* perf_event interface.
25+
*
26+
* Just disable the test for these architectures until these issues are
27+
* resolved.
28+
*/
29+
#if defined(__powerpc__) || defined(__s390x__)
30+
#define BP_ACCOUNT_IS_SUPPORTED 0
31+
#else
32+
#define BP_ACCOUNT_IS_SUPPORTED 1
33+
#endif
34+
2235
static volatile long the_var;
2336

2437
static noinline int test_function(void)
@@ -180,6 +193,11 @@ static int test__bp_accounting(struct test_suite *test __maybe_unused, int subte
180193
int bp_cnt = detect_cnt(true);
181194
int share = detect_share(wp_cnt, bp_cnt);
182195

196+
if (!BP_ACCOUNT_IS_SUPPORTED) {
197+
pr_debug("Test not supported on this architecture");
198+
return TEST_SKIP;
199+
}
200+
183201
pr_debug("watchpoints count %d, breakpoints count %d, has_ioctl %d, share %d\n",
184202
wp_cnt, bp_cnt, has_ioctl, share);
185203

@@ -189,29 +207,4 @@ static int test__bp_accounting(struct test_suite *test __maybe_unused, int subte
189207
return bp_accounting(wp_cnt, share);
190208
}
191209

192-
static bool test__bp_account_is_supported(void)
193-
{
194-
/*
195-
* PowerPC and S390 do not support creation of instruction
196-
* breakpoints using the perf_event interface.
197-
*
198-
* Just disable the test for these architectures until these
199-
* issues are resolved.
200-
*/
201-
#if defined(__powerpc__) || defined(__s390x__)
202-
return false;
203-
#else
204-
return true;
205-
#endif
206-
}
207-
208-
static struct test_case bp_accounting_tests[] = {
209-
TEST_CASE("Breakpoint accounting", bp_accounting),
210-
{ .name = NULL, }
211-
};
212-
213-
struct test_suite suite__bp_accounting = {
214-
.desc = "Breakpoint accounting",
215-
.test_cases = bp_accounting_tests,
216-
.is_supported = test__bp_account_is_supported,
217-
};
210+
DEFINE_SUITE("Breakpoint accounting", bp_accounting);

tools/perf/tests/bp_signal.c

Lines changed: 6 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,11 @@ static int test__bp_signal(struct test_suite *test __maybe_unused, int subtest _
166166
struct sigaction sa;
167167
long long count1, count2, count3;
168168

169+
if (!BP_SIGNAL_IS_SUPPORTED) {
170+
pr_debug("Test not supported on this architecture");
171+
return TEST_SKIP;
172+
}
173+
169174
/* setup SIGIO signal handler */
170175
memset(&sa, 0, sizeof(struct sigaction));
171176
sa.sa_sigaction = (void *) sig_handler;
@@ -285,40 +290,4 @@ static int test__bp_signal(struct test_suite *test __maybe_unused, int subtest _
285290
TEST_OK : TEST_FAIL;
286291
}
287292

288-
bool test__bp_signal_is_supported(void)
289-
{
290-
/*
291-
* PowerPC and S390 do not support creation of instruction
292-
* breakpoints using the perf_event interface.
293-
*
294-
* ARM requires explicit rounding down of the instruction
295-
* pointer in Thumb mode, and then requires the single-step
296-
* to be handled explicitly in the overflow handler to avoid
297-
* stepping into the SIGIO handler and getting stuck on the
298-
* breakpointed instruction.
299-
*
300-
* Since arm64 has the same issue with arm for the single-step
301-
* handling, this case also gets stuck on the breakpointed
302-
* instruction.
303-
*
304-
* Just disable the test for these architectures until these
305-
* issues are resolved.
306-
*/
307-
#if defined(__powerpc__) || defined(__s390x__) || defined(__arm__) || \
308-
defined(__aarch64__)
309-
return false;
310-
#else
311-
return true;
312-
#endif
313-
}
314-
315-
static struct test_case bp_signal_tests[] = {
316-
TEST_CASE("Breakpoint overflow signal handler", bp_signal),
317-
{ .name = NULL, }
318-
};
319-
320-
struct test_suite suite__bp_signal = {
321-
.desc = "Breakpoint overflow signal handler",
322-
.test_cases = bp_signal_tests,
323-
.is_supported = test__bp_signal_is_supported,
324-
};
293+
DEFINE_SUITE("Breakpoint overflow signal handler", bp_signal);

tools/perf/tests/bp_signal_overflow.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ static int test__bp_signal_overflow(struct test_suite *test __maybe_unused, int
6666
long long count;
6767
int fd, i, fails = 0;
6868

69+
if (!BP_SIGNAL_IS_SUPPORTED) {
70+
pr_debug("Test not supported on this architecture");
71+
return TEST_SKIP;
72+
}
73+
6974
/* setup SIGIO signal handler */
7075
memset(&sa, 0, sizeof(struct sigaction));
7176
sa.sa_sigaction = (void *) sig_handler;
@@ -134,13 +139,4 @@ static int test__bp_signal_overflow(struct test_suite *test __maybe_unused, int
134139
return fails ? TEST_FAIL : TEST_OK;
135140
}
136141

137-
static struct test_case bp_signal_overflow_tests[] = {
138-
TEST_CASE("Breakpoint overflow sampling", bp_signal_overflow),
139-
{ .name = NULL, }
140-
};
141-
142-
struct test_suite suite__bp_signal_overflow = {
143-
.desc = "Breakpoint overflow sampling",
144-
.test_cases = bp_signal_overflow_tests,
145-
.is_supported = test__bp_signal_is_supported,
146-
};
142+
DEFINE_SUITE("Breakpoint overflow sampling", bp_signal_overflow);

tools/perf/tests/tests.h

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,26 @@ DECLARE_SUITE(expand_cgroup_events);
151151
DECLARE_SUITE(perf_time_to_tsc);
152152
DECLARE_SUITE(dlfilter);
153153

154-
bool test__bp_signal_is_supported(void);
154+
/*
155+
* PowerPC and S390 do not support creation of instruction breakpoints using the
156+
* perf_event interface.
157+
*
158+
* ARM requires explicit rounding down of the instruction pointer in Thumb mode,
159+
* and then requires the single-step to be handled explicitly in the overflow
160+
* handler to avoid stepping into the SIGIO handler and getting stuck on the
161+
* breakpointed instruction.
162+
*
163+
* Since arm64 has the same issue with arm for the single-step handling, this
164+
* case also gets stuck on the breakpointed instruction.
165+
*
166+
* Just disable the test for these architectures until these issues are
167+
* resolved.
168+
*/
169+
#if defined(__powerpc__) || defined(__s390x__) || defined(__arm__) || defined(__aarch64__)
170+
#define BP_SIGNAL_IS_SUPPORTED 0
171+
#else
172+
#define BP_SIGNAL_IS_SUPPORTED 1
173+
#endif
155174

156175
#ifdef HAVE_DWARF_UNWIND_SUPPORT
157176
struct thread;

0 commit comments

Comments
 (0)