Skip to contentSkip to conversation

arm64: perf: Add L2 cache events for ARMv8 PMuv3 and A53

PATCH In review Florian Fainelli 3 participants 9 messages Apr 20, 2017 – Apr 28, 2017

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

cover arm64: perf: Add L2 cache events for ARMv8 PMuv3 and A53

Hi,

While investigating why there were no L2 cache events generated for a Cortex A53-like PMU, it turned out that none of the L2 cache events were mapped.

This is also the case for ARMv8 PMUv3, which seems a little odd considering they are defined.

Thanks!

Florian Fainelli (2):
arm64: perf: Wire-up Cortex A53 L2 cache events and DTLB refills
arm64: pmu: Wire-up L2 cache events for ARMv8 PMUv3

 arch/arm64/kernel/perf_event.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
Signature · 1 line
2.9.3
#1 lore raw

PATCH 1/2 arm64: perf: Wire-up Cortex A53 L2 cache events and DTLB refills

Add missing L2 cache events: read/write accesses and misses, as well as the DTLB refills.

---
 arch/arm64/kernel/perf_event.c | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm64/kernel/perf_event.c +6 -0
index 57ae9d9ed9bb..4f011cdd756d 100644
@@ -290,6 +290,12 @@ static const unsigned armv8_a53_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
 	[C(L1I)][C(OP_READ)][C(RESULT_ACCESS)]	= ARMV8_PMUV3_PERFCTR_L1I_CACHE,
 	[C(L1I)][C(OP_READ)][C(RESULT_MISS)]	= ARMV8_PMUV3_PERFCTR_L1I_CACHE_REFILL,
 
+	[C(LL)][C(OP_READ)][C(RESULT_ACCESS)]	= ARMV8_PMUV3_PERFCTR_L2D_CACHE,
+	[C(LL)][C(OP_READ)][C(RESULT_MISS)]	= ARMV8_PMUV3_PERFCTR_L2D_CACHE_REFILL,
+	[C(LL)][C(OP_WRITE)][C(RESULT_ACCESS)]	= ARMV8_PMUV3_PERFCTR_L2D_CACHE,
+	[C(LL)][C(OP_WRITE)][C(RESULT_MISS)]	= ARMV8_PMUV3_PERFCTR_L2D_CACHE_REFILL,
+
+	[C(DTLB)][C(OP_READ)][C(RESULT_MISS)]	= ARMV8_PMUV3_PERFCTR_L1D_TLB_REFILL,
 	[C(ITLB)][C(OP_READ)][C(RESULT_MISS)]	= ARMV8_PMUV3_PERFCTR_L1I_TLB_REFILL,
 
 	[C(BPU)][C(OP_READ)][C(RESULT_ACCESS)]	= ARMV8_PMUV3_PERFCTR_BR_PRED,
Signature · 1 line
2.9.3
#2 lore raw

PATCH 1/2 arm64: pmu: Wire-up Cortex A53 L2 cache events and DTLB refills

In reply to Florian Fainelli

Add missing L2 cache events: read/write accesses and misses, as well as the DTLB refills.

---
 arch/arm64/kernel/perf_event.c | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm64/kernel/perf_event.c +6 -0
index 57ae9d9ed9bb..4f011cdd756d 100644
@@ -290,6 +290,12 @@ static const unsigned armv8_a53_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
 	[C(L1I)][C(OP_READ)][C(RESULT_ACCESS)]	= ARMV8_PMUV3_PERFCTR_L1I_CACHE,
 	[C(L1I)][C(OP_READ)][C(RESULT_MISS)]	= ARMV8_PMUV3_PERFCTR_L1I_CACHE_REFILL,
 
+	[C(LL)][C(OP_READ)][C(RESULT_ACCESS)]	= ARMV8_PMUV3_PERFCTR_L2D_CACHE,
+	[C(LL)][C(OP_READ)][C(RESULT_MISS)]	= ARMV8_PMUV3_PERFCTR_L2D_CACHE_REFILL,
+	[C(LL)][C(OP_WRITE)][C(RESULT_ACCESS)]	= ARMV8_PMUV3_PERFCTR_L2D_CACHE,
+	[C(LL)][C(OP_WRITE)][C(RESULT_MISS)]	= ARMV8_PMUV3_PERFCTR_L2D_CACHE_REFILL,
+
+	[C(DTLB)][C(OP_READ)][C(RESULT_MISS)]	= ARMV8_PMUV3_PERFCTR_L1D_TLB_REFILL,
 	[C(ITLB)][C(OP_READ)][C(RESULT_MISS)]	= ARMV8_PMUV3_PERFCTR_L1I_TLB_REFILL,
 
 	[C(BPU)][C(OP_READ)][C(RESULT_ACCESS)]	= ARMV8_PMUV3_PERFCTR_BR_PRED,
