linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>, Thomas Gleixner <tglx@linutronix.de>
Cc: Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	Clark Williams <williams@redhat.com>,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	John Garry <john.garry@huawei.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Ben Hutchings <ben@decadent.org.uk>,
	Hendrik Brueckner <brueckner@linux.ibm.com>,
	Jiri Olsa <jolsa@redhat.com>,
	Kan Liang <kan.liang@linux.intel.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Mathieu Poirier <mathieu.poirier@linaro.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Shaokun Zhang <zhangshaokun@hisilicon.com>,
	Thomas Richter <tmricht@linux.ibm.com>,
	Will Deacon <will.deacon@arm.com>,
	linux-arm-kernel@lists.infradead.org, linuxarm@huawei.com,
	stable@vger.kernel.org,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 19/25] perf pmu: Fix uncore PMU alias list for ARM64
Date: Fri, 21 Jun 2019 14:38:25 -0300	[thread overview]
Message-ID: <20190621173831.13780-20-acme@kernel.org> (raw)
In-Reply-To: <20190621173831.13780-1-acme@kernel.org>

From: John Garry <john.garry@huawei.com>

In commit 292c34c10249 ("perf pmu: Fix core PMU alias list for X86
platform"), we fixed the issue of CPU events being aliased to uncore
events.

Fix this same issue for ARM64, since the said commit left the (broken)
behaviour untouched for ARM64.

Signed-off-by: John Garry <john.garry@huawei.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ben Hutchings <ben@decadent.org.uk>
Cc: Hendrik Brueckner <brueckner@linux.ibm.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Shaokun Zhang <zhangshaokun@hisilicon.com>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linuxarm@huawei.com
Cc: stable@vger.kernel.org
Fixes: 292c34c10249 ("perf pmu: Fix core PMU alias list for X86 platform")
Link: http://lkml.kernel.org/r/1560521283-73314-2-git-send-email-john.garry@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/pmu.c | 28 ++++++++++++----------------
 1 file changed, 12 insertions(+), 16 deletions(-)

diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index e0429f4ef335..faa8eb231e1b 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -709,9 +709,7 @@ static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu)
 {
 	int i;
 	struct pmu_events_map *map;
-	struct pmu_event *pe;
 	const char *name = pmu->name;
-	const char *pname;
 
 	map = perf_pmu__find_map(pmu);
 	if (!map)
@@ -722,28 +720,26 @@ static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu)
 	 */
 	i = 0;
 	while (1) {
+		const char *cpu_name = is_arm_pmu_core(name) ? name : "cpu";
+		struct pmu_event *pe = &map->table[i++];
+		const char *pname = pe->pmu ? pe->pmu : cpu_name;
 
-		pe = &map->table[i++];
 		if (!pe->name) {
 			if (pe->metric_group || pe->metric_name)
 				continue;
 			break;
 		}
 
-		if (!is_arm_pmu_core(name)) {
-			pname = pe->pmu ? pe->pmu : "cpu";
-
-			/*
-			 * uncore alias may be from different PMU
-			 * with common prefix
-			 */
-			if (pmu_is_uncore(name) &&
-			    !strncmp(pname, name, strlen(pname)))
-				goto new_alias;
+		/*
+		 * uncore alias may be from different PMU
+		 * with common prefix
+		 */
+		if (pmu_is_uncore(name) &&
+		    !strncmp(pname, name, strlen(pname)))
+			goto new_alias;
 
-			if (strcmp(pname, name))
-				continue;
-		}
+		if (strcmp(pname, name))
+			continue;
 
 new_alias:
 		/* need type casts to override 'const' */
-- 
2.20.1


  parent reply	other threads:[~2019-06-21 17:41 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-21 17:38 [GIT PULL] perf/core improvements and fixes Arnaldo Carvalho de Melo
2019-06-21 17:38 ` [PATCH 01/25] perf tests arm64: Compile tests unconditionally Arnaldo Carvalho de Melo
2019-06-21 17:38 ` [PATCH 02/25] perf: cs-etm: Optimize option setup for CPU-wide sessions Arnaldo Carvalho de Melo
2019-06-21 17:38 ` [PATCH 03/25] perf intel-pt: Add new packets for PEBS via PT Arnaldo Carvalho de Melo
2019-06-21 17:38 ` [PATCH 04/25] perf intel-pt: Add Intel PT packet decoder test Arnaldo Carvalho de Melo
2019-06-21 17:38 ` [PATCH 05/25] perf intel-pt: Add decoder support for PEBS via PT Arnaldo Carvalho de Melo
2019-06-21 17:38 ` [PATCH 06/25] perf intel-pt: Prepare to synthesize PEBS samples Arnaldo Carvalho de Melo
2019-06-21 17:38 ` [PATCH 07/25] perf intel-pt: Factor out common sample preparation for re-use Arnaldo Carvalho de Melo
2019-06-21 17:38 ` [PATCH 08/25] perf intel-pt: Synthesize PEBS sample basic information Arnaldo Carvalho de Melo
2019-06-21 17:38 ` [PATCH 09/25] perf intel-pt: Add gp registers to synthesized PEBS sample Arnaldo Carvalho de Melo
2019-06-21 17:38 ` [PATCH 10/25] perf intel-pt: Add XMM " Arnaldo Carvalho de Melo
2019-06-21 17:38 ` [PATCH 11/25] perf intel-pt: Add LBR information " Arnaldo Carvalho de Melo
2019-06-21 17:38 ` [PATCH 12/25] perf intel-pt: Add memory " Arnaldo Carvalho de Melo
2019-06-21 17:38 ` [PATCH 13/25] perf intel-pt: Add callchain " Arnaldo Carvalho de Melo
2019-06-21 17:38 ` [PATCH 14/25] tools build: Check if gettid() is available before providing helper Arnaldo Carvalho de Melo
2019-06-21 17:38 ` [PATCH 15/25] perf trace: Fix exclusion of not available syscall names from selector list Arnaldo Carvalho de Melo
2019-06-21 17:38 ` [PATCH 16/25] perf trace: Streamline validation of select syscall names list Arnaldo Carvalho de Melo
2019-06-21 17:38 ` [PATCH 17/25] tools build feature tests: Add missing SPDX headers Arnaldo Carvalho de Melo
2019-06-21 17:38 ` [PATCH 18/25] perf " Arnaldo Carvalho de Melo
2019-06-21 17:38 ` Arnaldo Carvalho de Melo [this message]
2019-06-21 17:38 ` [PATCH 20/25] perf trace: Fixup pointer arithmetic when consuming augmented syscall args Arnaldo Carvalho de Melo
2019-06-21 17:38 ` [PATCH 21/25] perf evsel: Make perf_evsel__name() accept a NULL argument Arnaldo Carvalho de Melo
2019-06-21 17:38 ` [PATCH 22/25] perf tools: Don't hardcode host include path for libslang Arnaldo Carvalho de Melo
2019-06-21 17:38 ` [PATCH 23/25] tools build: Add test to check if slang.h is in /usr/include/slang/ Arnaldo Carvalho de Melo
2019-06-21 17:38 ` [PATCH 24/25] perf build: Handle slang being in /usr/include and " Arnaldo Carvalho de Melo
2019-06-21 17:38 ` [PATCH 25/25] tools build: Fix the zstd test in the test-all.c common case feature test Arnaldo Carvalho de Melo
2019-06-22  6:28 ` [GIT PULL] perf/core improvements and fixes Ingo Molnar

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=20190621173831.13780-20-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=ben@decadent.org.uk \
    --cc=brueckner@linux.ibm.com \
    --cc=john.garry@huawei.com \
    --cc=jolsa@kernel.org \
    --cc=jolsa@redhat.com \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.poirier@linaro.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=tmricht@linux.ibm.com \
    --cc=will.deacon@arm.com \
    --cc=williams@redhat.com \
    --cc=zhangshaokun@hisilicon.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).