arm64: perf: Add L2 cache events for ARMv8 PMuv3 and A53
Subsystems (3)
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
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
@@ -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
PATCH 1/2 arm64: pmu: Wire-up Cortex A53 L2 cache events and DTLB refills
In reply to Florian FainelliAdd 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
@@ -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
PATCH 2/2 arm64: pmu: Wire-up L2 cache events for ARMv8 PMUv3
In reply to Florian FainelliThe 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
@@ -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
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.
Signed-off-by Florian Fainelli <[email protected]>--- arch/arm64/kernel/perf_event.c | 5 +++++ 1 file changed, 5 insertions(+)arch/arm64/kernel/perf_event.c +0
-0
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
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.
Signed-off-by Florian Fainelli <[email protected]>--- arch/arm64/kernel/perf_event.c | 5 +++++ 1 file changed, 5 insertions(+)arch/arm64/kernel/perf_event.c +0
-0arch/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
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.
Signed-off-by Florian Fainelli <[email protected]>--- arch/arm64/kernel/perf_event.c | 5 +++++ 1 file changed, 5 insertions(+)arch/arm64/kernel/perf_event.c +0
-0arch/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
Catalin Marinas
maintainerRe: [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.
Signed-off-by Florian Fainelli <[email protected]>--- arch/arm64/kernel/perf_event.c | 5 +++++ 1 file changed, 5 insertions(+)arch/arm64/kernel/perf_event.c +0
-0arch/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
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.
Signed-off-by Florian Fainelli <[email protected]>--- arch/arm64/kernel/perf_event.c | 5 +++++ 1 file changed, 5 insertions(+)arch/arm64/kernel/perf_event.c +0
-0arch/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