linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Garry <john.garry@huawei.com>
To: <peterz@infradead.org>, <mingo@redhat.com>, <acme@kernel.org>,
	<mark.rutland@arm.com>, <alexander.shishkin@linux.intel.com>,
	<jolsa@redhat.com>, <namhyung@kernel.org>
Cc: <yao.jin@linux.intel.com>, <linux-kernel@vger.kernel.org>,
	<linux-perf-users@vger.kernel.org>, <irogers@google.com>,
	<linuxarm@huawei.com>, John Garry <john.garry@huawei.com>
Subject: [PATCH 05/11] perf test: Test pmu-events core aliases separately
Date: Thu, 29 Jul 2021 21:56:20 +0800	[thread overview]
Message-ID: <1627566986-30605-6-git-send-email-john.garry@huawei.com> (raw)
In-Reply-To: <1627566986-30605-1-git-send-email-john.garry@huawei.com>

The current method to test uncore event aliasing is limited, as it relies
on the uncore PMU being present in the host system to test.

As such, breakages of uncore PMU aliases goes unnoticed. To make this more
robust, a new method of testing uncore PMUs with fake PMUs will be used in
future. This will be separate to testing core PMU aliases.

So make the current test function core PMU only. Uncore PMU alias support
will be re-added later.

Signed-off-by: John Garry <john.garry@huawei.com>
---
 tools/perf/tests/pmu-events.c | 45 +++++++++++++----------------------
 1 file changed, 16 insertions(+), 29 deletions(-)

diff --git a/tools/perf/tests/pmu-events.c b/tools/perf/tests/pmu-events.c
index 8fb5df6ee500..9537bbdd09f0 100644
--- a/tools/perf/tests/pmu-events.c
+++ b/tools/perf/tests/pmu-events.c
@@ -352,26 +352,19 @@ static struct perf_pmu_alias *find_alias(const char *test_event, struct list_hea
 }
 
 /* Verify aliases are as expected */