Signature · 1 line
2.9.3
#3 lore raw

PATCH 2/2 arm64: pmu: Wire-up L2 cache events for ARMv8 PMUv3

In reply to Florian Fainelli

The ARMv8 PMUv3 cache map did not include the L2 cache events, add them.

---
 arch/arm64/kernel/perf_event.c | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm64/kernel/perf_event.c +5 -0
index 4f011cdd756d..a664c575f3fd 100644
@@ -264,6 +264,11 @@ static const unsigned armv8_pmuv3_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
 	[C(L1I)][C(OP_READ)][C(RESULT_ACCESS)]	= ARMV8_PMUV3_PERFCTR_L1I_CACHE,
 	[C(L1I)][C(OP_READ)][C(RESULT_MISS)]	= ARMV8_PMUV3_PERFCTR_L1I_CACHE_REFILL,
 
+	[C(LL)][C(OP_READ)][C(RESULT_ACCESS)]	= ARMV8_PMUV3_PERFCTR_L2D_CACHE,
+	[C(LL)][C(OP_READ)][C(RESULT_MISS)]	= ARMV8_PMUV3_PERFCTR_L2D_CACHE_REFILL,
+	[C(LL)][C(OP_WRITE)][C(RESULT_ACCESS)]	= ARMV8_PMUV3_PERFCTR_L2D_CACHE,
+	[C(LL)][C(OP_WRITE)][C(RESULT_MISS)]	= ARMV8_PMUV3_PERFCTR_L2D_CACHE_REFILL,
+
 	[C(DTLB)][C(OP_READ)][C(RESULT_MISS)]	= ARMV8_PMUV3_PERFCTR_L1D_TLB_REFILL,
 	[C(DTLB)][C(OP_READ)][C(RESULT_ACCESS)]	= ARMV8_PMUV3_PERFCTR_L1D_TLB,
 
Signature · 1 line
2.9.3
#4 lore raw

Re: [PATCH 2/2] arm64: pmu: Wire-up L2 cache events for ARMv8 PMUv3

Hi Florian,

Quoted 13 lines · Florian Fainelli

The ARMv8 PMUv3 cache map did not include the L2 cache events, add them.

---
 arch/arm64/kernel/perf_event.c | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm64/kernel/perf_event.c +0 -0
index 4f011cdd756d..a664c575f3fd 100644

arch/arm64/kernel/perf_event.c static const unsigned armv8_pmuv3_perf_cache_map[PERF_COUNT_HW_CACHE_MAX] · line 270

Quoted 7 lines
arch/arm64/kernel/perf_event.c +4 -0
@@ -264,6 +264,11 @@ static const unsigned armv8_pmuv3_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
 	[C(L1I)][C(OP_READ)][C(RESULT_ACCESS)]	= ARMV8_PMUV3_PERFCTR_L1I_CACHE,
 	[C(L1I)][C(OP_READ)][C(RESULT_MISS)]	= ARMV8_PMUV3_PERFCTR_L1I_CACHE_REFILL,
 
+	[C(LL)][C(OP_READ)][C(RESULT_ACCESS)]	= ARMV8_PMUV3_PERFCTR_L2D_CACHE,
+	[C(LL)][C(OP_READ)][C(RESULT_MISS)]	= ARMV8_PMUV3_PERFCTR_L2D_CACHE_REFILL,
+	[C(LL)][C(OP_WRITE)][C(RESULT_ACCESS)]	= ARMV8_PMUV3_PERFCTR_L2D_CACHE,
+	[C(LL)][C(OP_WRITE)][C(RESULT_MISS)]	= ARMV8_PMUV3_PERFCTR_L2D_CACHE_REFILL,

I don't think this is correct in general. 'LL' stands for "last-level", which may be L3 or even a system cache in the interconnect. Tying that to L2 is the wrong thing to do from perf's generic event perspective.

I'm ok with what you're proposing for A53 (where the PMU can only count events out to the L2), but I'm reluctant to make this change for the generic PMUv3 events.

Will

#5 lore raw

Re: [PATCH 2/2] arm64: pmu: Wire-up L2 cache events for ARMv8 PMUv3

Quoted 28 lines · Will Deacon

Hi Florian,

Quoted 13 lines · Florian Fainelli

The ARMv8 PMUv3 cache map did not include the L2 cache events, add them.

---
 arch/arm64/kernel/perf_event.c | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm64/kernel/perf_event.c +0 -0
