Subject: Re: [PATCH v2 0/6] perf arm_spe: Dump IMPDEF events

From: Namhyung Kim <[email-masked]>
Date: Fri, 10 Apr 2026 09:50:16 -0700

Hi James,

On Tue, Apr 07, 2026 at 03:05:14PM +0100, James Clark wrote:
> In the Arm SPE raw data dump, IMPDEF events aren't printed. Add the
> ability to add names for some known events or print the raw event number
> for unknown events.
> 
> For example:
> 
>   $ perf report -D
> 
>   ... ARM SPE data: size 0xd000 bytes
>   00000000: b0 18 c6 32 80 00 80 ff a0  PC 0xff80008032c618 el1 ns=1
>   00000009: 64 e7 42 00 00              CONTEXT 0x42e7 el1
>   0000000e: 00 00 00 00 00              PAD
>   00000013: 49 00                       LD GP-REG
>   00000015: 52 16 10               	EV RETIRED L1D-ACCESS TLB-ACCESS
> 
> On N1 the event line becomes:
> 
>   00000015: 52 16 10                    EV RETIRED L1D-ACCESS TLB-ACCESS LATE-PREFETCH
> 
> Or on other cores it becomes:
> 
>   00000015: 52 16 10                    EV RETIRED L1D-ACCESS TLB-ACCESS IMPDEF:12
> 
> Signed-off-by: James Clark <[email-masked]>
> ---
> Changes in v2:
> - Put MIDR in arm_spe_pkt (Leo)
> - Use for_each_set_bit() (Leo)
> - Use BIT_ULL() to fix 32bit builds (Ian)
> - Don't call strtol() with NULL (Ian)
> - Link to v1: https://lore.kernel.org/r/[email-masked]

I'm getting this on 32-bit build.

  In file included from /linux/tools/include/linux/bitmap.h:8,                    
                   from util/arm-spe-decoder/arm-spe-pkt-decoder.c:11:            
  util/arm-spe-decoder/arm-spe-pkt-decoder.c: In function 'arm_spe_pkt_desc_event':
  util/arm-spe-decoder/arm-spe-pkt-decoder.c:377:37: error: passing argument 1 of 'find_first_bit' from incompatible pointer type [-Werror=incompatible-pointer-types]
    377 |                 for_each_set_bit(i, &payload, 64) {                      
  /linux/tools/include/linux/bitops.h:55:38: note: in definition of macro 'for_each_set_bit'
     55 |         for ((bit) = find_first_bit((addr), (size));            \       
        |                                      ^~~~                               
  In file included from /linux/tools/include/linux/bitmap.h:9:                    
  /linux/tools/include/linux/find.h:118:51: note: expected 'const long unsigned int *' but argument is of type 'u64 *' {aka 'long long unsigned int *'}
    118 | unsigned long find_first_bit(const unsigned long *addr, unsigned long size)
        |                              ~~~~~~~~~~~~~~~~~~~~~^~~~

Thanks,
Namhyung

> 
> ---
> James Clark (6):
>       perf arm_spe: Make a function to get the MIDR
>       perf arm_spe: Handle missing CPU IDs
>       perf arm_spe: Store MIDR in arm_spe_pkt
>       perf arm_spe: Turn event name mappings into an array
>       perf arm_spe: Decode Arm N1 IMPDEF events
>       perf arm_spe: Print remaining IMPDEF event numbers
> 
>  tools/perf/util/arm-spe-decoder/Build              |   2 +
>  tools/perf/util/arm-spe-decoder/arm-spe-decoder.c  |  17 ++-
>  tools/perf/util/arm-spe-decoder/arm-spe-decoder.h  |   3 +-
>  .../util/arm-spe-decoder/arm-spe-pkt-decoder.c     | 144 ++++++++++++++-------
>  .../util/arm-spe-decoder/arm-spe-pkt-decoder.h     |   5 +-
>  tools/perf/util/arm-spe.c                          |  62 ++++++---
>  6 files changed, 158 insertions(+), 75 deletions(-)
> ---
> base-commit: 74e2dbe7be5037a5e5eed6bc1ad562747ac88566
> change-id: 20260331-james-spe-impdef-decode-d944f4fdcff7
> 
> Best regards,
> -- 
> James Clark <[email-masked]>
>