linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf pmu-events: Fix the missing "cpu_clk_unhalted.core"
@ 2019-07-29  7:27 Jin Yao
  2019-07-29 18:16 ` Andi Kleen
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Jin Yao @ 2019-07-29  7:27 UTC (permalink / raw)
  To: acme, jolsa, peterz, mingo, alexander.shishkin
  Cc: Linux-kernel, ak, kan.liang, yao.jin, Jin Yao

The events defined in pmu-events JSON are parsed and added into
perf tool. For fixed counters, we handle the encodings between
JSON and perf by using a static array fixed[].

But the fixed[] has missed an important event "cpu_clk_unhalted.core".

For example, on tremont platform,

[root@localhost ~]# perf stat -e cpu_clk_unhalted.core -a
event syntax error: 'cpu_clk_unhalted.core'
                     \___ parser error

With this patch, the event cpu_clk_unhalted.core can be parsed.

[root@localhost perf]# ./perf stat -e cpu_clk_unhalted.core -a -vvv
------------------------------------------------------------
perf_event_attr:
  type                             4
  size                             112
  config                           0x3c
  sample_type                      IDENTIFIER
  read_format                      TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING
  disabled                         1
  inherit                          1
  exclude_guest                    1
------------------------------------------------------------
...

Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
---
 tools/perf/pmu-events/jevents.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
index 1a91a197cafb..d413761621b0 100644
--- a/tools/perf/pmu-events/jevents.c
+++ b/tools/perf/pmu-events/jevents.c
@@ -453,6 +453,7 @@ static struct fixed {
 	{ "inst_retired.any_p", "event=0xc0" },
 	{ "cpu_clk_unhalted.ref", "event=0x0,umask=0x03" },
 	{ "cpu_clk_unhalted.thread", "event=0x3c" },
+	{ "cpu_clk_unhalted.core", "event=0x3c" },
 	{ "cpu_clk_unhalted.thread_any", "event=0x3c,any=1" },
 	{ NULL, NULL},
 };
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] perf pmu-events: Fix the missing "cpu_clk_unhalted.core"
  2019-07-29  7:27 [PATCH] perf pmu-events: Fix the missing "cpu_clk_unhalted.core" Jin Yao
@ 2019-07-29 18:16 ` Andi Kleen
  2019-07-30  1:43   ` Jin, Yao
  2019-08-08 13:56 ` Arnaldo Carvalho de Melo
  2019-08-08 20:23 ` [tip:perf/urgent] perf pmu-events: Fix missing "cpu_clk_unhalted.core" event tip-bot for Jin Yao
  2 siblings, 1 reply; 7+ messages in thread
From: Andi Kleen @ 2019-07-29 18:16 UTC (permalink / raw)
  To: Jin Yao
  Cc: acme, jolsa, peterz, mingo, alexander.shishkin, Linux-kernel,
	kan.liang, yao.jin

> diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
> index 1a91a197cafb..d413761621b0 100644
> --- a/tools/perf/pmu-events/jevents.c
> +++ b/tools/perf/pmu-events/jevents.c
> @@ -453,6 +453,7 @@ static struct fixed {
>  	{ "inst_retired.any_p", "event=0xc0" },
>  	{ "cpu_clk_unhalted.ref", "event=0x0,umask=0x03" },
>  	{ "cpu_clk_unhalted.thread", "event=0x3c" },
> +	{ "cpu_clk_unhalted.core", "event=0x3c" },

Not sure this is correct for non Atom.

On Atom thread==core, but that is not true with SMT/HyperThreading.

The big cores currently don't have this event, so it would
match incorrectly.

This has to be handled on the event list level, perhaps with
some enhancements.

-Andi

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] perf pmu-events: Fix the missing "cpu_clk_unhalted.core"
  2019-07-29 18:16 ` Andi Kleen
@ 2019-07-30  1:43   ` Jin, Yao
  2019-08-06  0:20     ` Jin, Yao
  0 siblings, 1 reply; 7+ messages in thread
From: Jin, Yao @ 2019-07-30  1:43 UTC (permalink / raw)
  To: Andi Kleen
  Cc: acme, jolsa, peterz, mingo, alexander.shishkin, Linux-kernel,
	kan.liang, yao.jin



