mbox series

[v2,0/6] perf arm64 metricgroup support

Message ID 1616668398-144648-1-git-send-email-john.garry@huawei.com (mailing list archive)
Headers show
Series perf arm64 metricgroup support | expand

Message

John Garry March 25, 2021, 10:33 a.m. UTC
This series contains support to get basic metricgroups working for
arm64 CPUs.

Initial support is added for HiSilicon hip08 platform.

Some sample usage on Huawei D06 board:

 $ ./perf list metric    

List of pre-defined events (to be used in -e): 

Metrics:     

  bp_misp_flush
       [BP misp flush L3 topdown metric]
  branch_mispredicts
       [Branch mispredicts L2 topdown metric]
  core_bound
       [Core bound L2 topdown metric]
  divider
       [Divider L3 topdown metric]
  exe_ports_util
       [EXE ports util L3 topdown metric]
  fetch_bandwidth_bound
       [Fetch bandwidth bound L2 topdown metric]
  fetch_latency_bound
       [Fetch latency bound L2 topdown metric]
  fsu_stall
       [FSU stall L3 topdown metric]
  idle_by_icache_miss

$ sudo ./perf stat -v -M core_bound sleep 1
Using CPUID 0x00000000480fd010
metric expr (exe_stall_cycle - (mem_stall_anyload + armv8_pmuv3_0@event\=0x7005@)) / cpu_cycles for core_bound
found event cpu_cycles
found event armv8_pmuv3_0/event=0x7005/
found event exe_stall_cycle
found event mem_stall_anyload
adding {cpu_cycles -> armv8_pmuv3_0/event=0x7001/
mem_stall_anyload -> armv8_pmuv3_0/event=0x7004/
Control descriptor is not initialized
cpu_cycles: 989433 385050 385050
armv8_pmuv3_0/event=0x7005/: 19207 385050 385050
exe_stall_cycle: 900825 385050 385050
mem_stall_anyload: 253516 385050 385050

Performance counter stats for 'sleep':

989,433      cpu_cycles      #     0.63 core_bound
  19,207      armv8_pmuv3_0/event=0x7005/
 900,825      exe_stall_cycle
 253,516      mem_stall_anyload

       0.000805809 seconds time elapsed

       0.000875000 seconds user
       0.000000000 seconds sys
       
perf stat --topdown is not supported, as this requires the CPU PMU to
expose (alias) events for the TopDown L1 metrics from sysfs, which arm 
does not do. To get that to work, we probably need to make perf use the
pmu-events cpumap to learn about those alias events.

Metric reuse support is added for pmu-events parse metric testcase.
This had been broken on power9 recentlty:
https://lore.kernel.org/lkml/20210324015418.GC8931@li-24c3614c-2adc-11b2-a85c-85f334518bdb.ibm.com/ 

Differences to v1:
- Add pmu_events_map__find() as arm64-specific function
- Fix metric reuse for pmu-events parse metric testcase 

John Garry (6):
  perf metricgroup: Make find_metric() public with name change
  perf test: Handle metric reuse in pmu-events parsing test
  perf pmu: Add pmu_events_map__find()
  perf vendor events arm64: Add Hisi hip08 L1 metrics
  perf vendor events arm64: Add Hisi hip08 L2 metrics
  perf vendor events arm64: Add Hisi hip08 L3 metrics

 tools/perf/arch/arm64/util/Build              |   1 +
 tools/perf/arch/arm64/util/pmu.c              |  25 ++
 .../arch/arm64/hisilicon/hip08/metrics.json   | 233 ++++++++++++++++++
 tools/perf/tests/pmu-events.c                 |  82 +++++-
 tools/perf/util/metricgroup.c                 |  12 +-
 tools/perf/util/metricgroup.h                 |   3 +-
 tools/perf/util/pmu.c                         |   5 +
 tools/perf/util/pmu.h                         |   1 +
 tools/perf/util/s390-sample-raw.c             |   4 +-
 9 files changed, 355 insertions(+), 11 deletions(-)
 create mode 100644 tools/perf/arch/arm64/util/pmu.c
 create mode 100644 tools/perf/pmu-events/arch/arm64/hisilicon/hip08/metrics.json

Comments

Paul A. Clarke March 25, 2021, 8:39 p.m. UTC | #1
On Thu, Mar 25, 2021 at 06:33:12PM +0800, John Garry wrote:
> Metric reuse support is added for pmu-events parse metric testcase.
> This had been broken on power9 recentlty:
> https://lore.kernel.org/lkml/20210324015418.GC8931@li-24c3614c-2adc-11b2-a85c-85f334518bdb.ibm.com/

Much better.  Before:
--
$ perf test -v 10 2>&1 | grep -i error | wc -l
112
--
After:
--
$ perf test -v 10 2>&1 | grep -i error | wc -l
17
--

And these seem like different types of issues:
--
$ perf test -v 10 2>&1 | grep -i error
Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
Error string 'Cannot find PMU `nest_powerbus0_imc'. Missing kernel support?' help '(null)'
Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
--

(Added Kajol Jain to CC)

PC
John Garry March 26, 2021, 10:57 a.m. UTC | #2
On 25/03/2021 20:39, Paul A. Clarke wrote:
> On Thu, Mar 25, 2021 at 06:33:12PM +0800, John Garry wrote:
>> Metric reuse support is added for pmu-events parse metric testcase.
>> This had been broken on power9 recentlty:
>> https://lore.kernel.org/lkml/20210324015418.GC8931@li-24c3614c-2adc-11b2-a85c-85f334518bdb.ibm.com/
> 
> Much better.  Before:
> --
> $ perf test -v 10 2>&1 | grep -i error | wc -l
> 112
> --
> After:
> --
> $ perf test -v 10 2>&1 | grep -i error | wc -l
> 17
> --
> 
> And these seem like different types of issues:
> --
> $ perf test -v 10 2>&1 | grep -i error
> Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
> Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
> Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
> Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
> Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
> Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
> Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
> Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
> Error string 'Cannot find PMU `nest_powerbus0_imc'. Missing kernel support?' help '(null)'
> Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
> Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
> Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
> Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
> Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
> Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
> Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
> Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
> --
> 

This looks suspicious.

Firstly, does /sys/bus/event_source/devices/nest_mcs01_imc (or others, 
above) exist on your system? I guess not.

Secondly, checking Documentation/powerpc/imc.rst, we have examples of:
nest_mcs01/PM_MCS01_64B_R...

So is the PMU name correct in the metric file for nest_mcs01_imc? 
Looking at the kernel driver file, arch/powerpc/perf/imc-pmu.c, it seems 
to be correct. Not sure.

Thanks,
John



> (Added Kajol Jain to CC)
>
Paul A. Clarke March 26, 2021, 1:13 p.m. UTC | #3
On Fri, Mar 26, 2021 at 10:57:40AM +0000, John Garry wrote:
> On 25/03/2021 20:39, Paul A. Clarke wrote:
> > On Thu, Mar 25, 2021 at 06:33:12PM +0800, John Garry wrote:
> > > Metric reuse support is added for pmu-events parse metric testcase.
> > > This had been broken on power9 recentlty:
> > > https://lore.kernel.org/lkml/20210324015418.GC8931@li-24c3614c-2adc-11b2-a85c-85f334518bdb.ibm.com/
> > 
> > Much better.  Before:
> > --
> > $ perf test -v 10 2>&1 | grep -i error | wc -l
> > 112
> > --
> > After:
> > --
> > $ perf test -v 10 2>&1 | grep -i error | wc -l
> > 17
> > --
> > 
> > And these seem like different types of issues:
> > --
> > $ perf test -v 10 2>&1 | grep -i error
> > Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
> > Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
> > Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
> > Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
> > Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
> > Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
> > Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
> > Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
> > Error string 'Cannot find PMU `nest_powerbus0_imc'. Missing kernel support?' help '(null)'
> > Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
> > Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
> > Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
> > Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
> > Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
> > Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
> > Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
> > Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
> > --
> > 
> 
> This looks suspicious.
> 
> Firstly, does /sys/bus/event_source/devices/nest_mcs01_imc (or others,
> above) exist on your system? I guess not.
> 
> Secondly, checking Documentation/powerpc/imc.rst, we have examples of:
> nest_mcs01/PM_MCS01_64B_R...
> 
> So is the PMU name correct in the metric file for nest_mcs01_imc? Looking at
> the kernel driver file, arch/powerpc/perf/imc-pmu.c, it seems to be correct.
> Not sure.

This may be caused by me testing a new perf on an older kernel. Let me retest.

PC
Paul A. Clarke March 29, 2021, 9:07 p.m. UTC | #4
On Fri, Mar 26, 2021 at 10:57:40AM +0000, John Garry wrote:
> On 25/03/2021 20:39, Paul A. Clarke wrote:
> > On Thu, Mar 25, 2021 at 06:33:12PM +0800, John Garry wrote:
> > > Metric reuse support is added for pmu-events parse metric testcase.
> > > This had been broken on power9 recentlty:
> > > https://lore.kernel.org/lkml/20210324015418.GC8931@li-24c3614c-2adc-11b2-a85c-85f334518bdb.ibm.com/
> > 
> > Much better.  Before:
> > --
> > $ perf test -v 10 2>&1 | grep -i error | wc -l
> > 112
> > --
> > After:
> > --
> > $ perf test -v 10 2>&1 | grep -i error | wc -l
> > 17
> > --
> > 
> > And these seem like different types of issues:
> > --
> > $ perf test -v 10 2>&1 | grep -i error
> > Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
> > Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
> > Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
> > Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
> > Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
> > Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
> > Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
> > Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
> > Error string 'Cannot find PMU `nest_powerbus0_imc'. Missing kernel support?' help '(null)'
> > Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
> > Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
> > Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
> > Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
> > Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
> > Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
> > Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
> > Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
> > --
> > 
> 
> This looks suspicious.
> 
> Firstly, does /sys/bus/event_source/devices/nest_mcs01_imc (or others,
> above) exist on your system? I guess not.
> 
> Secondly, checking Documentation/powerpc/imc.rst, we have examples of:
> nest_mcs01/PM_MCS01_64B_R...
> 
> So is the PMU name correct in the metric file for nest_mcs01_imc? Looking at
> the kernel driver file, arch/powerpc/perf/imc-pmu.c, it seems to be correct.
> Not sure.

I ran with a newer kernel, and the above errors disappeared, replaced with
about 10 of:
--
Error string 'Cannot find PMU `hv_24x7'. Missing kernel support?' help '(null)'
--

...but I was running without a hypervisor, so I tried the same kernel on a
PowerVM-virtualized system and the "hv_24x7" messages went away, but the
"nest" messages returned.  This may all be expected behavior... I confess
I haven't followed these new perf capabilities closely.

It's extremely likely that none of these errors has anything to do with your
changes. :-)

