Skip to content

Improve perf list support for hisi uncore PMUs

John Garry linux-arm-kernel linux-perf-users lkml 1 version Applied

Status from this message: Thanks, applied the series.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 6 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/5perf parse-events: Set numeric term configtools/perf/tests/parse-events.c tools/perf/tests/pmu-events.c tools/perf/util/parse-events.c+8 -82 replies
2/5perf jevents: Support ConfigCodetools/perf/pmu-events/jevents.c+12 -11 reply
3/5perf test: Verify more event members in pmu-events testtools/perf/tests/pmu-events.c+40 -101 reply
4/5perf test: Add pmu-event test for event described as "config="tools/perf/pmu-events/arch/test/test_soc/sys/uncore.json tools/perf/tests/pmu-events.c+32 -01 reply
5/5perf vendor events arm64: Revise hip08 uncore eventstools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-ddrc.json tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-hha.json tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-l3c.json+142 -621 reply

Reviews trailers per patch

All 5 patches have a Reviewed-by or Acked-by.

PatchIan Rogers
1/5A-b
2/5A-b
3/5A-b
4/5A-b
5/5A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/5] Improve perf list support for hisi uncore PMUs

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(-)
Signature · 1 line
2.26.2