linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v6 00/10] perf pmu-events: Support event aliasing for system PMUs
@ 2020-12-04 11:10 John Garry
  2020-12-04 11:10 ` [PATCH v6 01/10] perf jevents: Add support for an extra directory level John Garry
                   ` (9 more replies)
  0 siblings, 10 replies; 15+ messages in thread
From: John Garry @ 2020-12-04 11:10 UTC (permalink / raw)
  To: acme, peterz, mingo, mark.rutland, alexander.shishkin, jolsa,
	namhyung, will, mathieu.poirier, leo.yan, irogers
  Cc: ak, linux-kernel, kjain, John Garry, linuxarm, qiangqing.zhang,
	zhangshaokun, kim.phillips, linux-arm-kernel, kan.liang

Currently event aliasing and metrics is supported for only CPU and uncore
PMUs. More specifically, only uncore PMUs aliasing is supported for when
the uncore PMUs are fixed for a CPU, which may not always be the case for
certain architectures.

This series adds support for PMU event aliasing and metrics for system and
other uncore PMUs which are not tied to a specific CPU.

For this, we introduce system event tables in generated pmu-events.c,
which contain a per-SoC table of events of all its system PMUs. Each
per-PMU event is matched by a "COMPAT" property.

When creating aliases and metrics for PMUs, we treat core/uncore and
system PMUs differently:

- For CPU PMUs, we always match for the event mapfile based on the CPUID.
  This has not changed.

- For an system PMUs, we iterate through all the events in all the system
  PMU tables.

  Matches are based on the "COMPAT" property matching the PMU sysfs
  identifier contents, in /sys/bus/event_source/devices/<PMU>/identifier

  Uncore PMUs, may be matched via CPUID or same as system PMU, depending
  on whether the uncore PMU is tied to a specific CPUID.

Initial reference support is also added for for imx8mm DDR PMU, and it
looks like this for the user:

$ ./perf list metric

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

No_group:
  imx8mm_ddr_read.all
       [bytes all masters read from ddr based on read-cycles event. Unit: imx8_ddr ]
  imx8mm_ddr_write.all                                                            
       [bytes all masters write to ddr based on write-cycles event. Unit: imx8_ddr ]

$ sudo ./perf stat -v -M imx8mm_ddr_read.all sleep 1
metric expr imx8mm_ddr.read_cycles * 4 * 4 for imx8mm_ddr_read.all
found event imx8mm_ddr.read_cycles
adding {imx8mm_ddr.read_cycles}:W
imx8mm_ddr.read_cycles -> imx8_ddr0/event=0x2a/
imx8mm_ddr.read_cycles -> imx8_ddr1/event=0x2a/
Control descriptor is not initialized
imx8mm_ddr.read_cycles: 2 1001455480 1001455480
imx8mm_ddr.read_cycles: 3 1001454940 1001454940

Performance counter stats for 'system wide':

	5	imx8mm_ddr.read_cycles	# 0.1 KB  imx8mm_ddr_read.all

		1.001493170 seconds time elapsed

I have not included HiSilicon hip09 events from earlier RFC since it is a
new platform and not all event codes are available yet, so they can come
later.

Series is here:
https://github.com/hisilicon/kernel-dev/tree/private-topic-perf-5.10-sys-pmu-events-v6

Kernel part accepted / pending in the following:
- https://lore.kernel.org/linux-arm-kernel/160631703729.2332128.13220150013299384201.b4-ty@kernel.org/
- https://lore.kernel.org/linux-devicetree/9468d155-f285-0d03-181b-fe378042f858@huawei.com/

Differences to v5:
- Add tags from Kajol Jain (thanks)
- For now, don't include HiSilicon hip09 events until all event codes
  available
- Rebase

Differences to v4:
- Drop hack for fixing metrics containing aliases which match multiple
  PMUs, and add a proper fix attempt
- Rebase to acme perf/core from 30 Oct
- Fix up imx8 event names according to request from Joakim

Joakim Zhang (1):
  perf vendor events: Add JSON metrics for imx8mm DDR Perf

John Garry (9):
  perf jevents: Add support for an extra directory level
  perf jevents: Add support for system events tables
  perf pmu: Add pmu_id()
  perf pmu: Add pmu_add_sys_aliases()
  perf evlist: Change perf_evlist__splice_list_tail() ordering
  perf metricgroup: Fix metrics using aliases covering multiple PMUs
  perf metricgroup: Split up metricgroup__print()
  perf metricgroup: Support printing metric groups for system PMUs
  perf metricgroup: Support adding metrics for system PMUs

 .../arch/arm64/freescale/imx8mm/sys/ddrc.json |  39 +++
 .../arm64/freescale/imx8mm/sys/metrics.json   |  18 ++
 tools/perf/pmu-events/jevents.c               |  87 +++++-
 tools/perf/pmu-events/pmu-events.h            |   6 +
 tools/perf/util/evlist.c                      |  19 +-
 tools/perf/util/metricgroup.c                 | 254 +++++++++++++-----
 tools/perf/util/pmu.c                         |  96 +++++++
 tools/perf/util/pmu.h                         |   3 +
 8 files changed, 451 insertions(+), 71 deletions(-)
 create mode 100644 tools/perf/pmu-events/arch/arm64/freescale/imx8mm/sys/ddrc.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/freescale/imx8mm/sys/metrics.json

-- 
2.26.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2020-12-07 18:06 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-04 11:10 [PATCH v6 00/10] perf pmu-events: Support event aliasing for system PMUs John Garry
2020-12-04 11:10 ` [PATCH v6 01/10] perf jevents: Add support for an extra directory level John Garry
2020-12-04 11:10 ` [PATCH v6 02/10] perf jevents: Add support for system events tables John Garry
2020-12-04 11:10 ` [PATCH v6 03/10] perf pmu: Add pmu_id() John Garry
2020-12-04 11:10 ` [PATCH v6 04/10] perf pmu: Add pmu_add_sys_aliases() John Garry
2020-12-04 11:10 ` [PATCH v6 05/10] perf evlist: Change perf_evlist__splice_list_tail() ordering John Garry
2020-12-04 11:10 ` [PATCH v6 06/10] perf metricgroup: Fix metrics using aliases covering multiple PMUs John Garry
2020-12-07 17:19   ` Arnaldo Carvalho de Melo
2020-12-07 18:02     ` John Garry
2020-12-04 11:10 ` [PATCH v6 07/10] perf metricgroup: Split up metricgroup__print() John Garry
2020-12-04 11:10 ` [PATCH v6 08/10] perf metricgroup: Support printing metric groups for system PMUs John Garry
2020-12-07 17:23   ` Arnaldo Carvalho de Melo
2020-12-07 18:04     ` John Garry
2020-12-04 11:10 ` [PATCH v6 09/10] perf metricgroup: Support adding metrics " John Garry
2020-12-04 11:10 ` [PATCH v6 10/10] perf vendor events: Add JSON metrics for imx8mm DDR Perf John Garry

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