[PATCH 0/6][v4]: perf: Make POWER7 events available in sysfs
Make the generic and some POWER7-specific perf events available in sysfs.
These changes mainly extend similar functionality implemented in x86 to
work on POWER architecture as well.
Thanks to input from Stephane Eranian, Robert Richter, Peter Ziljstra
and Jiri Olsa.
Changelog[v4]:
[Jiri Olsa]: Document that multiple event= like terms can be specified
in the 'events' file.
[Jiri Olsa]: Remove the documentation for the 'config format' file
as it is already documented in 'Documentation/ABI/testing/'
[Jiri Olsa]: Move the ABI documentaion from 'stable/' to 'testing/'.
Changelog[v3]:
[Jiri Olsa]: No need to define EVENT_ID, PMU_EVENT_PTR() if used only
once
[Greg KH]: Document the new sysfs interfaces in Documenation/ABI
Changelog[v2]:
[Jiri Olsa] Use PMU_FORMAT_ATTR() rather than duplicating code.
Sukadev Bhattiprolu (6):
perf/Power7: Use macros to identify perf events
perf: Make EVENT_ATTR global
perf/POWER7: Make generic event translations available in sysfs
perf/POWER7: Make some POWER7 events available in sysfs
perf: Create a sysfs entry for Power event format
perf: Document the ABI of perf sysfs entries
.../testing/sysfs-bus-event_source-devices-events | 62 +++++++++++++++
arch/powerpc/include/asm/perf_event_server.h | 32 ++++++++
arch/powerpc/perf/core-book3s.c | 24 ++++++
arch/powerpc/perf/power7-pmu.c | 81 ++++++++++++++++++--
arch/x86/kernel/cpu/perf_event.c | 13 +---
include/linux/perf_event.h | 11 +++
6 files changed, 205 insertions(+), 18 deletions(-)
create mode 100644 Documentation/ABI/testing/sysfs-bus-event_source-devices-events
[PATCH 1/6][v4]: perf/Power7: Use macros to identify perf events
Define and use macros to identify perf events codes This would make it
easier and more readable when these event codes need to be used in more
than one place.
Signed-off-by: Sukadev Bhattiprolu <redacted>
Acked-by: Jiri Olsa <redacted>
---
arch/powerpc/perf/power7-pmu.c | 28 ++++++++++++++++++++--------
1 files changed, 20 insertions(+), 8 deletions(-)
[PATCH 2/6][v4]: perf: Make EVENT_ATTR global
Rename EVENT_ATTR() to PMU_EVENT_ATTR() and make it global so it is
available to all architectures.
Further to allow architectures flexibility, have PMU_EVENT_ATTR() pass
in the variable name as a parameter.
Changelog[v2]
- [Jiri Osla] No need to define PMU_EVENT_PTR()
Signed-off-by: Sukadev Bhattiprolu <redacted>
Acked-by: Jiri Olsa <redacted>
---
arch/x86/kernel/cpu/perf_event.c | 13 +++----------
include/linux/perf_event.h | 11 +++++++++++
2 files changed, 14 insertions(+), 10 deletions(-)
[PATCH 3/6][v4]: perf/POWER7: Make generic event translations available in sysfs
Make the generic perf events in POWER7 available via sysfs.
$ ls /sys/bus/event_source/devices/cpu/events
branch-instructions
branch-misses
cache-misses
cache-references
cpu-cycles
instructions
stalled-cycles-backend
stalled-cycles-frontend
$ cat /sys/bus/event_source/devices/cpu/events/cache-misses
event=0x400f0
This patch is based on commits that implement this functionality on x86.
Eg:
commit a47473939db20e3961b200eb00acf5fcf084d755
Author: Jiri Olsa [off-list ref]
Date: Wed Oct 10 14:53:11 2012 +0200
perf/x86: Make hardware event translations available in sysfs
Changelog:[v2]
[Jiri Osla] Drop EVENT_ID() macro since it is only used once.
Signed-off-by: Sukadev Bhattiprolu <redacted>
---
arch/powerpc/include/asm/perf_event_server.h | 24 ++++++++++++++
arch/powerpc/perf/core-book3s.c | 12 +++++++
arch/powerpc/perf/power7-pmu.c | 34 +++++++++++++++++++++
3 files changed, 70 insertions(+), 0 deletions(-)
create mode 100644 Documentation/ABI/stable/sysfs-devices-cpu-events
[PATCH 4/6][v4]: perf/POWER7: Make some POWER7 events available in sysfs
Make some POWER7-specific perf events available in sysfs.
$ /bin/ls -1 /sys/bus/event_source/devices/cpu/events/
branch-instructions
branch-misses
cache-misses
cache-references
cpu-cycles
instructions
PM_BRU_FIN
PM_BRU_MPRED
PM_CMPLU_STALL
PM_CYC
PM_GCT_NOSLOT_CYC
PM_INST_CMPL
PM_LD_MISS_L1
PM_LD_REF_L1
stalled-cycles-backend
stalled-cycles-frontend
where the 'PM_*' events are POWER specific and the others are the
generic events.
This will enable users to specify these events with their symbolic
names rather than with their raw code.
perf stat -e 'cpu/PM_CYC' ...
Signed-off-by: Sukadev Bhattiprolu <redacted>
---
arch/powerpc/include/asm/perf_event_server.h | 2 ++
arch/powerpc/perf/power7-pmu.c | 18 ++++++++++++++++++
2 files changed, 20 insertions(+), 0 deletions(-)
[PATCH 5/6][v4]: perf: Create a sysfs entry for Power event format
Create a sysfs entry, '/sys/bus/event_source/devices/cpu/format/event'
which describes the format of a POWER cpu.
The format of the event is the same for all POWER cpus at least in
(Power6, Power7), so bulk of this change is common in the code common
to POWER cpus.
This code is based on corresponding code in x86.
Changelog[v2]: [Jiri Osla] Use PMU_FORMAT_ATTR() rather than duplicating it.
Signed-off-by: Sukadev Bhattiprolu <redacted>
---
arch/powerpc/include/asm/perf_event_server.h | 6 ++++++
arch/powerpc/perf/core-book3s.c | 12 ++++++++++++
arch/powerpc/perf/power7-pmu.c | 1 +
3 files changed, 19 insertions(+), 0 deletions(-)
[PATCH 6/6][v4]: perf: Document the ABI of perf sysfs entries
This patchset addes two new sets of files to sysfs for POWER architecture.
- perf event config format in /sys/devices/cpu/format/event
- generic and POWER-specific perf events in /sys/devices/cpu/events/
The format of the first file is already documented in:
sysfs-bus-event_source-devices-format
Document the format of the second set of files '/sys/devices/cpu/events/*'
which would also become part of the ABI.
Changelog[v4]:
[Jiri Olsa]: Mention that multiple event= like terms can be specified
in the 'events' file.
[Jiri Olsa]: Remove the documentation for the 'config format' file
as it is already documented in 'Documentation/ABI/testing/'.
[Jiri Olsa]: Move ABI documentation from 'stable/' to 'testing/'
Changelog[v3]:
[Greg KH] Include ABI documentation.
Signed-off-by: Sukadev Bhattiprolu <redacted>
Acked-by: Jiri Olsa <redacted>
---
.../testing/sysfs-bus-event_source-devices-events | 62 ++++++++++++++++++++
1 files changed, 62 insertions(+), 0 deletions(-)
delete mode 100644 Documentation/ABI/stable/sysfs-devices-cpu-events
create mode 100644 Documentation/ABI/testing/sysfs-bus-event_source-devices-events
@@ -0,0 +1,62 @@+What: /sys/devices/cpu/events/+ /sys/devices/cpu/events/branch-misses+ /sys/devices/cpu/events/cache-references+ /sys/devices/cpu/events/cache-misses+ /sys/devices/cpu/events/stalled-cycles-frontend+ /sys/devices/cpu/events/branch-instructions+ /sys/devices/cpu/events/stalled-cycles-backend+ /sys/devices/cpu/events/instructions+ /sys/devices/cpu/events/cpu-cycles++Date: 2013/01/08++Contact: Linux kernel mailing list <linux-kernel@vger.kernel.org>++Description: Generic performance monitoring events++ A collection of performance monitoring events that may be+ supported by many/most CPUs. These events can be monitored+ using the 'perf(1)' tool.++ The contents of each file would look like:++ event=0xNNNN++ where 'N' is a hex digit and the number '0xNNNN' shows the+ "raw code" for the perf event identified by the file's+ "basename".+++What: /sys/devices/cpu/events/PM_LD_MISS_L1+ /sys/devices/cpu/events/PM_LD_REF_L1+ /sys/devices/cpu/events/PM_CYC+ /sys/devices/cpu/events/PM_BRU_FIN+ /sys/devices/cpu/events/PM_GCT_NOSLOT_CYC+ /sys/devices/cpu/events/PM_BRU_MPRED+ /sys/devices/cpu/events/PM_INST_CMPL+ /sys/devices/cpu/events/PM_CMPLU_STALL++Date: 2013/01/08++Contact: Linux kernel mailing list <linux-kernel@vger.kernel.org>+ Linux Powerpc mailing list <linuxppc-dev@ozlabs.org>++Description: POWER-systems specific performance monitoring events++ A collection of performance monitoring events that may be+ supported by the POWER CPU. These events can be monitored+ using the 'perf(1)' tool.++ These events may not be supported by other CPUs.++ The contents of each file would look like:++ event=0xNNNN++ where 'N' is a hex digit and the number '0xNNNN' shows the+ "raw code" for the perf event identified by the file's+ "basename".++ Further, multiple terms like 'event=0xNNNN' can be specified+ and separated with comma. All available terms are defined in+ the /sys/bus/event_source/devices/<dev>/format file.
From: Michael Ellerman <hidden> Date: 2013-02-26 05:26:53
On Tue, Jan 22, 2013 at 10:26:13PM -0800, Sukadev Bhattiprolu wrote:
[PATCH 5/6][v4]: perf: Create a sysfs entry for Power event format
Create a sysfs entry, '/sys/bus/event_source/devices/cpu/format/event'
which describes the format of a POWER cpu.
Did this patch go upstream? I don't see it.
If not, please don't merge it.
The format of the event is the same for all POWER cpus at least in
(Power6, Power7), so bulk of this change is common in the code common
to POWER cpus.
No. The event format is different on most POWER cpus, in particular it
is different on Power6 and Power7, and will be different again on
Power8.
cheers
Michael Ellerman [michael@ellerman.id.au] wrote:
| On Tue, Jan 22, 2013 at 10:26:13PM -0800, Sukadev Bhattiprolu wrote:
| >
| > [PATCH 5/6][v4]: perf: Create a sysfs entry for Power event format
| >
| > Create a sysfs entry, '/sys/bus/event_source/devices/cpu/format/event'
| > which describes the format of a POWER cpu.
|
| Did this patch go upstream? I don't see it.
Hmm, patches 1..4,6 are in linux-tip and Arnaldo's trees but patch 5 is
in neither.
|
| If not, please don't merge it.
|
| > The format of the event is the same for all POWER cpus at least in
| > (Power6, Power7), so bulk of this change is common in the code common
| > to POWER cpus.
|
| No. The event format is different on most POWER cpus, in particular it
| is different on Power6 and Power7, and will be different again on
| Power8.
Sigh. The port of this patchset to Power6 has not started yet.
But this patchset does work on Power7 correct ?
If so, and we figure out what happened to patch 5, can we add a patch to
to move the format code to power7-pmu.c ?
Sukadev
From: Michael Ellerman <hidden> Date: 2013-02-27 01:17:31
On Tue, Feb 26, 2013 at 12:03:43PM -0800, Sukadev Bhattiprolu wrote:
Michael Ellerman [michael@ellerman.id.au] wrote:
| On Tue, Jan 22, 2013 at 10:26:13PM -0800, Sukadev Bhattiprolu wrote:
| >
| > [PATCH 5/6][v4]: perf: Create a sysfs entry for Power event format
| >
| > Create a sysfs entry, '/sys/bus/event_source/devices/cpu/format/event'
| > which describes the format of a POWER cpu.
|
| Did this patch go upstream? I don't see it.
Hmm, patches 1..4,6 are in linux-tip and Arnaldo's trees but patch 5 is
in neither.
I suspect Arnaldo was either waiting for an ACK from Ben, or was
expecting Ben to take it?
| > The format of the event is the same for all POWER cpus at least in
| > (Power6, Power7), so bulk of this change is common in the code common
| > to POWER cpus.
|
| No. The event format is different on most POWER cpus, in particular it
| is different on Power6 and Power7, and will be different again on
| Power8.
Sigh. The port of this patchset to Power6 has not started yet.
It should hardly require a port, it's about five lines. But it doesn't
matter for now.
But this patchset does work on Power7 correct ?
Yes, and without it the rest of the series is essentially useless. So I
guess it's better than nothing and we should get it in, we can fix it up
later to work across different chips.
Ben can you grab it, it's all arch/powerpc.
cheers
From: Michael Ellerman <hidden> Date: 2013-02-27 01:27:45
On Tue, Jan 22, 2013 at 10:26:13PM -0800, Sukadev Bhattiprolu wrote:
[PATCH 5/6][v4]: perf: Create a sysfs entry for Power event format
Create a sysfs entry, '/sys/bus/event_source/devices/cpu/format/event'
which describes the format of a POWER cpu.
Michael Ellerman [michael@ellerman.id.au] wrote:
| I suspect Arnaldo was either waiting for an ACK from Ben, or was
| expecting Ben to take it?
Arnaldo, here is an updated patch. If it is acked by Paul Mackerras,
Michael Ellerman or Ben, will you add it to your tree so the whole
patchset comes from one place ?
Sukadev
---
From 50c7a46f14083c0ed10d66b7aed66ba76e798550 Mon Sep 17 00:00:00 2001
From: Sukadev Bhattiprolu <redacted>
Date: Tue, 5 Mar 2013 21:20:56 -0800
Subject: [PATCH] [PATCH 5/6][v4]: perf Create a sysfs format entry for Power7 events
Create a sysfs entry, '/sys/bus/event_source/devices/cpu/format/event'
which describes the format of the POWER7 PMU events.
This code is based on corresponding code in x86.
Changelog[v4]: [Michael Ellerman, Paul Mckerras] The event format is different
for other POWER cpus. So move the code to POWER7-specific,
power7-pmu.c Also, the POWER7 format uses bits 0-19 not 0-20.
Changelog[v2]: [Jiri Osla] Use PMU_FORMAT_ATTR rather than duplicating code.
Signed-off-by: Sukadev Bhattiprolu <redacted>
---
arch/powerpc/perf/power7-pmu.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
From: Paul Mackerras <hidden> Date: 2013-03-12 09:27:53
On Tue, Mar 05, 2013 at 09:48:26PM -0800, Sukadev Bhattiprolu wrote:
Michael Ellerman [michael@ellerman.id.au] wrote:
| I suspect Arnaldo was either waiting for an ACK from Ben, or was
| expecting Ben to take it?
Arnaldo, here is an updated patch. If it is acked by Paul Mackerras,
Michael Ellerman or Ben, will you add it to your tree so the whole
patchset comes from one place ?
Sukadev
---
quoted
From 50c7a46f14083c0ed10d66b7aed66ba76e798550 Mon Sep 17 00:00:00 2001
From: Sukadev Bhattiprolu <redacted>
Date: Tue, 5 Mar 2013 21:20:56 -0800
Subject: [PATCH] [PATCH 5/6][v4]: perf Create a sysfs format entry for Power7 events
Create a sysfs entry, '/sys/bus/event_source/devices/cpu/format/event'
which describes the format of the POWER7 PMU events.
This code is based on corresponding code in x86.
Changelog[v4]: [Michael Ellerman, Paul Mckerras] The event format is different
for other POWER cpus. So move the code to POWER7-specific,
power7-pmu.c Also, the POWER7 format uses bits 0-19 not 0-20.
Changelog[v2]: [Jiri Osla] Use PMU_FORMAT_ATTR rather than duplicating code.
Signed-off-by: Sukadev Bhattiprolu <redacted>
From: Michael Ellerman <hidden> Date: 2013-03-13 00:15:48
On Tue, Mar 12, 2013 at 08:27:40PM +1100, Paul Mackerras wrote:
On Tue, Mar 05, 2013 at 09:48:26PM -0800, Sukadev Bhattiprolu wrote:
quoted
Michael Ellerman [michael@ellerman.id.au] wrote:
| I suspect Arnaldo was either waiting for an ACK from Ben, or was
| expecting Ben to take it?
Arnaldo, here is an updated patch. If it is acked by Paul Mackerras,
Michael Ellerman or Ben, will you add it to your tree so the whole
patchset comes from one place ?
Sukadev
---
quoted
From 50c7a46f14083c0ed10d66b7aed66ba76e798550 Mon Sep 17 00:00:00 2001
From: Sukadev Bhattiprolu <redacted>
Date: Tue, 5 Mar 2013 21:20:56 -0800
Subject: [PATCH] [PATCH 5/6][v4]: perf Create a sysfs format entry for Power7 events
Create a sysfs entry, '/sys/bus/event_source/devices/cpu/format/event'
which describes the format of the POWER7 PMU events.
This code is based on corresponding code in x86.
Changelog[v4]: [Michael Ellerman, Paul Mckerras] The event format is different
for other POWER cpus. So move the code to POWER7-specific,
power7-pmu.c Also, the POWER7 format uses bits 0-19 not 0-20.
Changelog[v2]: [Jiri Osla] Use PMU_FORMAT_ATTR rather than duplicating code.
Signed-off-by: Sukadev Bhattiprolu <redacted>