Skip to contentSkip to conversation

perf tools: Power7 events name available for perf

PATCH In review Runzhen Wang 4 participants 11 messages Jun 28, 2013 – Jul 26, 2013 PowerPC

lore
Share & tools
lore
#0 lore raw

v3 cover perf tools: Power7 events name available for perf

Thank for Sukadev Bhattip and Xiao Guangrong's help. Thank for Michael Ellerman's review.

ChangeLog: v2 -> v3:

1. Adding a leading zero to all the events code in "power7-events-list.h" which don't have a PMC, so that they all line up vertically.

ChangeLog: v1 -> v2:

1. As Michael Ellerman suggested, I added runtime overhead information in the 0002 patch's description.

2. Put the events name in a new head file which is named "power7-events-list.h", and use several macros, such as,

   #define EVENT(_name, _code)     POWER_EVENT_ATTR(_name, _code)
   #include "power7-events-list.h"
   #undef EVENT

to generate different outputs.

Thanks
Runzhen Wang

Runzhen Wang (2):
perf tools: fix a typo of a Power7 event name perf tools: Make Power7 events available for perf

 .../testing/sysfs-bus-event_source-devices-events  |    2 +-
 arch/powerpc/include/asm/perf_event_server.h       |    4 +-
 arch/powerpc/perf/power7-events-list.h             |  548 ++++++++++++++++++++
 arch/powerpc/perf/power7-pmu.c                     |  150 ++----
 4 files changed, 584 insertions(+), 120 deletions(-)
 create mode 100644 arch/powerpc/perf/power7-events-list.h
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH v3 2/2 perf tools: Make Power7 events available for perf

Power7 supports over 530 different perf events but only a small subset of these can be specified by name, for the remaining events, we must specify them by their raw code:

perf stat -e r2003c <application>

This patch makes all the POWER7 events available in sysfs. So we can instead specify these as:

perf stat -e 'cpu/PM_CMPLU_STALL_DFU/' <application>

where PM_CMPLU_STALL_DFU is the r2003c in previous example.

Before this patch is applied, the size of power7-pmu.o is:

$ size arch/powerpc/perf/power7-pmu.o
   text	   data	    bss	    dec	    hex	filename
   3073	   2720	      0	   5793	   16a1	arch/powerpc/perf/power7-pmu.o

and after the patch is applied, it is:

$ size arch/powerpc/perf/power7-pmu.o
   text	   data	    bss	    dec	    hex	filename
  15950	  31112	      0	  47062	   b7d6	arch/powerpc/perf/power7-pmu.o

For the run time overhead, I use two scripts, one is "event_name.sh", which contains 50 event names, it looks like:

 # ./perf record  -e 'cpu/PM_CMPLU_STALL_DFU/' -e .....  /bin/sleep 1

the other one is named "event_code.sh" which use corresponding events raw
code instead of events names, it looks like:

 # ./perf record -e r2003c -e ......  /bin/sleep 1

below is the result.

Using events name:

[root@localhost perf]# time ./event_name.sh
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.002 MB perf.data (~102 samples) ]

real 0m1.192s
user 0m0.028s
sys 0m0.106s

Using events raw code:

[root@localhost perf]# time ./event_code.sh
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.003 MB perf.data (~112 samples) ]

real 0m1.198s
user 0m0.028s
sys 0m0.105s

---
 arch/powerpc/include/asm/perf_event_server.h |    4 +-
 arch/powerpc/perf/power7-events-list.h       |  548 ++++++++++++++++++++++++++
 arch/powerpc/perf/power7-pmu.c               |  148 ++-----
 3 files changed, 582 insertions(+), 118 deletions(-)
 create mode 100644 arch/powerpc/perf/power7-events-list.h
