2020-05-07 16:30:56

by Paul A. Clarke

[permalink] [raw]
Subject: [PATCH 1/2] perf: Fix POWER9 metric 'lsu_other_stall_cpi'

From: "Paul A. Clarke" <[email protected]>

The metric definition is too long for the current value of EXPR_MAX_OTHER.
Increase the value EXPR_MAX_OTHER sufficiently to allow
'lsu_other_stall_cpi' to build properly.

Before:
--
$ perf list | grep lsu_other
lsu_other_stall_cpi
# perf stat -a --metrics lsu_other_stall_cpi /bin/sleep 1
Cannot find metric or group `lsu_other_stall_cpi'

Usage: perf stat [<options>] [<command>]

-M, --metrics <metric/metric group list>
monitor specified metrics or metric groups (separated by ,)
--

After:
--
# perf stat -a --metrics lsu_other_stall_cpi /bin/sleep 1

Performance counter stats for 'system wide':

438,086,889 pm_cmplu_stall_lsu # 1.74 lsu_other_stall_cpi
[...]
--

Signed-off-by: Paul A. Clarke <[email protected]>
---
tools/perf/util/expr.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/expr.h b/tools/perf/util/expr.h
index 87d627bb699b..a0991959cca4 100644
--- a/tools/perf/util/expr.h
+++ b/tools/perf/util/expr.h
@@ -2,7 +2,7 @@
#ifndef PARSE_CTX_H
#define PARSE_CTX_H 1

-#define EXPR_MAX_OTHER 20
+#define EXPR_MAX_OTHER 28
#define MAX_PARSE_ID EXPR_MAX_OTHER

struct expr_parse_id {
--
2.18.2


2020-05-07 16:53:13

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCH 1/2] perf: Fix POWER9 metric 'lsu_other_stall_cpi'

Em Thu, May 07, 2020 at 11:28:57AM -0500, Paul A. Clarke escreveu:
> From: "Paul A. Clarke" <[email protected]>
>
> The metric definition is too long for the current value of EXPR_MAX_OTHER.
> Increase the value EXPR_MAX_OTHER sufficiently to allow
> 'lsu_other_stall_cpi' to build properly.

I already have a patch from Ian that bumps this further:

[acme@five perf]$ git log -p tools/perf/util/expr.h
commit 26d3350db3e4668c1b1ff7f81c419afe71a2e8d9
Author: Ian Rogers <[email protected]>
Date: Fri May 1 10:33:26 2020 -0700

perf expr: Increase max other

Large metrics such as Branch_Misprediction_Cost_SMT on x86 broadwell
need more space.

Signed-off-by: Ian Rogers <[email protected]>
Acked-by: Jiri Olsa <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Haiyan Song <[email protected]>
Cc: Jin Yao <[email protected]>
Cc: John Garry <[email protected]>
Cc: Kajol Jain <[email protected]>
Cc: Kan Liang <[email protected]>
Cc: Leo Yan <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Paul Clarke <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Ravi Bangoria <[email protected]>
Cc: Song Liu <[email protected]>
Cc: Stephane Eranian <[email protected]>
Link: http://lore.kernel.org/lkml/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>

diff --git a/tools/perf/util/expr.h b/tools/perf/util/expr.h
index 87d627bb699b..40fc452b0f2b 100644
--- a/tools/perf/util/expr.h
+++ b/tools/perf/util/expr.h
@@ -2,7 +2,7 @@
#ifndef PARSE_CTX_H
#define PARSE_CTX_H 1

-#define EXPR_MAX_OTHER 20
+#define EXPR_MAX_OTHER 64
#define MAX_PARSE_ID EXPR_MAX_OTHER

struct expr_parse_id {


> Before:
> --
> $ perf list | grep lsu_other
> lsu_other_stall_cpi
> # perf stat -a --metrics lsu_other_stall_cpi /bin/sleep 1
> Cannot find metric or group `lsu_other_stall_cpi'
>
> Usage: perf stat [<options>] [<command>]
>
> -M, --metrics <metric/metric group list>
> monitor specified metrics or metric groups (separated by ,)
> --
>
> After:
> --
> # perf stat -a --metrics lsu_other_stall_cpi /bin/sleep 1
>
> Performance counter stats for 'system wide':
>
> 438,086,889 pm_cmplu_stall_lsu # 1.74 lsu_other_stall_cpi
> [...]
> --
>
> Signed-off-by: Paul A. Clarke <[email protected]>
> ---
> tools/perf/util/expr.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/expr.h b/tools/perf/util/expr.h
> index 87d627bb699b..a0991959cca4 100644
> --- a/tools/perf/util/expr.h
> +++ b/tools/perf/util/expr.h
> @@ -2,7 +2,7 @@
> #ifndef PARSE_CTX_H
> #define PARSE_CTX_H 1
>
> -#define EXPR_MAX_OTHER 20
> +#define EXPR_MAX_OTHER 28
> #define MAX_PARSE_ID EXPR_MAX_OTHER
>
> struct expr_parse_id {
> --
> 2.18.2
>

--

- Arnaldo

2020-05-07 17:24:18

by Ian Rogers

[permalink] [raw]
Subject: Re: [PATCH 1/2] perf: Fix POWER9 metric 'lsu_other_stall_cpi'

On Thu, May 7, 2020 at 9:48 AM Arnaldo Carvalho de Melo
<[email protected]> wrote:
>
> Em Thu, May 07, 2020 at 11:28:57AM -0500, Paul A. Clarke escreveu:
> > From: "Paul A. Clarke" <[email protected]>
> >
> > The metric definition is too long for the current value of EXPR_MAX_OTHER.
> > Increase the value EXPR_MAX_OTHER sufficiently to allow
> > 'lsu_other_stall_cpi' to build properly.
>
> I already have a patch from Ian that bumps this further:

I sent out:
https://lore.kernel.org/lkml/[email protected]/
which removes this constant and moves the code to use a hashmap.
Unfortunately, the hashmap comes from libbpf and so there is a
dependency issue to resolve. Perhaps libapi can have a hashmap? I'm
not sure who resolves these issues. A short-term fix is just to make
the constant bigger.

Thanks,
Ian

> [acme@five perf]$ git log -p tools/perf/util/expr.h
> commit 26d3350db3e4668c1b1ff7f81c419afe71a2e8d9
> Author: Ian Rogers <[email protected]>
> Date: Fri May 1 10:33:26 2020 -0700
>
> perf expr: Increase max other
>
> Large metrics such as Branch_Misprediction_Cost_SMT on x86 broadwell
> need more space.
>
> Signed-off-by: Ian Rogers <[email protected]>
> Acked-by: Jiri Olsa <[email protected]>
> Cc: Adrian Hunter <[email protected]>
> Cc: Alexander Shishkin <[email protected]>
> Cc: Andi Kleen <[email protected]>
> Cc: Haiyan Song <[email protected]>
> Cc: Jin Yao <[email protected]>
> Cc: John Garry <[email protected]>
> Cc: Kajol Jain <[email protected]>
> Cc: Kan Liang <[email protected]>
> Cc: Leo Yan <[email protected]>
> Cc: Mark Rutland <[email protected]>
> Cc: Namhyung Kim <[email protected]>
> Cc: Paul Clarke <[email protected]>
> Cc: Peter Zijlstra <[email protected]>
> Cc: Ravi Bangoria <[email protected]>
> Cc: Song Liu <[email protected]>
> Cc: Stephane Eranian <[email protected]>
> Link: http://lore.kernel.org/lkml/[email protected]
> Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
>
> diff --git a/tools/perf/util/expr.h b/tools/perf/util/expr.h
> index 87d627bb699b..40fc452b0f2b 100644
> --- a/tools/perf/util/expr.h
> +++ b/tools/perf/util/expr.h
> @@ -2,7 +2,7 @@
> #ifndef PARSE_CTX_H
> #define PARSE_CTX_H 1
>
> -#define EXPR_MAX_OTHER 20
> +#define EXPR_MAX_OTHER 64
> #define MAX_PARSE_ID EXPR_MAX_OTHER
>
> struct expr_parse_id {
>
>
> > Before:
> > --
> > $ perf list | grep lsu_other
> > lsu_other_stall_cpi
> > # perf stat -a --metrics lsu_other_stall_cpi /bin/sleep 1
> > Cannot find metric or group `lsu_other_stall_cpi'
> >
> > Usage: perf stat [<options>] [<command>]
> >
> > -M, --metrics <metric/metric group list>
> > monitor specified metrics or metric groups (separated by ,)
> > --
> >
> > After:
> > --
> > # perf stat -a --metrics lsu_other_stall_cpi /bin/sleep 1
> >
> > Performance counter stats for 'system wide':
> >
> > 438,086,889 pm_cmplu_stall_lsu # 1.74 lsu_other_stall_cpi
> > [...]
> > --
> >
> > Signed-off-by: Paul A. Clarke <[email protected]>
> > ---
> > tools/perf/util/expr.h | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tools/perf/util/expr.h b/tools/perf/util/expr.h
> > index 87d627bb699b..a0991959cca4 100644
> > --- a/tools/perf/util/expr.h
> > +++ b/tools/perf/util/expr.h
> > @@ -2,7 +2,7 @@
> > #ifndef PARSE_CTX_H
> > #define PARSE_CTX_H 1
> >
> > -#define EXPR_MAX_OTHER 20
> > +#define EXPR_MAX_OTHER 28
> > #define MAX_PARSE_ID EXPR_MAX_OTHER
> >
> > struct expr_parse_id {
> > --
> > 2.18.2
> >
>
> --
>
> - Arnaldo

2020-05-08 06:35:21

by kajoljain

[permalink] [raw]
Subject: Re: [PATCH 1/2] perf: Fix POWER9 metric 'lsu_other_stall_cpi'



On 5/7/20 9:58 PM, Paul A. Clarke wrote:
> From: "Paul A. Clarke" <[email protected]>
>
> The metric definition is too long for the current value of EXPR_MAX_OTHER.
> Increase the value EXPR_MAX_OTHER sufficiently to allow
> 'lsu_other_stall_cpi' to build properly.
>
> Before:
> --
> $ perf list | grep lsu_other
> lsu_other_stall_cpi
> # perf stat -a --metrics lsu_other_stall_cpi /bin/sleep 1
> Cannot find metric or group `lsu_other_stall_cpi'
>
> Usage: perf stat [<options>] [<command>]
>
> -M, --metrics <metric/metric group list>
> monitor specified metrics or metric groups (separated by ,)
> --
>
> After:
> --
> # perf stat -a --metrics lsu_other_stall_cpi /bin/sleep 1
>
> Performance counter stats for 'system wide':
>
> 438,086,889 pm_cmplu_stall_lsu # 1.74 lsu_other_stall_cpi
> [...]
> --
>
> Signed-off-by: Paul A. Clarke <[email protected]>
> ---
> tools/perf/util/expr.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/expr.h b/tools/perf/util/expr.h
> index 87d627bb699b..a0991959cca4 100644
> --- a/tools/perf/util/expr.h
> +++ b/tools/perf/util/expr.h
> @@ -2,7 +2,7 @@
> #ifndef PARSE_CTX_H
> #define PARSE_CTX_H 1
>
> -#define EXPR_MAX_OTHER 20
> +#define EXPR_MAX_OTHER 28

Hi Paul,
Ian already add one patch to increase EXPR_MAX_OTHER value to 68 which is Acked-by: Jiri

Link to the patch: https://lkml.org/lkml/2020/5/1/1023

Thanks,
Kajol Jain

> #define MAX_PARSE_ID EXPR_MAX_OTHER
>
> struct expr_parse_id {
>

2020-05-08 07:03:51

by kajoljain

[permalink] [raw]
Subject: Re: [PATCH 1/2] perf: Fix POWER9 metric 'lsu_other_stall_cpi'



On 5/8/20 12:01 PM, kajoljain wrote:
>
>
> On 5/7/20 9:58 PM, Paul A. Clarke wrote:
>> From: "Paul A. Clarke" <[email protected]>
>>
>> The metric definition is too long for the current value of EXPR_MAX_OTHER.
>> Increase the value EXPR_MAX_OTHER sufficiently to allow
>> 'lsu_other_stall_cpi' to build properly.
>>
>> Before:
>> --
>> $ perf list | grep lsu_other
>> lsu_other_stall_cpi
>> # perf stat -a --metrics lsu_other_stall_cpi /bin/sleep 1
>> Cannot find metric or group `lsu_other_stall_cpi'
>>
>> Usage: perf stat [<options>] [<command>]
>>
>> -M, --metrics <metric/metric group list>
>> monitor specified metrics or metric groups (separated by ,)
>> --
>>
>> After:
>> --
>> # perf stat -a --metrics lsu_other_stall_cpi /bin/sleep 1
>>
>> Performance counter stats for 'system wide':
>>
>> 438,086,889 pm_cmplu_stall_lsu # 1.74 lsu_other_stall_cpi
>> [...]
>> --
>>
>> Signed-off-by: Paul A. Clarke <[email protected]>
>> ---
>> tools/perf/util/expr.h | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/perf/util/expr.h b/tools/perf/util/expr.h
>> index 87d627bb699b..a0991959cca4 100644
>> --- a/tools/perf/util/expr.h
>> +++ b/tools/perf/util/expr.h
>> @@ -2,7 +2,7 @@
>> #ifndef PARSE_CTX_H
>> #define PARSE_CTX_H 1
>>
>> -#define EXPR_MAX_OTHER 20
>> +#define EXPR_MAX_OTHER 28
>
> Hi Paul,
> Ian already add one patch to increase EXPR_MAX_OTHER value to 68 which is Acked-by: Jiri

Sorry its 64 not 68 and I missed earlier response from Arnaldo and Ian.

Thanks,
Kajol Jain
>
> Link to the patch: https://lkml.org/lkml/2020/5/1/1023
>
> Thanks,
> Kajol Jain
>
>> #define MAX_PARSE_ID EXPR_MAX_OTHER
>>
>> struct expr_parse_id {
>>