PC
kajoljain March 30, 2021, 6:41 a.m. UTC | #5
On 3/30/21 2:37 AM, Paul A. Clarke wrote:
> On Fri, Mar 26, 2021 at 10:57:40AM +0000, John Garry wrote:
>> On 25/03/2021 20:39, Paul A. Clarke wrote:
>>> On Thu, Mar 25, 2021 at 06:33:12PM +0800, John Garry wrote:
>>>> Metric reuse support is added for pmu-events parse metric testcase.
>>>> This had been broken on power9 recentlty:
>>>> https://lore.kernel.org/lkml/20210324015418.GC8931@li-24c3614c-2adc-11b2-a85c-85f334518bdb.ibm.com/
>>>
>>> Much better.  Before:
>>> --
>>> $ perf test -v 10 2>&1 | grep -i error | wc -l
>>> 112
>>> --
>>> After:
>>> --
>>> $ perf test -v 10 2>&1 | grep -i error | wc -l
>>> 17
>>> --
>>>
>>> And these seem like different types of issues:
>>> --
>>> $ perf test -v 10 2>&1 | grep -i error
>>> Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
>>> Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
>>> Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
>>> Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
>>> Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
>>> Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
>>> Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
>>> Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
>>> Error string 'Cannot find PMU `nest_powerbus0_imc'. Missing kernel support?' help '(null)'
>>> Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
>>> Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
>>> Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
>>> Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
>>> Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
>>> Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
>>> Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
>>> Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
>>> --
>>>
>>
>> This looks suspicious.
>>
>> Firstly, does /sys/bus/event_source/devices/nest_mcs01_imc (or others,
>> above) exist on your system? I guess not.
>>
>> Secondly, checking Documentation/powerpc/imc.rst, we have examples of:
>> nest_mcs01/PM_MCS01_64B_R...
>>
>> So is the PMU name correct in the metric file for nest_mcs01_imc? Looking at
>> the kernel driver file, arch/powerpc/perf/imc-pmu.c, it seems to be correct.
>> Not sure.
> 
> I ran with a newer kernel, and the above errors disappeared, replaced with
> about 10 of:
> --
> Error string 'Cannot find PMU `hv_24x7'. Missing kernel support?' help '(null)'
> --
> 
> ...but I was running without a hypervisor, so I tried the same kernel on a
> PowerVM-virtualized system and the "hv_24x7" messages went away, but the
> "nest" messages returned.  This may all be expected behavior... I confess
> I haven't followed these new perf capabilities closely.
> 

