Skip to contentSkip to conversation

ARC: Add perf support for ARC700 cores

PATCH In review Mischa Jonker 3 participants 9 messages Nov 7, 2013 – Nov 12, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v3 cover ARC: Add perf support for ARC700 cores

Hi all,

Please find v3 of my attempt to add support for perf for ARC700 PMU's. If possible, it would be nice to get some feedback on the implementation from non-ARC/Synopsys people familiar with the perf subsystem in Linux.

Thanks,

Mischa

v3:
split devicetree binding doc into separate patch updated devicetree binding doc according to review comments
v2:
updated comments to kernel coding standards renamed devicetree binding to snps,arc700-pmu added devicetree binding doc

Mischa Jonker (2):
ARC: Add perf support for ARC700 cores
ARC: Add documentation on DT binding for ARC700 PMU

 Documentation/devicetree/bindings/arc/pmu.txt |   24 ++
 arch/arc/boot/dts/angel4.dts                  |    4 +
 arch/arc/include/asm/perf_event.h             |  204 +++++++++++++++-
 arch/arc/kernel/Makefile                      |    1 +
 arch/arc/kernel/perf_event.c                  |  322 +++++++++++++++++++++++++
 5 files changed, 554 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/arc/pmu.txt
 create mode 100644 arch/arc/kernel/perf_event.c
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v3 1/2 ARC: Add perf support for ARC700 cores

This adds basic perf support for ARC700 cores. Most PERF_COUNT_HW* events are supported now.

---
 arch/arc/boot/dts/angel4.dts      |    4 +
 arch/arc/include/asm/perf_event.h |  204 ++++++++++++++++++++++-
 arch/arc/kernel/Makefile          |    1 +
 arch/arc/kernel/perf_event.c      |  322 +++++++++++++++++++++++++++++++++++++
 4 files changed, 530 insertions(+), 1 deletion(-)
 create mode 100644 arch/arc/kernel/perf_event.c
arch/arc/boot/dts/angel4.dts +4 -0
index 4fb2d6f..bcf662d 100644
@@ -67,5 +67,9 @@
 				reg = <1>;
 			};
 		};
+
+		arcpmu0: pmu {
+			compatible = "snps,arc700-pmu";
+		};
 	};
 };
arch/arc/include/asm/perf_event.h +203 -1

212 lines not on this page · raw message

arch/arc/kernel/Makefile +1 -0
index c242ef0..8004b4f 100644
@@ -19,6 +19,7 @@ obj-$(CONFIG_KPROBES)      		+= kprobes.o
 obj-$(CONFIG_ARC_MISALIGN_ACCESS) 	+= unaligned.o
 obj-$(CONFIG_KGDB)			+= kgdb.o
 obj-$(CONFIG_ARC_METAWARE_HLINK)	+= arc_hostlink.o
+obj-$(CONFIG_PERF_EVENTS)		+= perf_event.o
 
 obj-$(CONFIG_ARC_FPU_SAVE_RESTORE)	+= fpu.o
 CFLAGS_fpu.o   += -mdpfp
arch/arc/kernel/perf_event.c new file +322 -0

322 lines not on this page · raw message

Signature · 1 line
1.7.9.5
maintainer Acked-by on v3 1/2
#2 lore raw
Quoted 2 lines · Mischa Jonker

This adds basic perf support for ARC700 cores. Most PERF_COUNT_HW* events are supported now.

I don't see anything particularly weird, but then I don't know/have the hardware so I suppose you know what you're doing :-)

#3 lore raw
Quoted 7 lines · Peter Zijlstra
Quoted 2 lines · Mischa Jonker

This adds basic perf support for ARC700 cores. Most PERF_COUNT_HW* events are supported now.

I don't see anything particularly weird, but then I don't know/have the hardware so I suppose you know what you're doing :-)

Thanks Peter.

This is now queued for next batch for arc 3.13-rc1 changes since we've been using this internally for quite some time now.

-Vineet

#4 lore raw

PATCH v3 2/2 ARC: Add documentation on DT binding for ARC700 PMU

In reply to Mischa Jonker
---
 Documentation/devicetree/bindings/arc/pmu.txt |   24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arc/pmu.txt
Documentation/devicetree/bindings/arc/pmu.txt new file +24 -0
new file mode 100644
index 0000000..49d5173
@@ -0,0 +1,24 @@
+* ARC Performance Monitor Unit
+
+The ARC 700 can be configured with a pipeline performance monitor for counting
+CPU and cache events like cache misses and hits.
+
+Note that:
+ * ARC 700 refers to a family of ARC processor cores;
+   - There is only one type of PMU available for the whole family;
+   - The PMU may support different sets of events; supported events are probed
+     at boot time, as required by the reference manual.
+
+ * The ARC 700 PMU does not support interrupts; although HW events may be
+   counted, the HW events themselves cannot serve as a trigger for a sample.
+
+Required properties:
+
+- compatible : should contain
+	"snps,arc700-pmu"
+
+Example:
+
+pmu {
+        compatible = "snps,arc700-pmu";
+};
Signature · 6 lines
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer
#5 lore raw
In reply to Mischa Jonker
Quoted 5 lines · Mischa Jonker

Hi all,

Please find v3 of my attempt to add support for perf for ARC700 PMU's. If possible, it would be nice to get some feedback on the implementation from non-ARC/Synopsys people familiar with the perf subsystem in Linux.

Anything in particular you wanted feedback on? It looks like a fairly straight fwd thingy.

maintainer
#6 lore raw
Quoted 9 lines · Peter Zijlstra
Quoted 5 lines · Mischa Jonker

Hi all,

Please find v3 of my attempt to add support for perf for ARC700 PMU's. If possible, it would be nice to get some feedback on the implementation from non-ARC/Synopsys people familiar with the perf subsystem in Linux.

Anything in particular you wanted feedback on? It looks like a fairly straight fwd thingy.

Ah, so its one of those that cannot sample; you might want to fail when we try and create a sampling event.

Also, you could consider running an (hr)timer to periodically update the events so that you don't miss a hardware counter wrap around -- if that is a distinct possibility.

#7 lore raw
Quoted 2 lines

Ah, so its one of those that cannot sample; you might want to fail when we try and create a sampling event.

Good suggestion, I'll create a separate patch for that!

Quoted 3 lines

Also, you could consider running an (hr)timer to periodically update the events so that you don't miss a hardware counter wrap around -- if that is a distinct possibility.

It's a theoretical possibility: the counters are 48 bits. Unlikely to happen during application development/performance analysis on an embedded core.

Thanks,

Mischa

#8 lore raw
In reply to Peter Zijlstra

Hi Peter,

Quoted 7 lines
Quoted 3 lines

Please find v3 of my attempt to add support for perf for ARC700 PMU's. If possible, it would be nice to get some feedback on the implementation from non-ARC/Synopsys people familiar with the perf

subsystem in Linux.

Anything in particular you wanted feedback on? It looks like a fairly straight fwd thingy.

This may just be my lack of experience with kernel etiquette; the patch works OK for us, but it would be a bit strange if Vineet would just apply it without any discussion on the mailing list. So thanks for having taken the time to look at it!

Mischa