-static int __test__pmu_event_aliases(char *pmu_name, int *count)
+static int __test_core_pmu_event_aliases(char *pmu_name, int *count)
 {
 	struct perf_pmu_test_event const **test_event_table;
 	struct perf_pmu *pmu;
 	LIST_HEAD(aliases);
 	int res = 0;
-	bool use_uncore_table;
 	struct pmu_events_map *map = __test_pmu_get_events_map();
 	struct perf_pmu_alias *a, *tmp;
 
 	if (!map)
 		return -1;
 
-	if (is_pmu_core(pmu_name)) {
-		test_event_table = &core_events[0];
-		use_uncore_table = false;
-	} else {
-		test_event_table = &uncore_events[0];
-		use_uncore_table = true;
-	}
+	test_event_table = &core_events[0];
 
 	pmu = zalloc(sizeof(*pmu));
 	if (!pmu)
@@ -384,20 +377,10 @@ static int __test__pmu_event_aliases(char *pmu_name, int *count)
 	for (; *test_event_table; test_event_table++) {
 		struct perf_pmu_test_event const *test_event = *test_event_table;
 		struct pmu_event const *event = &test_event->event;
-
 		struct perf_pmu_alias *alias = find_alias(event->name, &aliases);
 
 		if (!alias) {
-			bool uncore_match = pmu_uncore_alias_match(pmu_name,
-								   event->pmu);
-
-			if (use_uncore_table && !uncore_match) {
-				pr_debug3("testing aliases PMU %s: skip matching alias %s\n",
-					  pmu_name, event->name);
-				continue;
-			}
-
-			pr_debug2("testing aliases PMU %s: no alias, alias_table->name=%s\n",
+			pr_debug("testing aliases core PMU %s: no alias, alias_table->name=%s\n",
 				  pmu_name, event->name);
 			res = -1;
 			break;
@@ -409,7 +392,7 @@ static int __test__pmu_event_aliases(char *pmu_name, int *count)
 		}
 
 		(*count)++;
-		pr_debug2("testing aliases PMU %s: matched event %s\n",
+		pr_debug2("testing aliases core PMU %s: matched event %s\n",
 			  pmu_name, alias->name);
 	}
 
@@ -421,7 +404,6 @@ static int __test__pmu_event_aliases(char *pmu_name, int *count)
 	return res;
 }
 
-
 /* Test that aliases generated are as expected */
 static int test_aliases(void)
 {
@@ -430,21 +412,26 @@ static int test_aliases(void)
 	while ((pmu = perf_pmu__scan(pmu)) != NULL) {
 		int count = 0;
 
+		if (!is_pmu_core(pmu->name))
+			continue;
+
 		if (list_empty(&pmu->format)) {
-			pr_debug2("skipping testing PMU %s\n", pmu->name);
+			pr_debug2("skipping testing core PMU %s\n", pmu->name);
 			continue;
 		}
 
-		if (__test__pmu_event_aliases(pmu->name, &count)) {
-			pr_debug("testing PMU %s aliases: failed\n", pmu->name);
+		if (__test_core_pmu_event_aliases(pmu->name, &count)) {
+			pr_debug("testing core PMU %s aliases: failed\n", pmu->name);
 			return -1;
 		}
 
-		if (count == 0)
-			pr_debug3("testing PMU %s aliases: no events to match\n",
+		if (count == 0) {
+			pr_debug("testing core PMU %s aliases: no events to match\n",
 				  pmu->name);
-		else
-			pr_debug("testing PMU %s aliases: pass\n", pmu->name);
+			return -1;
+		}
+
+		pr_debug("testing core PMU %s aliases: pass\n", pmu->name);
 	}
 
 	return 0;
-- 
2.26.2


  parent reply	other threads:[~2021-07-29 14:09 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-29 13:56 [PATCH 00/11] perf test: Improve pmu-events support John Garry
2021-07-29 13:56 ` [PATCH 01/11] perf test: Factor out pmu-events event comparison John Garry
2021-07-29 13:56 ` [PATCH 02/11] perf jevents: Relocate test events to cpu folder John Garry
2021-08-02 14:54   ` Arnaldo Carvalho de Melo
2021-08-02 15:02     ` John Garry
2021-08-03  8:19     ` John Garry
2021-08-09 15:46       ` John Garry
2021-08-10 14:01         ` Arnaldo Carvalho de Melo
2021-08-10 14:23           ` John Garry
2021-08-10 14:34             ` Arnaldo Carvalho de Melo
2021-08-10 17:58             ` Arnaldo Carvalho de Melo
2021-08-11  7:59               ` John Garry
2021-08-11 18:38                 ` Arnaldo Carvalho de Melo
2021-07-29 13:56 ` [PATCH 03/11] perf test: Declare pmu-events test events separately John Garry
2021-07-29 13:56 ` [PATCH 04/11] perf test: Factor out pmu-events alias comparison John Garry
2021-07-29 13:56 ` John Garry [this message]
2021-07-29 13:56 ` [PATCH 06/11] perf pmu: Check .is_uncore field in pmu_add_cpu_aliases_map() John Garry
2021-07-29 13:56 ` [PATCH 07/11] perf test: Re-add pmu-event uncore PMU alias test John Garry
2021-07-29 13:56 ` [PATCH 08/11] perf test: Add more pmu-events uncore aliases John Garry
2021-07-29 13:56 ` [PATCH 09/11] perf pmu: Make pmu_add_sys_aliases() public John Garry
2021-07-29 13:56 ` [PATCH 10/11] perf jevents: Print SoC name per system event table John Garry
2021-07-29 13:56 ` [PATCH 11/11] perf test: Add pmu-events sys event support John Garry

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=1627566986-30605-6-git-send-email-john.garry@huawei.com \
    --to=john.garry@huawei.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --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).