index 4f011cdd756d..a664c575f3fd 100644

arch/arm64/kernel/perf_event.c static const unsigned armv8_pmuv3_perf_cache_map[PERF_COUNT_HW_CACHE_MAX] · line 270

Quoted 7 lines
arch/arm64/kernel/perf_event.c +4 -0
@@ -264,6 +264,11 @@ static const unsigned armv8_pmuv3_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
 	[C(L1I)][C(OP_READ)][C(RESULT_ACCESS)]	= ARMV8_PMUV3_PERFCTR_L1I_CACHE,
 	[C(L1I)][C(OP_READ)][C(RESULT_MISS)]	= ARMV8_PMUV3_PERFCTR_L1I_CACHE_REFILL,
 
+	[C(LL)][C(OP_READ)][C(RESULT_ACCESS)]	= ARMV8_PMUV3_PERFCTR_L2D_CACHE,
+	[C(LL)][C(OP_READ)][C(RESULT_MISS)]	= ARMV8_PMUV3_PERFCTR_L2D_CACHE_REFILL,
+	[C(LL)][C(OP_WRITE)][C(RESULT_ACCESS)]	= ARMV8_PMUV3_PERFCTR_L2D_CACHE,
+	[C(LL)][C(OP_WRITE)][C(RESULT_MISS)]	= ARMV8_PMUV3_PERFCTR_L2D_CACHE_REFILL,

I don't think this is correct in general. 'LL' stands for "last-level", which may be L3 or even a system cache in the interconnect. Tying that to L2 is the wrong thing to do from perf's generic event perspective.

Quoted 3 lines

I'm ok with what you're proposing for A53 (where the PMU can only count events out to the L2), but I'm reluctant to make this change for the generic PMUv3 events.

That makes sense, shall I resubmit the first patch by itself or can you or Catalin take it as-is?

Thanks!

Signature · 1 line
Florian
#6 lore raw

Re: [PATCH 2/2] arm64: pmu: Wire-up L2 cache events for ARMv8 PMUv3

Quoted 29 lines · Florian Fainelli
Quoted 28 lines · Will Deacon

Hi Florian,

Quoted 13 lines · Florian Fainelli

The ARMv8 PMUv3 cache map did not include the L2 cache events, add them.

---
 arch/arm64/kernel/perf_event.c | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm64/kernel/perf_event.c +0 -0
index 4f011cdd756d..a664c575f3fd 100644

arch/arm64/kernel/perf_event.c static const unsigned armv8_pmuv3_perf_cache_map[PERF_COUNT_HW_CACHE_MAX] · line 270

Quoted 7 lines
arch/arm64/kernel/perf_event.c +4 -0
@@ -264,6 +264,11 @@ static const unsigned armv8_pmuv3_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
 	[C(L1I)][C(OP_READ)][C(RESULT_ACCESS)]	= ARMV8_PMUV3_PERFCTR_L1I_CACHE,
 	[C(L1I)][C(OP_READ)][C(RESULT_MISS)]	= ARMV8_PMUV3_PERFCTR_L1I_CACHE_REFILL,
 
+	[C(LL)][C(OP_READ)][C(RESULT_ACCESS)]	= ARMV8_PMUV3_PERFCTR_L2D_CACHE,
+	[C(LL)][C(OP_READ)][C(RESULT_MISS)]	= ARMV8_PMUV3_PERFCTR_L2D_CACHE_REFILL,
+	[C(LL)][C(OP_WRITE)][C(RESULT_ACCESS)]	= ARMV8_PMUV3_PERFCTR_L2D_CACHE,
+	[C(LL)][C(OP_WRITE)][C(RESULT_MISS)]	= ARMV8_PMUV3_PERFCTR_L2D_CACHE_REFILL,

I don't think this is correct in general. 'LL' stands for "last-level", which may be L3 or even a system cache in the interconnect. Tying that to L2 is the wrong thing to do from perf's generic event perspective.

Quoted 6 lines
Quoted 3 lines

I'm ok with what you're proposing for A53 (where the PMU can only count events out to the L2), but I'm reluctant to make this change for the generic PMUv3 events.

That makes sense, shall I resubmit the first patch by itself or can you or Catalin take it as-is?

I'll talk to Catalin tomorrow and try to get the A53 bit queued.

Will

maintainer
#7 lore raw

Re: [PATCH 2/2] arm64: pmu: Wire-up L2 cache events for ARMv8 PMUv3

Quoted 28 lines · Will Deacon
Quoted 27 lines · Florian Fainelli
Quoted 26 lines · Will Deacon
Quoted 13 lines · Florian Fainelli