On 7/30/2019 2:16 AM, Andi Kleen wrote:
>> diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
>> index 1a91a197cafb..d413761621b0 100644
>> --- a/tools/perf/pmu-events/jevents.c
>> +++ b/tools/perf/pmu-events/jevents.c
>> @@ -453,6 +453,7 @@ static struct fixed {
>>   	{ "inst_retired.any_p", "event=0xc0" },
>>   	{ "cpu_clk_unhalted.ref", "event=0x0,umask=0x03" },
>>   	{ "cpu_clk_unhalted.thread", "event=0x3c" },
>> +	{ "cpu_clk_unhalted.core", "event=0x3c" },
> 
> Not sure this is correct for non Atom.
> 
> On Atom thread==core, but that is not true with SMT/HyperThreading.
> 
> The big cores currently don't have this event, so it would
> match incorrectly.
> 
> This has to be handled on the event list level, perhaps with
> some enhancements.
> 
> -Andi
> 

Hi Andi,

It is used to handle the fixed counter encodings between JSON and perf. 
If big cores don't have this event, nothing will be generated in perf list.

In big cores pipeline.json, there is only "CPU_CLK_UNHALTED.THREAD", and 
there is no "CPU_CLK_UNHALTED.CORE" defined. So at least for now, 
CPU_CLK_UNHALTED.CORE will not be generated for big core.

Thanks
Jin Yao

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] perf pmu-events: Fix the missing "cpu_clk_unhalted.core"
  2019-07-30  1:43   ` Jin, Yao
@ 2019-08-06  0:20     ` Jin, Yao
  0 siblings, 0 replies; 7+ messages in thread
From: Jin, Yao @ 2019-08-06  0:20 UTC (permalink / raw)
  To: Andi Kleen
  Cc: acme, jolsa, peterz, mingo, alexander.shishkin, Linux-kernel,
	kan.liang, yao.jin



On 7/30/2019 9:43 AM, Jin, Yao wrote:
> 
> 
> On 7/30/2019 2:16 AM, Andi Kleen wrote:
>>> diff --git a/tools/perf/pmu-events/jevents.c 
>>> b/tools/perf/pmu-events/jevents.c
>>> index 1a91a197cafb..d413761621b0 100644
>>> --- a/tools/perf/pmu-events/jevents.c
>>> +++ b/tools/perf/pmu-events/jevents.c
>>> @@ -453,6 +453,7 @@ static struct fixed {
>>>       { "inst_retired.any_p", "event=0xc0" },
>>>       { "cpu_clk_unhalted.ref", "event=0x0,umask=0x03" },
>>>       { "cpu_clk_unhalted.thread", "event=0x3c" },
>>> +    { "cpu_clk_unhalted.core", "event=0x3c" },
>>
>> Not sure this is correct for non Atom.
>>
>> On Atom thread==core, but that is not true with SMT/HyperThreading.
>>
>> The big cores currently don't have this event, so it would
>> match incorrectly.
>>
>> This has to be handled on the event list level, perhaps with
>> some enhancements.
>>
>> -Andi
>>
> 
> Hi Andi,
> 
> It is used to handle the fixed counter encodings between JSON and perf. 
> If big cores don't have this event, nothing will be generated in perf list.
> 
> In big cores pipeline.json, there is only "CPU_CLK_UNHALTED.THREAD", and 
> there is no "CPU_CLK_UNHALTED.CORE" defined. So at least for now, 
> CPU_CLK_UNHALTED.CORE will not be generated for big core.
> 
> Thanks
> Jin Yao

Hi Andi,

Does this fix and the above explanation make sense?

Thanks
Jin Yao

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] perf pmu-events: Fix the missing "cpu_clk_unhalted.core"
  2019-07-29  7:27 [PATCH] perf pmu-events: Fix the missing "cpu_clk_unhalted.core" Jin Yao
  2019-07-29 18:16 ` Andi Kleen
@ 2019-08-08 13:56 ` Arnaldo Carvalho de Melo
  2019-08-08 14:02   ` Jin, Yao
  2019-08-08 20:23 ` [tip:perf/urgent] perf pmu-events: Fix missing "cpu_clk_unhalted.core" event tip-bot for Jin Yao
  2 siblings, 1 reply; 7+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-08-08 13:56 UTC (permalink / raw)
  To: Jin Yao
  Cc: jolsa, peterz, mingo, alexander.shishkin, Linux-kernel, ak,
	kan.liang, yao.jin