Hi Paul/John,
   This is something expected. For nest-imc we need bare-metal system and for
hv-24x7 we need VM environment. Since you are checking this test in VM machine,
there nest events are not supported and hence we are getting this error.

Thanks,
Kajol Jain

> It's extremely likely that none of these errors has anything to do with your
> changes. :-
> 
> PC
>
John Garry April 6, 2021, 11:02 a.m. UTC | #6
On 30/03/2021 07:41, kajoljain wrote:
> 
> 
> On 3/30/21 2:37 AM, Paul A. Clarke wrote:
>> On Fri, Mar 26, 2021 at 10:57:40AM +0000, John Garry wrote:
>>> On 25/03/2021 20:39, Paul A. Clarke wrote:
>>>> On Thu, Mar 25, 2021 at 06:33:12PM +0800, John Garry wrote:
>>>>> Metric reuse support is added for pmu-events parse metric testcase.
>>>>> This had been broken on power9 recentlty:
>>>>> https://lore.kernel.org/lkml/20210324015418.GC8931@li-24c3614c-2adc-11b2-a85c-85f334518bdb.ibm.com/
>>>>
>>>> Much better.  Before:
>>>> --
>>>> $ perf test -v 10 2>&1 | grep -i error | wc -l
>>>> 112
>>>> --
>>>> After:
>>>> --
>>>> $ perf test -v 10 2>&1 | grep -i error | wc -l
>>>> 17
>>>> --
>>>>
>>>> And these seem like different types of issues:
>>>> --
>>>> $ perf test -v 10 2>&1 | grep -i error
>>>> Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
>>>> Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
>>>> Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
>>>> Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
>>>> Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
>>>> Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
>>>> Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
>>>> Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
>>>> Error string 'Cannot find PMU `nest_powerbus0_imc'. Missing kernel support?' help '(null)'
>>>> Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
>>>> Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
>>>> Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
>>>> Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
>>>> Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
>>>> Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
>>>> Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
>>>> Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
>>>> --
>>>>
>>>
>>> This looks suspicious.
>>>
>>> Firstly, does /sys/bus/event_source/devices/nest_mcs01_imc (or others,
>>> above) exist on your system? I guess not.
>>>
>>> Secondly, checking Documentation/powerpc/imc.rst, we have examples of:
>>> nest_mcs01/PM_MCS01_64B_R...
>>>
>>> So is the PMU name correct in the metric file for nest_mcs01_imc? Looking at
>>> the kernel driver file, arch/powerpc/perf/imc-pmu.c, it seems to be correct.
>>> Not sure.
>>
>> I ran with a newer kernel, and the above errors disappeared, replaced with
>> about 10 of:
>> --
>> Error string 'Cannot find PMU `hv_24x7'. Missing kernel support?' help '(null)'
>> --
>>
>> ...but I was running without a hypervisor, so I tried the same kernel on a
>> PowerVM-virtualized system and the "hv_24x7" messages went away, but the
>> "nest" messages returned.  This may all be expected behavior... I confess
>> I haven't followed these new perf capabilities closely.
>>
> 
> Hi Paul/John,
>     This is something expected. For nest-imc we need bare-metal system and for
> hv-24x7 we need VM environment. Since you are checking this test in VM machine,
> there nest events are not supported and hence we are getting this error.
> 
> Thanks,
> Kajol Jain

