linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ian Rogers <irogers@google.com>
To: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	Jin Yao <yao.jin@linux.intel.com>,
	John Garry <john.garry@huawei.com>,
	"Paul A . Clarke" <pc@us.ibm.com>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	Brendan Higgins <brendanhiggins@google.com>,
	Daniel Latypov <dlatypov@google.com>,
	David Gow <davidgow@google.com>,
	Sohaib Mohamed <sohaib.amhmd@gmail.com>
Cc: eranian@google.com, Ian Rogers <irogers@google.com>
Subject: [PATCH v3 19/22] perf test: BP tests, remove is_supported use
Date: Wed,  3 Nov 2021 23:42:05 -0700	[thread overview]
Message-ID: <20211104064208.3156807-20-irogers@google.com> (raw)
In-Reply-To: <20211104064208.3156807-1-irogers@google.com>

Migrate the is_supported functionality to returning TEST_SKIP.
Motivation is kunit has no is_supported function.

Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/perf/tests/bp_account.c         | 45 +++++++++++----------------
 tools/perf/tests/bp_signal.c          | 43 ++++---------------------
 tools/perf/tests/bp_signal_overflow.c | 16 ++++------
 tools/perf/tests/tests.h              | 21 ++++++++++++-
 4 files changed, 51 insertions(+), 74 deletions(-)

diff --git a/tools/perf/tests/bp_account.c b/tools/perf/tests/bp_account.c
index e4f7b635ffef..d1ebb5561e5b 100644
--- a/tools/perf/tests/bp_account.c
+++ b/tools/perf/tests/bp_account.c
@@ -19,6 +19,19 @@
 #include "../perf-sys.h"
 #include "cloexec.h"
 
+/*
+ * PowerPC and S390 do not support creation of instruction breakpoints using the
+ * perf_event interface.
+ *
+ * Just disable the test for these architectures until these issues are
+ * resolved.
+ */
+#if defined(__powerpc__) || defined(__s390x__)
+#define BP_ACCOUNT_IS_SUPPORTED 0
+#else
+#define BP_ACCOUNT_IS_SUPPORTED 1
+#endif
+
 static volatile long the_var;
 
 static noinline int test_function(void)