Em Mon, Jul 29, 2019 at 03:27:55PM +0800, Jin Yao escreveu:
> The events defined in pmu-events JSON are parsed and added into
> perf tool. For fixed counters, we handle the encodings between
> JSON and perf by using a static array fixed[].
> 
> But the fixed[] has missed an important event "cpu_clk_unhalted.core".
> 
> For example, on tremont platform,
> 
> [root@localhost ~]# perf stat -e cpu_clk_unhalted.core -a
> event syntax error: 'cpu_clk_unhalted.core'
>                      \___ parser error
> 
> With this patch, the event cpu_clk_unhalted.core can be parsed.
> 
> [root@localhost perf]# ./perf stat -e cpu_clk_unhalted.core -a -vvv
> ------------------------------------------------------------
> perf_event_attr:
>   type                             4
>   size                             112
>   config                           0x3c
>   sample_type                      IDENTIFIER
>   read_format                      TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING
>   disabled                         1
>   inherit                          1
>   exclude_guest                    1
> ------------------------------------------------------------

Thanks, applied, next time please do not add lines starting with ---,
prefix it with two spaces so that git am scripts don't get confused.


- Arnaldo

> ...
> 
> Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
> ---
>  tools/perf/pmu-events/jevents.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
> index 1a91a197cafb..d413761621b0 100644
> --- a/tools/perf/pmu-events/jevents.c
> +++ b/tools/perf/pmu-events/jevents.c
> @@ -453,6 +453,7 @@ static struct fixed {
>  	{ "inst_retired.any_p", "event=0xc0" },
>  	{ "cpu_clk_unhalted.ref", "event=0x0,umask=0x03" },
>  	{ "cpu_clk_unhalted.thread", "event=0x3c" },
> +	{ "cpu_clk_unhalted.core", "event=0x3c" },
>  	{ "cpu_clk_unhalted.thread_any", "event=0x3c,any=1" },
>  	{ NULL, NULL},
>  };
> -- 
> 2.17.1

-- 

- Arnaldo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] perf pmu-events: Fix the missing "cpu_clk_unhalted.core"
  2019-08-08 13:56 ` Arnaldo Carvalho de Melo
@ 2019-08-08 14:02   ` Jin, Yao
  0 siblings, 0 replies; 7+ messages in thread
From: Jin, Yao @ 2019-08-08 14:02 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: jolsa, peterz, mingo, alexander.shishkin, Linux-kernel, ak,
	kan.liang, yao.jin



On 8/8/2019 9:56 PM, Arnaldo Carvalho de Melo wrote:
> Em Mon, Jul 29, 2019 at 03:27:55PM +0800, Jin Yao escreveu:
>> The events defined in pmu-events JSON are parsed and added into
>> perf tool. For fixed counters, we handle the encodings between
>> JSON and perf by using a static array fixed[].
>>
>> But the fixed[] has missed an important event "cpu_clk_unhalted.core".
>>
>> For example, on tremont platform,
>>
>> [root@localhost ~]# perf stat -e cpu_clk_unhalted.core -a
>> event syntax error: 'cpu_clk_unhalted.core'
>>                       \___ parser error
>>
>> With this patch, the event cpu_clk_unhalted.core can be parsed.
>>
>> [root@localhost perf]# ./perf stat -e cpu_clk_unhalted.core -a -vvv
>> ------------------------------------------------------------
>> perf_event_attr:
>>    type                             4
>>    size                             112
>>    config                           0x3c
>>    sample_type                      IDENTIFIER
>>    read_format                      TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING
>>    disabled                         1
>>    inherit                          1
>>    exclude_guest                    1
>> ------------------------------------------------------------
> 
> Thanks, applied, next time please do not add lines starting with ---,
> prefix it with two spaces so that git am scripts don't get confused.
> 
> 
> - Arnaldo
> 

Got it, thanks for reminding. I will be careful next time.

Thanks
Jin Yao

