[PATCH 0/5] Improve perf list support for hisi uncore PMUs
John Garry
john.garry at huawei.com
Thu Sep 16 05:34:20 PDT 2021
Currently event aliases are supported for HiSilicon uncore PMUs, such that
we get events listed like the following:
$perf list
...
uncore ddrc:
uncore_hisi_ddrc.act_cmd
[DDRC active commands. Unit: hisi_sccl,ddrc]
uncore_hisi_ddrc.flux_rcmd
[DDRC read commands. Unit: hisi_sccl,ddrc]
uncore_hisi_ddrc.flux_rd
[DDRC total read operations. Unit: hisi_sccl,ddrc]
uncore_hisi_ddrc.flux_wcmd
...
However we still get the events listed from the PMUs event files, like:
$perf list
...
hisi_sccl1_ddrc0/act_cmd/ [Kernel PMU event]
hisi_sccl1_ddrc0/flux_rcmd/ [Kernel PMU event]
hisi_sccl1_ddrc0/flux_rd/ [Kernel PMU event]
hisi_sccl1_ddrc0/flux_wcmd/ [Kernel PMU event]
hisi_sccl1_ddrc0/flux_wr/ [Kernel PMU event]
hisi_sccl1_ddrc0/pre_cmd/ [Kernel PMU event]
hisi_sccl1_ddrc0/rnk_chg/ [Kernel PMU event]
hisi_sccl1_ddrc0/rw_chg/ [Kernel PMU event]
hisi_sccl1_ddrc1/act_cmd/ [Kernel PMU event]
...
The list of events will include every event for every PMU in the sysfs event
folder, so the list can be huge:
$perf list | grep hisi_scc | wc -l
783
And it will get larger for the next gen of HiSi SoCs, which has more PMUs.
Fortunately the perf PMU code can merge events when an alias with the
same name exists. So renaming the events in the JSONs to remove the
"uncore_hisi_XXX." prefix from the name to fully match the sysfs
name will mean events are merged. The list will then not show the
individual events per PMU, and rather just the aliases:
$perf list
...
uncore ddrc:
act_cmd
[DDRC active commands. Unit: hisi_sccl,ddrc]
flux_rcmd
[DDRC read commands. Unit: hisi_sccl,ddrc]
flux_rd
[DDRC total read operations. Unit: hisi_sccl,ddrc]
flux_wcmd
[DDRC write commands. Unit: hisi_sccl,ddrc]
...
To get the stat for the event, just run something like this:
$perf stat -v -e act_cmd sleep 1
Using CPUID 0x00000000480fd010
act_cmd -> hisi_sccl1_ddrc0/config=0x5/
act_cmd -> hisi_sccl3_ddrc1/config=0x5/
act_cmd -> hisi_sccl5_ddrc2/config=0x5/
act_cmd -> hisi_sccl7_ddrc3/config=0x5/
act_cmd -> hisi_sccl5_ddrc0/config=0x5/
Control descriptor is not initialized
act_cmd: 0 1001546260 1001546260
act_cmd: 0 1001542780 1001542780
act_cmd: 0 1001531630 1001531630
act_cmd: 0 1001518570 1001518570
act_cmd: 0 1001527830 1001527830
Performance counter stats for 'system wide':
48,142 act_cmd
1.001518294 seconds time elapsed
And to run for an individual PMU, run something like this:
$perf stat -v -e hisi_sccl1_ddrc0/act_cmd/ sleep 1
hisi_sccl1_ddrc0/act_cmd/: 0 1000818310 1000818310
Performance counter stats for 'system wide':
0 hisi_sccl1_ddrc0/act_cmd/
1.000827061 seconds time elapsed
I expect that having the same event name for different types of PMUs
may give unexpected results, so best to use -v option to verify the
PMUs used are as expected.
John Garry (5):
perf parse-events: Set numeric term config
perf jevents: Support ConfigCode
perf test: Verify more event members in pmu-events test
perf test: Add pmu-event test for event described as "config="
perf vendor events arm64: Revise hip08 uncore events
.../arm64/hisilicon/hip08/uncore-ddrc.json | 32 ++---
.../arm64/hisilicon/hip08/uncore-hha.json | 120 +++++++++++++++---
.../arm64/hisilicon/hip08/uncore-l3c.json | 52 ++++----
.../arch/test/test_soc/sys/uncore.json | 7 +
tools/perf/pmu-events/jevents.c | 13 +-
tools/perf/tests/parse-events.c | 8 +-
tools/perf/tests/pmu-events.c | 81 ++++++++++--
tools/perf/util/parse-events.c | 2 +-
8 files changed, 234 insertions(+), 81 deletions(-)
--
2.26.2
More information about the linux-arm-kernel
mailing list