@@ -180,6 +193,11 @@ static int test__bp_accounting(struct test_suite *test __maybe_unused, int subte
 	int bp_cnt = detect_cnt(true);
 	int share  = detect_share(wp_cnt, bp_cnt);
 
+	if (!BP_ACCOUNT_IS_SUPPORTED) {
+		pr_debug("Test not supported on this architecture");
+		return TEST_SKIP;
+	}
+
 	pr_debug("watchpoints count %d, breakpoints count %d, has_ioctl %d, share %d\n",
 		 wp_cnt, bp_cnt, has_ioctl, share);
 
@@ -189,29 +207,4 @@ static int test__bp_accounting(struct test_suite *test __maybe_unused, int subte
 	return bp_accounting(wp_cnt, share);
 }
 
-static bool test__bp_account_is_supported(void)
-{
-	/*
-	 * PowerPC and S390 do not support creation of instruction
-	 * breakpoints using the perf_event interface.
-	 *
-	 * Just disable the test for these architectures until these
-	 * issues are resolved.
-	 */
-#if defined(__powerpc__) || defined(__s390x__)
-	return false;
-#else
-	return true;
-#endif
-}
-
-static struct test_case bp_accounting_tests[] = {
-	TEST_CASE("Breakpoint accounting", bp_accounting),
-	{ .name = NULL, }
-};
-
-struct test_suite suite__bp_accounting = {
-	.desc = "Breakpoint accounting",
-	.test_cases = bp_accounting_tests,
-	.is_supported = test__bp_account_is_supported,
-};
+DEFINE_SUITE("Breakpoint accounting", bp_accounting);
diff --git a/tools/perf/tests/bp_signal.c b/tools/perf/tests/bp_signal.c
index 1676e3a11906..1f2908f02389 100644
--- a/tools/perf/tests/bp_signal.c
+++ b/tools/perf/tests/bp_signal.c
@@ -166,6 +166,11 @@ static int test__bp_signal(struct test_suite *test __maybe_unused, int subtest _
 	struct sigaction sa;
 	long long count1, count2, count3;
 
+	if (!BP_SIGNAL_IS_SUPPORTED) {
+		pr_debug("Test not supported on this architecture");
+		return TEST_SKIP;
+	}
+
 	/* setup SIGIO signal handler */
 	memset(&sa, 0, sizeof(struct sigaction));
 	sa.sa_sigaction = (void *) sig_handler;
@@ -285,40 +290,4 @@ static int test__bp_signal(struct test_suite *test __maybe_unused, int subtest _
 		TEST_OK : TEST_FAIL;
 }
 
-bool test__bp_signal_is_supported(void)
-{
-	/*
-	 * PowerPC and S390 do not support creation of instruction
-	 * breakpoints using the perf_event interface.
-	 *
-	 * ARM requires explicit rounding down of the instruction
-	 * pointer in Thumb mode, and then requires the single-step
-	 * to be handled explicitly in the overflow handler to avoid
-	 * stepping into the SIGIO handler and getting stuck on the
-	 * breakpointed instruction.
-	 *
-	 * Since arm64 has the same issue with arm for the single-step
-	 * handling, this case also gets stuck on the breakpointed
-	 * instruction.
-	 *
-	 * Just disable the test for these architectures until these
-	 * issues are resolved.
-	 */
-#if defined(__powerpc__) || defined(__s390x__) || defined(__arm__) || \
-    defined(__aarch64__)
-	return false;
-#else
-	return true;
-#endif
-}
-
-static struct test_case bp_signal_tests[] = {
-	TEST_CASE("Breakpoint overflow signal handler", bp_signal),
-	{ .name = NULL, }
-};
-
-struct test_suite suite__bp_signal = {
-	.desc = "Breakpoint overflow signal handler",
-	.test_cases = bp_signal_tests,
-	.is_supported = test__bp_signal_is_supported,
-};
+DEFINE_SUITE("Breakpoint overflow signal handler", bp_signal);
diff --git a/tools/perf/tests/bp_signal_overflow.c b/tools/perf/tests/bp_signal_overflow.c
index bc1f13851750..4e897c2cf26b 100644
--- a/tools/perf/tests/bp_signal_overflow.c
+++ b/tools/perf/tests/bp_signal_overflow.c
@@ -66,6 +66,11 @@ static int test__bp_signal_overflow(struct test_suite *test __maybe_unused, int
 	long long count;
 	int fd, i, fails = 0;
 
+	if (!BP_SIGNAL_IS_SUPPORTED) {
+		pr_debug("Test not supported on this architecture");
+		return TEST_SKIP;
+	}
+
 	/* setup SIGIO signal handler */
 	memset(&sa, 0, sizeof(struct sigaction));
 	sa.sa_sigaction = (void *) sig_handler;
@@ -134,13 +139,4 @@ static int test__bp_signal_overflow(struct test_suite *test __maybe_unused, int
 	return fails ? TEST_FAIL : TEST_OK;
 }
 
-static struct test_case bp_signal_overflow_tests[] = {
-	TEST_CASE("Breakpoint overflow sampling", bp_signal_overflow),
-	{ .name = NULL, }
-};
-
-struct test_suite suite__bp_signal_overflow = {
-	.desc = "Breakpoint overflow sampling",
-	.test_cases = bp_signal_overflow_tests,
-	.is_supported = test__bp_signal_is_supported,
-};
+DEFINE_SUITE("Breakpoint overflow sampling", bp_signal_overflow);
diff --git a/tools/perf/tests/tests.h b/tools/perf/tests/tests.h
index cae33c375d55..958f94dcc94c 100644
--- a/tools/perf/tests/tests.h
+++ b/tools/perf/tests/tests.h
@@ -151,7 +151,26 @@ DECLARE_SUITE(expand_cgroup_events);
 DECLARE_SUITE(perf_time_to_tsc);
 DECLARE_SUITE(dlfilter);
 
-bool test__bp_signal_is_supported(void);
+/*
+ * PowerPC and S390 do not support creation of instruction breakpoints using the
+ * perf_event interface.
+ *
+ * ARM requires explicit rounding down of the instruction pointer in Thumb mode,
+ * and then requires the single-step to be handled explicitly in the overflow
+ * handler to avoid stepping into the SIGIO handler and getting stuck on the
+ * breakpointed instruction.
+ *
+ * Since arm64 has the same issue with arm for the single-step handling, this
+ * case also gets stuck on the breakpointed instruction.
+ *
+ * Just disable the test for these architectures until these issues are
+ * resolved.
+ */
+#if defined(__powerpc__) || defined(__s390x__) || defined(__arm__) || defined(__aarch64__)
+#define BP_SIGNAL_IS_SUPPORTED 0
+#else
+#define BP_SIGNAL_IS_SUPPORTED 1
+#endif
 
 #ifdef HAVE_DWARF_UNWIND_SUPPORT
 struct thread;
-- 
2.33.1.1089.g2158813163f-goog


  parent reply	other threads:[~2021-11-04  6:45 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-04  6:41 [PATCH v3 00/22] Start aligning perf test with kunit style Ian Rogers
2021-11-04  6:41 ` [PATCH v3 01/22] perf test: Use macro for "suite" declarations Ian Rogers
2021-11-04  6:41 ` [PATCH v3 02/22] perf test: Use macro for "suite" definitions Ian Rogers
2021-11-04  6:41 ` [PATCH v3 03/22] perf test: Make each test/suite its own struct Ian Rogers
2021-11-13 13:06   ` Arnaldo Carvalho de Melo
2021-11-13 13:29     ` Arnaldo Carvalho de Melo
2021-11-04  6:41 ` [PATCH v3 04/22] perf test: Move each test suite struct to its test Ian Rogers
2021-11-04  6:41 ` [PATCH v3 05/22] perf test: Rename struct test to test_suite Ian Rogers
2021-11-04  6:41 ` [PATCH v3 06/22] perf test: Add helper functions for abstraction Ian Rogers
2021-11-04  6:41 ` [PATCH v3 07/22] perf test: Add test case struct Ian Rogers
2021-11-04  6:41 ` [PATCH v3 08/22] perf test: Add skip reason to test case Ian Rogers
2021-11-04  6:41 ` [PATCH v3 09/22] perf test: Convert pfm tests to use test cases Ian Rogers
2021-11-04  6:41 ` [PATCH v3 10/22] perf test: Convert pmu event tests to " Ian Rogers
2021-11-04  6:41 ` [PATCH v3 11/22] perf test: Convert watch point " Ian Rogers
2021-11-04  6:41 ` [PATCH v3 12/22] perf test: Convert clang " Ian Rogers
2021-11-04  6:41 ` [PATCH v3 13/22] perf test: Convert bpf " Ian Rogers
2021-11-04  6:42 ` [PATCH v3 14/22] perf test: Convert llvm " Ian Rogers
2021-11-04  6:42 ` [PATCH v3 15/22] perf test: Remove now unused subtest helpers Ian Rogers
2021-11-04  6:42 ` [PATCH v3 16/22] perf test: bp tests use test case Ian Rogers
2021-11-04  6:42 ` [PATCH v3 17/22] perf test: Convert time to tsc test to " Ian Rogers
2021-11-04  6:42 ` [PATCH v3 18/22] perf test: Remove non test case style support Ian Rogers
2021-11-04  6:42 ` Ian Rogers [this message]
2021-11-04  6:42 ` [PATCH v3 20/22] perf test: TSC test, remove is_supported use Ian Rogers
2021-11-04  6:42 ` [PATCH v3 21/22] perf test: Remove is_supported function Ian Rogers
2021-11-04  6:42 ` [PATCH v3 22/22] perf test: Remove skip_if_fail Ian Rogers
2021-11-04 13:51   ` Sohaib Mohamed
2021-11-09 14:32     ` Arnaldo Carvalho de Melo
2021-11-10 15:44       ` Sohaib Mohamed
2021-11-09 11:08 ` [PATCH v3 00/22] Start aligning perf test with kunit style Jiri Olsa
2021-11-10 12:20 ` Arnaldo Carvalho de Melo
2021-11-10 16:12 ` Sohaib Mohamed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211104064208.3156807-20-irogers@google.com \
    --to=irogers@google.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=brendanhiggins@google.com \
    --cc=davidgow@google.com \
    --cc=dlatypov@google.com \
    --cc=eranian@google.com \
    --cc=john.garry@huawei.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=pc@us.ibm.com \
    --cc=peterz@infradead.org \
    --cc=sohaib.amhmd@gmail.com \
    --cc=yao.jin@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).