Commit 286c71f1 authored by John Garry's avatar John Garry Committed by Greg Kroah-Hartman

perf pmu: Fix uncore PMU alias list for ARM64

commit 599ee18f upstream.

In commit 292c34c1 ("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: default avatarJohn 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: 292c34c1 ("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.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c30f3eda
...@@ -709,9 +709,7 @@ static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu) ...@@ -709,9 +709,7 @@ static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu)
{ {
int i; int i;
struct pmu_events_map *map; struct pmu_events_map *map;
struct pmu_event *pe;
const char *name = pmu->name; const char *name = pmu->name;
const char *pname;
map = perf_pmu__find_map(pmu); map = perf_pmu__find_map(pmu);
if (!map) if (!map)
...@@ -722,28 +720,26 @@ static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu) ...@@ -722,28 +720,26 @@ static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu)
*/ */
i = 0; i = 0;
while (1) { 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->name) {
if (pe->metric_group || pe->metric_name) if (pe->metric_group || pe->metric_name)
continue; continue;
break; break;
} }
if (!is_arm_pmu_core(name)) { /*
pname = pe->pmu ? pe->pmu : "cpu"; * uncore alias may be from different PMU
* with common prefix
/* */
* uncore alias may be from different PMU if (pmu_is_uncore(name) &&
* with common prefix !strncmp(pname, name, strlen(pname)))
*/ goto new_alias;
if (pmu_is_uncore(name) &&
!strncmp(pname, name, strlen(pname)))
goto new_alias;
if (strcmp(pname, name)) if (strcmp(pname, name))
continue; continue;
}
new_alias: new_alias:
/* need type casts to override 'const' */ /* need type casts to override 'const' */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment