[PATCH v2 6/6] perf arm_spe: Print remaining IMPDEF event numbers
Jie Gan
jie.gan at oss.qualcomm.com
Fri Apr 10 18:08:18 PDT 2026
Hi James,
On 4/7/2026 10:05 PM, James Clark wrote:
> Any IMPDEF events not printed out from a known core's IMPDEF list or for
> a completely unknown core will still not be shown to the user. Fix this
> by printing the remaining bits as comma separated raw numbers, e.g.
> "IMPDEF:1,2,3,4".
>
> Suggested-by: Al Grant <al.grant at arm.com>
> Signed-off-by: James Clark <james.clark at linaro.org>
> ---
> tools/perf/util/arm-spe-decoder/arm-spe-pkt-decoder.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/tools/perf/util/arm-spe-decoder/arm-spe-pkt-decoder.c b/tools/perf/util/arm-spe-decoder/arm-spe-pkt-decoder.c
> index b74f887a48f2..c65b22a2179c 100644
> --- a/tools/perf/util/arm-spe-decoder/arm-spe-pkt-decoder.c
> +++ b/tools/perf/util/arm-spe-decoder/arm-spe-pkt-decoder.c
> @@ -8,6 +8,7 @@
> #include <string.h>
> #include <endian.h>
> #include <byteswap.h>
> +#include <linux/bitmap.h>
> #include <linux/bitops.h>
> #include <stdarg.h>
> #include <linux/kernel.h>
> @@ -365,6 +366,23 @@ static int arm_spe_pkt_desc_event(const struct arm_spe_pkt *packet,
> payload);
> }
>
> + /*
> + * Print remaining IMPDEF bits that weren't printed above as raw
> + * "IMPDEF:1,2,3,4" etc.
> + */
> + if (payload) {
> + int i;
> +
> + arm_spe_pkt_out_string(&err, &buf, &buf_len, " IMPDEF:");
> + for_each_set_bit(i, &payload, 64) {
for_each_set_bit(i, &payload, 64) passes &payload where payload is u64.
The macro expands to find_next_bit(const unsigned long *addr, ...). On a
32-bit host unsigned long is 32 bits wide, so only the low 32 bits of
payload would be scanned; bits 32–63 would be silently ignored. While
perf is almost always built on a 64-bit host today, the tools/ tree is
explicitly portable and the compiler will emit a -Wpointer-arith /
-Wincompatible-pointer-types warning on a 32-bit build.
Thanks,
Jie
> + const char *sep = payload & (payload - 1) ? "," : "";
> +
> + arm_spe_pkt_out_string(&err, &buf, &buf_len, "%d%s", i,
> + sep);
> + payload &= ~BIT_ULL(i);
> + }
> + }
> +
> return err;
> }
>
>
More information about the linux-arm-kernel
mailing list