Linux perf list failing to detect hardware events on HiKey620

Hello,

I’m attempting to use the Linux perf subsystem to measure Cortex-A53/Kirin 620 hardware events (e.g. L1 and L2 cache hits/misses).

However, it’s failing to recognise any hardware events as expected, which is persisting through all known Linux kernel versions, from 96board’s stock Debian image to the most recent kernel build (5.17.0-rc1).

Could someone please provide some assistance? Example below.

root@linaro-developer:~/linux/tools/perf# ./perf list
List of pre-defined events (to be used in -e):
alignment-faults                                   [Software event]
bpf-output                                         [Software event]
cgroup-switches                                    [Software event]
context-switches OR cs                             [Software event]
cpu-clock                                          [Software event]
cpu-migrations OR migrations                       [Software event]
dummy                                              [Software event]
emulation-faults                                   [Software event]
major-faults                                       [Software event]
minor-faults                                       [Software event]
page-faults OR faults                              [Software event]
task-clock                                         [Software event]
duration_time                                      [Tool event]

rNNN                                               [Raw hardware event descrip
cpu/t1=v1[,t2=v2,t3 ...]/modifier                  [Raw hardware event descrip
(see 'man perf-list' on how to encode it)

mem:<addr>[/len][:access]                          [Hardware breakpoint]

PMU node is probably missing in the devicetree, there is documentation for hikey960: How to use PMU hardware events of ARM architecture on HiKey960 - 96Boards

It should be quite similar for hi6220, though I don’t know the irq mapping.

Thanks, Loic! I’ve tried adding the PMU node to hi6220.dtsi in the same way but without success (unsurprisingly). Like you, I don’t know the correct IRQs.

Can someone from HiSilicon help? Without the datasheets, the PMU for the HiKey/Kirin 620 will remain broken. :frowning:

documentation says ACPU_PMUIRQ is id 131, and is a combined interrupt for the eight cores performance units. So maybe try with something like <GIC_SPI 99 IRQ_TYPE_LEVEL_HIGH> (99 because GIC_SPI offset is 32 → 131-32).

Just an update after a couple of days of work.

I’ve tried to patch the offending Hi6220 files using commits from https://github.com/96boards/linux/pull/86/files as a guide to update the device tree. I haven’t been able to run a fixed kernel, however (including the originally fixed build from 2015). My gap in understanding is translating fixes in PR #86 to modern kernels (e.g. without /drivers/misc/hi6220-sysconfig.c).

I raised a bug report on linux-arm-kernel, but it appears that multiplexed PMU IRQs won’t be supported [1]. :frowning:

From an older post, a reference solution was provided to the poster in [2], but I can’t find it in the public domain.

  1. [BUG] dts: hi6220: PMU events not fully functional
  2. Questions about PMU counters - Patchwork