Cool, so I hope that tested-by or similar can be provided :) [obviously 
pending any changes that come from reviews]

Thanks

> 
>> It's extremely likely that none of these errors has anything to do with your
>> changes. :-
>>
>> PC
>>
> .
>
Paul A. Clarke April 6, 2021, 12:18 p.m. UTC | #7
On Tue, Apr 06, 2021 at 12:02:36PM +0100, John Garry wrote:
> On 30/03/2021 07:41, kajoljain wrote:
> > On 3/30/21 2:37 AM, Paul A. Clarke wrote:
> > > On Fri, Mar 26, 2021 at 10:57:40AM +0000, John Garry wrote:
> > > > On 25/03/2021 20:39, Paul A. Clarke wrote:
> > > > > On Thu, Mar 25, 2021 at 06:33:12PM +0800, John Garry wrote:
> > > > > > Metric reuse support is added for pmu-events parse metric testcase.
> > > > > > This had been broken on power9 recentlty:
> > > > > > https://lore.kernel.org/lkml/20210324015418.GC8931@li-24c3614c-2adc-11b2-a85c-85f334518bdb.ibm.com/
> > > > > 
> > > > > Much better.  Before:
> > > > > --
> > > > > $ perf test -v 10 2>&1 | grep -i error | wc -l
> > > > > 112
> > > > > --
> > > > > After:
> > > > > --
> > > > > $ perf test -v 10 2>&1 | grep -i error | wc -l
> > > > > 17
> > > > > --
> > > > > 
> > > > > And these seem like different types of issues:
> > > > > --
> > > > > $ perf test -v 10 2>&1 | grep -i error
> > > > > Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
> > > > > Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
> > > > > Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
> > > > > Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
> > > > > Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
> > > > > Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
> > > > > Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
> > > > > Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
> > > > > Error string 'Cannot find PMU `nest_powerbus0_imc'. Missing kernel support?' help '(null)'
> > > > > Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
> > > > > Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
> > > > > Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
> > > > > Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
> > > > > Error string 'Cannot find PMU `nest_mcs01_imc'. Missing kernel support?' help '(null)'
> > > > > Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
> > > > > Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
> > > > > Error string 'Cannot find PMU `nest_mcs23_imc'. Missing kernel support?' help '(null)'
> > > > > --
> > > > > 
> > > > 
> > > > This looks suspicious.
> > > > 
> > > > Firstly, does /sys/bus/event_source/devices/nest_mcs01_imc (or others,
> > > > above) exist on your system? I guess not.
> > > > 
> > > > Secondly, checking Documentation/powerpc/imc.rst, we have examples of:
> > > > nest_mcs01/PM_MCS01_64B_R...
> > > > 
> > > > So is the PMU name correct in the metric file for nest_mcs01_imc? Looking at
> > > > the kernel driver file, arch/powerpc/perf/imc-pmu.c, it seems to be correct.
> > > > Not sure.
> > > 
> > > I ran with a newer kernel, and the above errors disappeared, replaced with
> > > about 10 of:
> > > --
> > > Error string 'Cannot find PMU `hv_24x7'. Missing kernel support?' help '(null)'
> > > --
> > > 
> > > ...but I was running without a hypervisor, so I tried the same kernel on a
> > > PowerVM-virtualized system and the "hv_24x7" messages went away, but the
> > > "nest" messages returned.  This may all be expected behavior... I confess
> > > I haven't followed these new perf capabilities closely.
> > > 
> > 
> > Hi Paul/John,
> >     This is something expected. For nest-imc we need bare-metal system and for
> > hv-24x7 we need VM environment. Since you are checking this test in VM machine,
> > there nest events are not supported and hence we are getting this error.
> > 
> > Thanks,
> > Kajol Jain
> 
> Cool, so I hope that tested-by or similar can be provided :) [obviously
> pending any changes that come from reviews]

