diff mbox series

[v2,1/5] perf pmu: Fix uncore PMU alias list for ARM64

Message ID 1560521283-73314-2-git-send-email-john.garry@huawei.com (mailing list archive)
State New, archived
Headers show
Series Perf uncore PMU event alias support for Hisi hip08 ARM64 platform | expand

Commit Message

John Garry June 14, 2019, 2:07 p.m. UTC
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>
---
 tools/perf/util/pmu.c | 28 ++++++++++++----------------
 1 file changed, 12 insertions(+), 16 deletions(-)

Comments

Arnaldo Carvalho de Melo June 14, 2019, 2:46 p.m. UTC | #1
Em Fri, Jun 14, 2019 at 10:07:59PM +0800, John Garry escreveu:
> 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.

So I added:

Cc: stable@vger.kernel.org
Fixes: 292c34c10249 ("perf pmu: Fix core PMU alias list for X86 platform")

So that the stable trees get this fix and add it to the versions where
it should have been together with the x86 fix, ok?

- Arnaldo
 
> Signed-off-by: John Garry <john.garry@huawei.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 f2eff272279b..7e7299fee550 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:
>  		pr_err("%s new_alias name=%s pe->name=%s\n", __func__, name, pe->name);
> -- 
> 2.17.1
John Garry June 14, 2019, 3:04 p.m. UTC | #2
On 14/06/2019 15:46, Arnaldo Carvalho de Melo wrote:
> Em Fri, Jun 14, 2019 at 10:07:59PM +0800, John Garry escreveu:
>> 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.
>
> So I added:
>
> Cc: stable@vger.kernel.org
> Fixes: 292c34c10249 ("perf pmu: Fix core PMU alias list for X86 platform")
>
> So that the stable trees get this fix and add it to the versions where
> it should have been together with the x86 fix, ok?

Hi Arnaldo,

I have a slight hesitation about this qualifying for the stable.

It's fixing uncore pmu aliasing for arm64. But this series is also the 
first to introduce any actual arm64 uncore pmu aliases.

Thanks,
John

>
> - Arnaldo
>
>> Signed-off-by: John Garry <john.garry@huawei.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 f2eff272279b..7e7299fee550 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:
>>  		pr_err("%s new_alias name=%s pe->name=%s\n", __func__, name, pe->name);
>> --
>> 2.17.1
>
Arnaldo Carvalho de Melo June 14, 2019, 3:47 p.m. UTC | #3
Em Fri, Jun 14, 2019 at 04:04:26PM +0100, John Garry escreveu:
> On 14/06/2019 15:46, Arnaldo Carvalho de Melo wrote:
> > Em Fri, Jun 14, 2019 at 10:07:59PM +0800, John Garry escreveu:
> > > 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.
> > 
> > So I added:
> > 
> > Cc: stable@vger.kernel.org
> > Fixes: 292c34c10249 ("perf pmu: Fix core PMU alias list for X86 platform")
> > 
> > So that the stable trees get this fix and add it to the versions where
> > it should have been together with the x86 fix, ok?
> 
> Hi Arnaldo,
> 
> I have a slight hesitation about this qualifying for the stable.
> 
> It's fixing uncore pmu aliasing for arm64. But this series is also the first
> to introduce any actual arm64 uncore pmu aliases.

I'm not talking about the whole series, just the first patch, the one
you said should've been done together with the equivalent fix for x86.

- Arnaldo
 
> Thanks,
> John
> 
> > 
> > - Arnaldo
> > 
> > > Signed-off-by: John Garry <john.garry@huawei.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 f2eff272279b..7e7299fee550 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:
> > >  		pr_err("%s new_alias name=%s pe->name=%s\n", __func__, name, pe->name);
> > > --
> > > 2.17.1
> > 
>
diff mbox series

Patch

diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index f2eff272279b..7e7299fee550 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:
 		pr_err("%s new_alias name=%s pe->name=%s\n", __func__, name, pe->name);