The ARMv8 PMUv3 cache map did not include the L2 cache events, add them.

---
 arch/arm64/kernel/perf_event.c | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm64/kernel/perf_event.c +0 -0
index 4f011cdd756d..a664c575f3fd 100644

arch/arm64/kernel/perf_event.c static const unsigned armv8_pmuv3_perf_cache_map[PERF_COUNT_HW_CACHE_MAX] · line 270

Quoted 7 lines
arch/arm64/kernel/perf_event.c +4 -0
@@ -264,6 +264,11 @@ static const unsigned armv8_pmuv3_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
 	[C(L1I)][C(OP_READ)][C(RESULT_ACCESS)]	= ARMV8_PMUV3_PERFCTR_L1I_CACHE,
 	[C(L1I)][C(OP_READ)][C(RESULT_MISS)]	= ARMV8_PMUV3_PERFCTR_L1I_CACHE_REFILL,
 
+	[C(LL)][C(OP_READ)][C(RESULT_ACCESS)]	= ARMV8_PMUV3_PERFCTR_L2D_CACHE,
+	[C(LL)][C(OP_READ)][C(RESULT_MISS)]	= ARMV8_PMUV3_PERFCTR_L2D_CACHE_REFILL,
+	[C(LL)][C(OP_WRITE)][C(RESULT_ACCESS)]	= ARMV8_PMUV3_PERFCTR_L2D_CACHE,
+	[C(LL)][C(OP_WRITE)][C(RESULT_MISS)]	= ARMV8_PMUV3_PERFCTR_L2D_CACHE_REFILL,

I don't think this is correct in general. 'LL' stands for "last-level", which may be L3 or even a system cache in the interconnect. Tying that to L2 is the wrong thing to do from perf's generic event perspective.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

I'm ok with what you're proposing for A53 (where the PMU can only count events out to the L2), but I'm reluctant to make this change for the generic PMUv3 events.

That makes sense, shall I resubmit the first patch by itself or can you or Catalin take it as-is?

I'll talk to Catalin tomorrow and try to get the A53 bit queued.

I queued patch 1/2. Shall I add your ack?

Signature · 1 line
Catalin
#8 lore raw

Re: [PATCH 2/2] arm64: pmu: Wire-up L2 cache events for ARMv8 PMUv3

Quoted 33 lines · Catalin Marinas
Quoted 32 lines · Will Deacon
Quoted 31 lines · Florian Fainelli
Quoted 29 lines · Will Deacon
Quoted 13 lines · Florian Fainelli

The ARMv8 PMUv3 cache map did not include the L2 cache events, add them.

---
 arch/arm64/kernel/perf_event.c | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm64/kernel/perf_event.c +0 -0
index 4f011cdd756d..a664c575f3fd 100644

arch/arm64/kernel/perf_event.c static const unsigned armv8_pmuv3_perf_cache_map[PERF_COUNT_HW_CACHE_MAX] · line 270

Quoted 7 lines
arch/arm64/kernel/perf_event.c +4 -0
@@ -264,6 +264,11 @@ static const unsigned armv8_pmuv3_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
 	[C(L1I)][C(OP_READ)][C(RESULT_ACCESS)]	= ARMV8_PMUV3_PERFCTR_L1I_CACHE,
 	[C(L1I)][C(OP_READ)][C(RESULT_MISS)]	= ARMV8_PMUV3_PERFCTR_L1I_CACHE_REFILL,
 
+	[C(LL)][C(OP_READ)][C(RESULT_ACCESS)]	= ARMV8_PMUV3_PERFCTR_L2D_CACHE,
+	[C(LL)][C(OP_READ)][C(RESULT_MISS)]	= ARMV8_PMUV3_PERFCTR_L2D_CACHE_REFILL,
+	[C(LL)][C(OP_WRITE)][C(RESULT_ACCESS)]	= ARMV8_PMUV3_PERFCTR_L2D_CACHE,
+	[C(LL)][C(OP_WRITE)][C(RESULT_MISS)]	= ARMV8_PMUV3_PERFCTR_L2D_CACHE_REFILL,

I don't think this is correct in general. 'LL' stands for "last-level", which may be L3 or even a system cache in the interconnect. Tying that to L2 is the wrong thing to do from perf's generic event perspective.

I'm ok with what you're proposing for A53 (where the PMU can only count events out to the L2), but I'm reluctant to make this change for the generic PMUv3 events.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

That makes sense, shall I resubmit the first patch by itself or can you or Catalin take it as-is?

I'll talk to Catalin tomorrow and try to get the A53 bit queued.

I queued patch 1/2. Shall I add your ack?

Yes, please.

Will