Certainly!

Tested-by: Paul A. Clarke <pc@us.ibm.com>

PC
kajoljain April 7, 2021, 6:03 a.m. UTC | #8
On 3/25/21 4:03 PM, John Garry wrote:
> This series contains support to get basic metricgroups working for
> arm64 CPUs.
> 
> Initial support is added for HiSilicon hip08 platform.
> 
> Some sample usage on Huawei D06 board:
> 
>  $ ./perf list metric    
> 
> List of pre-defined events (to be used in -e): 
> 
> Metrics:     
> 
>   bp_misp_flush
>        [BP misp flush L3 topdown metric]
>   branch_mispredicts
>        [Branch mispredicts L2 topdown metric]
>   core_bound
>        [Core bound L2 topdown metric]
>   divider
>        [Divider L3 topdown metric]
>   exe_ports_util
>        [EXE ports util L3 topdown metric]
>   fetch_bandwidth_bound
>        [Fetch bandwidth bound L2 topdown metric]
>   fetch_latency_bound
>        [Fetch latency bound L2 topdown metric]
>   fsu_stall
>        [FSU stall L3 topdown metric]
>   idle_by_icache_miss
> 
> $ sudo ./perf stat -v -M core_bound sleep 1
> Using CPUID 0x00000000480fd010
> metric expr (exe_stall_cycle - (mem_stall_anyload + armv8_pmuv3_0@event\=0x7005@)) / cpu_cycles for core_bound
> found event cpu_cycles
> found event armv8_pmuv3_0/event=0x7005/
> found event exe_stall_cycle
> found event mem_stall_anyload
> adding {cpu_cycles -> armv8_pmuv3_0/event=0x7001/
> mem_stall_anyload -> armv8_pmuv3_0/event=0x7004/
> Control descriptor is not initialized
> cpu_cycles: 989433 385050 385050
> armv8_pmuv3_0/event=0x7005/: 19207 385050 385050
> exe_stall_cycle: 900825 385050 385050
> mem_stall_anyload: 253516 385050 385050
> 
> Performance counter stats for 'sleep':
> 
> 989,433      cpu_cycles      #     0.63 core_bound
>   19,207      armv8_pmuv3_0/event=0x7005/
>  900,825      exe_stall_cycle
>  253,516      mem_stall_anyload
> 
>        0.000805809 seconds time elapsed
> 
>        0.000875000 seconds user
>        0.000000000 seconds sys
>        
> perf stat --topdown is not supported, as this requires the CPU PMU to
> expose (alias) events for the TopDown L1 metrics from sysfs, which arm 
> does not do. To get that to work, we probably need to make perf use the
> pmu-events cpumap to learn about those alias events.
> 
> Metric reuse support is added for pmu-events parse metric testcase.
> This had been broken on power9 recentlty:
> https://lore.kernel.org/lkml/20210324015418.GC8931@li-24c3614c-2adc-11b2-a85c-85f334518bdb.ibm.com/ 

Patch set looks good to me.

Reviewed-By: Kajol Jain<kjain@linux.ibm.com>

Thanks,
Kajol jain

> 
> Differences to v1:
> - Add pmu_events_map__find() as arm64-specific function
> - Fix metric reuse for pmu-events parse metric testcase 
> 
> John Garry (6):
>   perf metricgroup: Make find_metric() public with name change
>   perf test: Handle metric reuse in pmu-events parsing test
>   perf pmu: Add pmu_events_map__find()
>   perf vendor events arm64: Add Hisi hip08 L1 metrics
>   perf vendor events arm64: Add Hisi hip08 L2 metrics
>   perf vendor events arm64: Add Hisi hip08 L3 metrics
> 
>  tools/perf/arch/arm64/util/Build              |   1 +
>  tools/perf/arch/arm64/util/pmu.c              |  25 ++
>  .../arch/arm64/hisilicon/hip08/metrics.json   | 233 ++++++++++++++++++
>  tools/perf/tests/pmu-events.c                 |  82 +++++-
>  tools/perf/util/metricgroup.c                 |  12 +-
>  tools/perf/util/metricgroup.h                 |   3 +-
>  tools/perf/util/pmu.c                         |   5 +
>  tools/perf/util/pmu.h                         |   1 +
>  tools/perf/util/s390-sample-raw.c             |   4 +-
>  9 files changed, 355 insertions(+), 11 deletions(-)
>  create mode 100644 tools/perf/arch/arm64/util/pmu.c
>  create mode 100644 tools/perf/pmu-events/arch/arm64/hisilicon/hip08/metrics.json
>