arch/powerpc/include/asm/perf_event_server.h +2 -2
index f265049..d9270d8 100644
@@ -136,11 +136,11 @@ extern ssize_t power_events_sysfs_show(struct device *dev,
 #define	EVENT_PTR(_id, _suffix)		&EVENT_VAR(_id, _suffix).attr.attr
 
 #define	EVENT_ATTR(_name, _id, _suffix)					\
-	PMU_EVENT_ATTR(_name, EVENT_VAR(_id, _suffix), PME_PM_##_id,	\
+	PMU_EVENT_ATTR(_name, EVENT_VAR(_id, _suffix), PME_##_id,	\
 			power_events_sysfs_show)
 
 #define	GENERIC_EVENT_ATTR(_name, _id)	EVENT_ATTR(_name, _id, _g)
 #define	GENERIC_EVENT_PTR(_id)		EVENT_PTR(_id, _g)
 
-#define	POWER_EVENT_ATTR(_name, _id)	EVENT_ATTR(PM_##_name, _id, _p)
+#define	POWER_EVENT_ATTR(_name, _id)	EVENT_ATTR(_name, _id, _p)
 #define	POWER_EVENT_PTR(_id)		EVENT_PTR(_id, _p)
arch/powerpc/perf/power7-events-list.h new file +548 -0

548 lines not on this page · raw message

arch/powerpc/perf/power7-pmu.c +32 -116

165 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v3 1/2 perf tools: fix a typo of a Power7 event name

In reply to Runzhen Wang

In the Power7 PMU guide:
https://www.power.org/documentation/commonly-used-metrics-for-performance-analysis/
PM_BRU_MPRED is referred to as PM_BR_MPRED.

It fixed the typo by changing the name of the event in kernel and documentation accordingly.

This patch changes the ABI, there are some reasons I think it's ok:

- It is relatively new interface, specific to the Power7 platform.

- No tools that we know of actually use this interface at this point (none are listed near the interface).

- Users of this interface (eg oprofile users migrating to perf) would be more used to the "PM_BR_MPRED" rather than "PM_BRU_MPRED".

- These are in the ABI/testing at this point rather than ABI/stable, so hoping we have some wiggle room.

---
 .../testing/sysfs-bus-event_source-devices-events  |    2 +-
 arch/powerpc/perf/power7-pmu.c                     |   12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)
Documentation/ABI/testing/sysfs-bus-event_source-devices-events +1 -1
index 8b25ffb..3c1cc24 100644
@@ -29,7 +29,7 @@ Description:	Generic performance monitoring events
 
 What: 		/sys/devices/cpu/events/PM_1PLUS_PPC_CMPL
 		/sys/devices/cpu/events/PM_BRU_FIN
-		/sys/devices/cpu/events/PM_BRU_MPRED
+		/sys/devices/cpu/events/PM_BR_MPRED
 		/sys/devices/cpu/events/PM_CMPLU_STALL
 		/sys/devices/cpu/events/PM_CMPLU_STALL_BRU
 		/sys/devices/cpu/events/PM_CMPLU_STALL_DCACHE_MISS
arch/powerpc/perf/power7-pmu.c +6 -6
index 13c3f0e..d1821b8 100644
@@ -60,7 +60,7 @@
 #define	PME_PM_LD_REF_L1		0xc880
 #define	PME_PM_LD_MISS_L1		0x400f0
 #define	PME_PM_BRU_FIN			0x10068
-#define	PME_PM_BRU_MPRED		0x400f6
+#define	PME_PM_BR_MPRED			0x400f6
 
 #define PME_PM_CMPLU_STALL_FXU			0x20014
 #define PME_PM_CMPLU_STALL_DIV			0x40014
@@ -349,7 +349,7 @@ static int power7_generic_events[] = {
 	[PERF_COUNT_HW_CACHE_REFERENCES] =		PME_PM_LD_REF_L1,
 	[PERF_COUNT_HW_CACHE_MISSES] =			PME_PM_LD_MISS_L1,
 	[PERF_COUNT_HW_BRANCH_INSTRUCTIONS] =		PME_PM_BRU_FIN,
-	[PERF_COUNT_HW_BRANCH_MISSES] =			PME_PM_BRU_MPRED,
+	[PERF_COUNT_HW_BRANCH_MISSES] =			PME_PM_BR_MPRED,
 };
 
 #define C(x)	PERF_COUNT_HW_CACHE_##x
@@ -405,7 +405,7 @@ GENERIC_EVENT_ATTR(instructions,		INST_CMPL);
 GENERIC_EVENT_ATTR(cache-references,		LD_REF_L1);
 GENERIC_EVENT_ATTR(cache-misses,		LD_MISS_L1);
 GENERIC_EVENT_ATTR(branch-instructions,		BRU_FIN);
-GENERIC_EVENT_ATTR(branch-misses,		BRU_MPRED);
+GENERIC_EVENT_ATTR(branch-misses,		BR_MPRED);
 
 POWER_EVENT_ATTR(CYC,				CYC);
 POWER_EVENT_ATTR(GCT_NOSLOT_CYC,		GCT_NOSLOT_CYC);
@@ -414,7 +414,7 @@ POWER_EVENT_ATTR(INST_CMPL,			INST_CMPL);
 POWER_EVENT_ATTR(LD_REF_L1,			LD_REF_L1);
 POWER_EVENT_ATTR(LD_MISS_L1,			LD_MISS_L1);
 POWER_EVENT_ATTR(BRU_FIN,			BRU_FIN)
-POWER_EVENT_ATTR(BRU_MPRED,			BRU_MPRED);
+POWER_EVENT_ATTR(BR_MPRED,			BR_MPRED);
 
 POWER_EVENT_ATTR(CMPLU_STALL_FXU,		CMPLU_STALL_FXU);
 POWER_EVENT_ATTR(CMPLU_STALL_DIV,		CMPLU_STALL_DIV);
@@ -449,7 +449,7 @@ static struct attribute *power7_events_attr[] = {
 	GENERIC_EVENT_PTR(LD_REF_L1),
 	GENERIC_EVENT_PTR(LD_MISS_L1),
 	GENERIC_EVENT_PTR(BRU_FIN),
-	GENERIC_EVENT_PTR(BRU_MPRED),
+	GENERIC_EVENT_PTR(BR_MPRED),
 
 	POWER_EVENT_PTR(CYC),
 	POWER_EVENT_PTR(GCT_NOSLOT_CYC),
@@ -458,7 +458,7 @@ static struct attribute *power7_events_attr[] = {
 	POWER_EVENT_PTR(LD_REF_L1),
 	POWER_EVENT_PTR(LD_MISS_L1),
 	POWER_EVENT_PTR(BRU_FIN),
-	POWER_EVENT_PTR(BRU_MPRED),
+	POWER_EVENT_PTR(BR_MPRED),
 
 	POWER_EVENT_PTR(CMPLU_STALL_FXU),
 	POWER_EVENT_PTR(CMPLU_STALL_DIV),
Signature · 1 line
1.7.9.5
Acked-by on the v3 series
#10 lore raw
In reply to Runzhen Wang
Quoted 7 lines · Runzhen Wang

Thank for Sukadev Bhattip and Xiao Guangrong's help. Thank for Michael Ellerman's review.

ChangeLog: v2 -> v3:

1. Adding a leading zero to all the events code in "power7-events-list.h" which don't have a PMC, so that they all line up vertically.

Hi Runzhen,

These look good to me. Thanks for reworking them.

They seem to be on top of Arnaldo's tree, so it's probably easiest if he takes them.

You can have my:

Arnaldo if you also want Benh's ack let us know and I'll pester him.

cheers

#2 lore raw

[tip:perf/urgent] perf tools: fix a typo of a Power7 event name

In reply to Runzhen Wang
perf tools: fix a typo of a Power7 event name
Commit-ID:  7e40c92019cef784fffbdfc51c6e731e7ee6ba10
Gitweb:     http://git.kernel.org/tip/7e40c92019cef784fffbdfc51c6e731e7ee6ba10
Author:     Runzhen Wang <[email protected]>
AuthorDate: Fri, 28 Jun 2013 16:14:56 +0800
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 8 Jul 2013 17:40:05 -0300

perf tools: fix a typo of a Power7 event name

In the Power7 PMU guide:
https://www.power.org/documentation/commonly-used-metrics-for-performance-analysis/
PM_BRU_MPRED is referred to as PM_BR_MPRED.

It fixed the typo by changing the name of the event in kernel and documentation accordingly.

This patch changes the ABI, there are some reasons I think it's ok:

- It is relatively new interface, specific to the Power7 platform.

- No tools that we know of actually use this interface at this point (none are listed near the interface).

- Users of this interface (eg oprofile users migrating to perf) would be more used to the "PM_BR_MPRED" rather than "PM_BRU_MPRED".

- These are in the ABI/testing at this point rather than ABI/stable, so hoping we have some wiggle room.

---
 .../ABI/testing/sysfs-bus-event_source-devices-events        |  2 +-
 arch/powerpc/perf/power7-pmu.c                               | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)
Documentation/ABI/testing/sysfs-bus-event_source-devices-events +1 -1
index 8b25ffb..3c1cc24 100644
@@ -29,7 +29,7 @@ Description:	Generic performance monitoring events
 
 What: 		/sys/devices/cpu/events/PM_1PLUS_PPC_CMPL
 		/sys/devices/cpu/events/PM_BRU_FIN
-		/sys/devices/cpu/events/PM_BRU_MPRED
+		/sys/devices/cpu/events/PM_BR_MPRED
 		/sys/devices/cpu/events/PM_CMPLU_STALL
 		/sys/devices/cpu/events/PM_CMPLU_STALL_BRU
 		/sys/devices/cpu/events/PM_CMPLU_STALL_DCACHE_MISS
arch/powerpc/perf/power7-pmu.c +6 -6
index 13c3f0e..d1821b8 100644
@@ -60,7 +60,7 @@
 #define	PME_PM_LD_REF_L1		0xc880
 #define	PME_PM_LD_MISS_L1		0x400f0
 #define	PME_PM_BRU_FIN			0x10068
-#define	PME_PM_BRU_MPRED		0x400f6
+#define	PME_PM_BR_MPRED			0x400f6
 
 #define PME_PM_CMPLU_STALL_FXU			0x20014
 #define PME_PM_CMPLU_STALL_DIV			0x40014
@@ -349,7 +349,7 @@ static int power7_generic_events[] = {
 	[PERF_COUNT_HW_CACHE_REFERENCES] =		PME_PM_LD_REF_L1,
 	[PERF_COUNT_HW_CACHE_MISSES] =			PME_PM_LD_MISS_L1,
 	[PERF_COUNT_HW_BRANCH_INSTRUCTIONS] =		PME_PM_BRU_FIN,
-	[PERF_COUNT_HW_BRANCH_MISSES] =			PME_PM_BRU_MPRED,
+	[PERF_COUNT_HW_BRANCH_MISSES] =			PME_PM_BR_MPRED,
 };
 
 #define C(x)	PERF_COUNT_HW_CACHE_##x
@@ -405,7 +405,7 @@ GENERIC_EVENT_ATTR(instructions,		INST_CMPL);
 GENERIC_EVENT_ATTR(cache-references,		LD_REF_L1);
 GENERIC_EVENT_ATTR(cache-misses,		LD_MISS_L1);
 GENERIC_EVENT_ATTR(branch-instructions,		BRU_FIN);
-GENERIC_EVENT_ATTR(branch-misses,		BRU_MPRED);
+GENERIC_EVENT_ATTR(branch-misses,		BR_MPRED);
 
 POWER_EVENT_ATTR(CYC,				CYC);
 POWER_EVENT_ATTR(GCT_NOSLOT_CYC,		GCT_NOSLOT_CYC);
@@ -414,7 +414,7 @@ POWER_EVENT_ATTR(INST_CMPL,			INST_CMPL);
 POWER_EVENT_ATTR(LD_REF_L1,			LD_REF_L1);
 POWER_EVENT_ATTR(LD_MISS_L1,			LD_MISS_L1);
 POWER_EVENT_ATTR(BRU_FIN,			BRU_FIN)
-POWER_EVENT_ATTR(BRU_MPRED,			BRU_MPRED);
+POWER_EVENT_ATTR(BR_MPRED,			BR_MPRED);
 
 POWER_EVENT_ATTR(CMPLU_STALL_FXU,		CMPLU_STALL_FXU);
 POWER_EVENT_ATTR(CMPLU_STALL_DIV,		CMPLU_STALL_DIV);
@@ -449,7 +449,7 @@ static struct attribute *power7_events_attr[] = {
 	GENERIC_EVENT_PTR(LD_REF_L1),
 	GENERIC_EVENT_PTR(LD_MISS_L1),
 	GENERIC_EVENT_PTR(BRU_FIN),
-	GENERIC_EVENT_PTR(BRU_MPRED),
+	GENERIC_EVENT_PTR(BR_MPRED),
 
 	POWER_EVENT_PTR(CYC),
 	POWER_EVENT_PTR(GCT_NOSLOT_CYC),
@@ -458,7 +458,7 @@ static struct attribute *power7_events_attr[] = {
 	POWER_EVENT_PTR(LD_REF_L1),
 	POWER_EVENT_PTR(LD_MISS_L1),
 	POWER_EVENT_PTR(BRU_FIN),
-	POWER_EVENT_PTR(BRU_MPRED),
+	POWER_EVENT_PTR(BR_MPRED),
 
 	POWER_EVENT_PTR(CMPLU_STALL_FXU),
 	POWER_EVENT_PTR(CMPLU_STALL_DIV),
#4 lore raw

[tip:perf/core] perf tools: Make Power7 events available for perf

In reply to Runzhen Wang
perf tools: Make Power7 events available for perf
Commit-ID:  cfe0d8ba14a1d98245b371e486c68f37eba1ca52
Gitweb:     http://git.kernel.org/tip/cfe0d8ba14a1d98245b371e486c68f37eba1ca52
Author:     Runzhen Wang <[email protected]>
AuthorDate: Fri, 28 Jun 2013 16:14:57 +0800
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 12 Jul 2013 13:46:09 -0300

perf tools: Make Power7 events available for perf

Power7 supports over 530 different perf events but only a small subset of these can be specified by name, for the remaining events, we must specify them by their raw code:

perf stat -e r2003c <application>

This patch makes all the POWER7 events available in sysfs. So we can instead specify these as:

perf stat -e 'cpu/PM_CMPLU_STALL_DFU/' <application>

where PM_CMPLU_STALL_DFU is the r2003c in previous example.

Before this patch is applied, the size of power7-pmu.o is:

$ size arch/powerpc/perf/power7-pmu.o
   text	   data	    bss	    dec	    hex	filename
   3073	   2720	      0	   5793	   16a1	arch/powerpc/perf/power7-pmu.o

and after the patch is applied, it is:

$ size arch/powerpc/perf/power7-pmu.o
   text	   data	    bss	    dec	    hex	filename
  15950	  31112	      0	  47062	   b7d6	arch/powerpc/perf/power7-pmu.o

For the run time overhead, I use two scripts, one is "event_name.sh", which contains 50 event names, it looks like:

 # ./perf record  -e 'cpu/PM_CMPLU_STALL_DFU/' -e .....  /bin/sleep 1

the other one is named "event_code.sh" which use corresponding events raw
code instead of events names, it looks like:

 # ./perf record -e r2003c -e ......  /bin/sleep 1

below is the result.

Using events name:

[root@localhost perf]# time ./event_name.sh
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.002 MB perf.data (~102 samples) ]

real 0m1.192s
user 0m0.028s
sys 0m0.106s

Using events raw code:

[root@localhost perf]# time ./event_code.sh
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.003 MB perf.data (~112 samples) ]

real 0m1.198s
user 0m0.028s
sys 0m0.105s

---
 arch/powerpc/include/asm/perf_event_server.h |   4 +-
 arch/powerpc/perf/power7-events-list.h       | 548 +++++++++++++++++++++++++++
 arch/powerpc/perf/power7-pmu.c               | 148 ++------
 3 files changed, 582 insertions(+), 118 deletions(-)
arch/powerpc/include/asm/perf_event_server.h +2 -2
index f265049..d9270d8 100644
@@ -136,11 +136,11 @@ extern ssize_t power_events_sysfs_show(struct device *dev,
 #define	EVENT_PTR(_id, _suffix)		&EVENT_VAR(_id, _suffix).attr.attr
 
 #define	EVENT_ATTR(_name, _id, _suffix)					\
-	PMU_EVENT_ATTR(_name, EVENT_VAR(_id, _suffix), PME_PM_##_id,	\
+	PMU_EVENT_ATTR(_name, EVENT_VAR(_id, _suffix), PME_##_id,	\
 			power_events_sysfs_show)
 
 #define	GENERIC_EVENT_ATTR(_name, _id)	EVENT_ATTR(_name, _id, _g)
 #define	GENERIC_EVENT_PTR(_id)		EVENT_PTR(_id, _g)
 
-#define	POWER_EVENT_ATTR(_name, _id)	EVENT_ATTR(PM_##_name, _id, _p)
+#define	POWER_EVENT_ATTR(_name, _id)	EVENT_ATTR(_name, _id, _p)
 #define	POWER_EVENT_PTR(_id)		EVENT_PTR(_id, _p)
arch/powerpc/perf/power7-events-list.h new file +548 -0

548 lines not on this page · raw message

arch/powerpc/perf/power7-pmu.c +32 -116

165 lines not on this page · raw message

#5 lore raw

Re: [tip:perf/core] perf tools: Make Power7 events available for perf

Quoted 9 lines · tip-bot for Runzhen Wang

perf tools: Make Power7 events available for perf

This patch makes all the POWER7 events available in sysfs. So we can instead specify these as:

$ size arch/powerpc/perf/power7-pmu.o
   text	   data	    bss	    dec	    hex	filename
   3073	   2720	      0	   5793	   16a1	arch/powerpc/perf/power7-pmu.o
Quoted 5 lines

and after the patch is applied, it is:

$ size arch/powerpc/perf/power7-pmu.o
   text	   data	    bss	    dec	    hex	filename
  15950	  31112	      0	  47062	   b7d6	arch/powerpc/perf/power7-pmu.o

so we're really going down this road?

If x86 follows this precedent we're going to end up with 300k+ of event names in the kernel. And as a reminder, perf_event cannot be disabled on x86, nor can it be compiled as a module. So that would be 300k of event names in every kernel for everyone, even those not using perf.

This belongs in userspace.

Vince

#6 lore raw

Re: [tip:perf/core] perf tools: Make Power7 events available for perf

Quoted 11 lines · Vince Weaver
Quoted 9 lines · tip-bot for Runzhen Wang

perf tools: Make Power7 events available for perf

This patch makes all the POWER7 events available in sysfs. So we can instead specify these as:

$ size arch/powerpc/perf/power7-pmu.o
   text          data     bss     dec     hex filename
   3073          2720       0    5793    16a1 arch/powerpc/perf/power7-pmu.o
Quoted 8 lines
Quoted 5 lines

and after the patch is applied, it is:

$ size arch/powerpc/perf/power7-pmu.o
   text          data     bss     dec     hex filename
  15950         31112       0   47062    b7d6 arch/powerpc/perf/power7-pmu.o

so we're really going down this road?

_We_ are going down this road, at least until there is a better solution. You'll notice I haven't merged any events for power8.

Quoted 5 lines

If x86 follows this precedent we're going to end up with 300k+ of event names in the kernel. And as a reminder, perf_event cannot be disabled on x86, nor can it be compiled as a module. So that would be 300k of event names in every kernel for everyone, even those not using perf.

x86 can do what it wants. I don't think anyone in x86 land has proposed putting all the events in the kernel, so you can stop worrying about your 300k of memory.

I thought it was pretty clear from the last thread that folks agreed the event _lists_ should be in userspace. The discovery of the PMUs should be done in the kernel, and that should be communicated to userspace via something in sys.

What it needs now is someone with some free time to actually code it up. Right now that's not me.

cheers

#7 lore raw

Re: [tip:perf/core] perf tools: Make Power7 events available for perf

I wish I were as good as cursing as Linus, ccing him in case he's willing to donate a few choice expressions.

Quoted 13 lines · Michael Ellerman
Quoted 11 lines · Vince Weaver
Quoted 9 lines
$ size arch/powerpc/perf/power7-pmu.o
   text          data     bss     dec     hex filename
   3073          2720       0    5793    16a1 arch/powerpc/perf/power7-pmu.o

and after the patch is applied, it is:

$ size arch/powerpc/perf/power7-pmu.o
   text          data     bss     dec     hex filename
  15950         31112       0   47062    b7d6 arch/powerpc/perf/power7-pmu.o
Quoted 4 lines
Quoted 1 line

so we're really going down this road?

_We_ are going down this road, at least until there is a better solution. You'll notice I haven't merged any events for power8.

No, you are going down this road permanently, because if you commit this, it becomes ABI, and we have to maintain it forever.

Quoted 3 lines

x86 can do what it wants. I don't think anyone in x86 land has proposed putting all the events in the kernel, so you can stop worrying about your 300k of memory.

I thought the prime directive of perf_event was nothing in the kernel that wasn't generic and applied to all architectures? Why is Power7 special?

Abusing sysfs to waste 100k of non-swappable kernel memory on every running Linux kernel everwhere to hold static event tables that could be a simple CSV file in the perf tools directory is crazy.

Especially as it's likely this becomes stable ABI, and then you'll promptly break it as has already happenend in the last kernel release with the existing in-kernel powerpc events.

Quoted 4 lines

I thought it was pretty clear from the last thread that folks agreed the event _lists_ should be in userspace. The discovery of the PMUs should be done in the kernel, and that should be communicated to userspace via something in sys.

I agree. So why is this patch in tip?

Quoted 2 lines

What it needs now is someone with some free time to actually code it up. Right now that's not me.

The code exists; it's called libpfm4. Just becase you're lazy doesn't mean we commit garbage code into the kenrel.

For what it's worth, as the unofficial perf_event ABI documentation maintainer I strongly NAK this patch.

Vince

#8 lore raw

Re: [tip:perf/core] perf tools: Make Power7 events available for perf

Quoted 3 lines · Vince Weaver

I wish I were as good as cursing as Linus, ccing him in case he's willing to donate a few choice expressions.

Well cursing is what witches do, but if you need someone to swear a bit I can help you out, I am fuckin Australian after all.

Quoted 15 lines · Michael Ellerman
Quoted 14 lines · Vince Weaver
Quoted 12 lines
Quoted 10 lines
$ size arch/powerpc/perf/power7-pmu.o
   text          data     bss     dec     hex filename
   3073          2720       0    5793    16a1 arch/powerpc/perf/power7-pmu.o

and after the patch is applied, it is:

$ size arch/powerpc/perf/power7-pmu.o
   text          data     bss     dec     hex filename
  15950         31112       0   47062    b7d6 arch/powerpc/perf/power7-pmu.o
Quoted 7 lines
Quoted 4 lines
Quoted 1 line

so we're really going down this road?

_We_ are going down this road, at least until there is a better solution. You'll notice I haven't merged any events for power8.

No, you are going down this road permanently, because if you commit this, it becomes ABI, and we have to maintain it forever.

Yes I understand what an ABI is. What I meant is we have only added the events for the Power7 PMU, and hopefully we will not have to add any for future PMUs.

Quoted 6 lines
Quoted 3 lines

x86 can do what it wants. I don't think anyone in x86 land has proposed putting all the events in the kernel, so you can stop worrying about your 300k of memory.

I thought the prime directive of perf_event was nothing in the kernel that wasn't generic and applied to all architectures? Why is Power7 special?

Sure perf tries to abstract things, and for the vast majority of users that's all they want or need.

But there are ~50 generic events in Linux, and our PMU supports ~500. And our hardware designers use perf, and they need to test all 500 events. And they're getting sick of using raw event codes.

Quoted 2 lines

Abusing sysfs to waste 100k of non-swappable kernel memory on every running Linux kernel everwhere

It's great that you're so concerned about memory wastage on _powerpc_ systems.

Quoted 2 lines

to hold static event tables that could be a simple CSV file in the perf tools directory is crazy.

I agree 100% that it could be a CSV file in the perf directory. But up until we sent this patch every attempt to do something like that had been NAKed.

Quoted 3 lines

Especially as it's likely this becomes stable ABI, and then you'll promptly break it as has already happenend in the last kernel release with the existing in-kernel powerpc events.

You're becoming the boy who cried "ABI break" Vince. Yes we renamed one event, we knew full well that nothing was using it - not even trinity.

Quoted 6 lines
Quoted 4 lines

I thought it was pretty clear from the last thread that folks agreed the event _lists_ should be in userspace. The discovery of the PMUs should be done in the kernel, and that should be communicated to userspace via something in sys.

I agree. So why is this patch in tip?

Because acme picked it up before that thread got going.

Quoted 5 lines
Quoted 2 lines

What it needs now is someone with some free time to actually code it up. Right now that's not me.

The code exists; it's called libpfm4. Just becase you're lazy doesn't mean we commit garbage code into the kenrel.

Don't call me lazy.

If the code is called libpfm4 why doesn't perf use it? There are patches out there to integrate the two, why don't you get them merged?

#9 lore raw

Re: [tip:perf/core] perf tools: Make Power7 events available for perf

Quoted 4 lines · Michael Ellerman

On Tue, Jul 23, 2013 at 05:38:21PM -0400, Vince Weaver wrote:

Well cursing is what witches do, but if you need someone to swear a bit I can help you out, I am fuckin Australian after all.

I should point out the cursing is directed at the code in question and the overall downhill direction in the perf_event interface, and not directed at anyone personally.

I've been fighting a (losing) battle for the past 5 years trying to keep event definitions out of the kernel, I just didn't expect defeat to come so swiftly and so suddenly from an unexpected corner (the power arch).

Quoted 3 lines

But there are ~50 generic events in Linux, and our PMU supports ~500. And our hardware designers use perf, and they need to test all 500 events. And they're getting sick of using raw event codes.

And writing a small wrapper utility or patching perf is somehow harder than sticking the whole mess in the kernel? I get annoyed having to look up the value of ANSI color escape codes now and then, but I don't expect to submit a patch for /sys/tty/colors/red to the kernel and have it accepted.

Quoted 5 lines
Quoted 2 lines

Abusing sysfs to waste 100k of non-swappable kernel memory on every running Linux kernel everwhere

It's great that you're so concerned about memory wastage on _powerpc_ systems.

It's a slippery slope.

Quoted 6 lines
Quoted 3 lines

Especially as it's likely this becomes stable ABI, and then you'll promptly break it as has already happenend in the last kernel release with the existing in-kernel powerpc events.

You're becoming the boy who cried "ABI break" Vince. Yes we renamed one event, we knew full well that nothing was using it - not even trinity.

Yes, the interface has only been around for one kernel version and you've already broken the ABI once. Not a very good track record. Event name renaming is a lot bigger problem on x86 where certain vendors like to fuss with the event names every 3 months or so.

trinity is just an example as the users tend to use -rc kernels and thus find the breakages faster. The main problem is tools like PAPI that deal with events in much more critical fashion, but the kernel devs don't really seem to care much about HPC use cases.

Quoted 3 lines
Quoted 1 line

I agree. So why is this patch in tip?

Because acme picked it up before that thread got going.

once a patch gets into tip in my experience all public mailing list review is done with, and the patch is more or less guaranteed to appear in the next major release unless there's some sort of regression in linux-next.

Hence this last attempt to get people to discuss this. It will likely be ignored, but at least I can feel like I tried.

Vince