>> ...
>>
>> Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
>> ---
>>   tools/perf/pmu-events/jevents.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
>> index 1a91a197cafb..d413761621b0 100644
>> --- a/tools/perf/pmu-events/jevents.c
>> +++ b/tools/perf/pmu-events/jevents.c
>> @@ -453,6 +453,7 @@ static struct fixed {
>>   	{ "inst_retired.any_p", "event=0xc0" },
>>   	{ "cpu_clk_unhalted.ref", "event=0x0,umask=0x03" },
>>   	{ "cpu_clk_unhalted.thread", "event=0x3c" },
>> +	{ "cpu_clk_unhalted.core", "event=0x3c" },
>>   	{ "cpu_clk_unhalted.thread_any", "event=0x3c,any=1" },
>>   	{ NULL, NULL},
>>   };
>> -- 
>> 2.17.1
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [tip:perf/urgent] perf pmu-events: Fix missing "cpu_clk_unhalted.core" event
  2019-07-29  7:27 [PATCH] perf pmu-events: Fix the missing "cpu_clk_unhalted.core" Jin Yao
  2019-07-29 18:16 ` Andi Kleen
  2019-08-08 13:56 ` Arnaldo Carvalho de Melo
@ 2019-08-08 20:23 ` tip-bot for Jin Yao
  2 siblings, 0 replies; 7+ messages in thread
From: tip-bot for Jin Yao @ 2019-08-08 20:23 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: yao.jin, ak, peterz, kan.liang, alexander.shishkin, linux-kernel,
	hpa, mingo, yao.jin, acme, tglx, jolsa

Commit-ID:  8e6e5bea2e34c61291d00cb3f47560341aa84bc3
Gitweb:     https://git.kernel.org/tip/8e6e5bea2e34c61291d00cb3f47560341aa84bc3
Author:     Jin Yao <yao.jin@linux.intel.com>
AuthorDate: Mon, 29 Jul 2019 15:27:55 +0800
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 8 Aug 2019 15:41:37 -0300

perf pmu-events: Fix missing "cpu_clk_unhalted.core" event

The events defined in pmu-events JSON are parsed and added into perf
tool. For fixed counters, we handle the encodings between JSON and perf
by using a static array fixed[].

But the fixed[] has missed an important event "cpu_clk_unhalted.core".

For example, on the Tremont platform,

  [root@localhost ~]# perf stat -e cpu_clk_unhalted.core -a
  event syntax error: 'cpu_clk_unhalted.core'
                       \___ parser error

With this patch, the event cpu_clk_unhalted.core can be parsed.

  [root@localhost perf]# ./perf stat -e cpu_clk_unhalted.core -a -vvv
  ------------------------------------------------------------
  perf_event_attr:
    type                             4
    size                             112
    config                           0x3c
    sample_type                      IDENTIFIER
    read_format                      TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING
    disabled                         1
    inherit                          1
    exclude_guest                    1
  ------------------------------------------------------------
...

Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jin Yao <yao.jin@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20190729072755.2166-1-yao.jin@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/pmu-events/jevents.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
index 1a91a197cafb..d413761621b0 100644
--- a/tools/perf/pmu-events/jevents.c
+++ b/tools/perf/pmu-events/jevents.c
@@ -453,6 +453,7 @@ static struct fixed {
 	{ "inst_retired.any_p", "event=0xc0" },
 	{ "cpu_clk_unhalted.ref", "event=0x0,umask=0x03" },
 	{ "cpu_clk_unhalted.thread", "event=0x3c" },
+	{ "cpu_clk_unhalted.core", "event=0x3c" },
 	{ "cpu_clk_unhalted.thread_any", "event=0x3c,any=1" },
 	{ NULL, NULL},
 };

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-08-08 20:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-29  7:27 [PATCH] perf pmu-events: Fix the missing "cpu_clk_unhalted.core" Jin Yao
2019-07-29 18:16 ` Andi Kleen
2019-07-30  1:43   ` Jin, Yao
2019-08-06  0:20     ` Jin, Yao
2019-08-08 13:56 ` Arnaldo Carvalho de Melo
2019-08-08 14:02   ` Jin, Yao
2019-08-08 20:23 ` [tip:perf/urgent] perf pmu-events: Fix missing "cpu_clk_unhalted.core" event tip-bot for Jin Yao

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).