linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Garry <john.garry@huawei.com>
To: <will@kernel.org>, <mathieu.poirier@linaro.org>,
	<leo.yan@linaro.org>, <peterz@infradead.org>, <mingo@redhat.com>,
	<acme@kernel.org>, <mark.rutland@arm.com>,
	<alexander.shishkin@linux.intel.com>, <jolsa@redhat.com>,
	<namhyung@kernel.org>
Cc: <irogers@google.com>, <linux-arm-kernel@lists.infradead.org>,
	<linux-perf-users@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <linuxarm@huawei.com>,
	<zhangshaokun@hisilicon.com>, <liuqi115@huawei.com>,
	John Garry <john.garry@huawei.com>
Subject: [PATCH 0/5] Improve perf list support for hisi uncore PMUs
Date: Thu, 16 Sep 2021 20:34:20 +0800	[thread overview]
Message-ID: <1631795665-240946-1-git-send-email-john.garry@huawei.com> (raw)

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


             reply	other threads:[~2021-09-16 12:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-16 12:34 John Garry [this message]
2021-09-16 12:34 ` [PATCH 1/5] perf parse-events: Set numeric term config John Garry
2021-09-28 17:59   ` Ian Rogers
2021-09-28 19:16     ` Arnaldo Carvalho de Melo
2021-09-16 12:34 ` [PATCH 2/5] perf jevents: Support ConfigCode John Garry
2021-09-28 18:00   ` Ian Rogers
2021-09-16 12:34 ` [PATCH 3/5] perf test: Verify more event members in pmu-events test John Garry
2021-09-28 18:02   ` Ian Rogers
2021-09-16 12:34 ` [PATCH 4/5] perf test: Add pmu-event test for event described as "config=" John Garry
2021-09-28 18:03   ` Ian Rogers
2021-09-16 12:34 ` [PATCH 5/5] perf vendor events arm64: Revise hip08 uncore events John Garry
2021-09-28 18:04   ` Ian Rogers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1631795665-240946-1-git-send-email-john.garry@huawei.com \
    --to=john.garry@huawei.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=jolsa@redhat.com \
    --cc=leo.yan@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=liuqi115@huawei.com \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.poirier@linaro.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=will@kernel.org \
    --cc=zhangshaokun@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).