Re: [PATCH 4/4] perf arm_spe: Print remaining IMPDEF event numbers

Leo Yan
2026-04-02T09:46:55Z

On Wed, Apr 01, 2026 at 03:25:52PM +0100, 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@arm.com>
> Signed-off-by: James Clark <james.clark@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 42a7501d4dfe..b93712ce0aca 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
> @@ -364,6 +364,24 @@ 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) {
> + arm_spe_pkt_out_string(&err, &buf, &buf_len, " IMPDEF:",
> + payload);
> + for (int i = 0; i < 64; i++) {

Nitpick: use for_each_set_bit(i, &payload, 64) instead.

> + const char *sep = payload & (payload - 1) ? "," : "";
> +
> + if (payload & BIT(i)) {
> + arm_spe_pkt_out_string(&err, &buf, &buf_len,
> + "%d%s", i, sep);
> + payload &= ~BIT(i);
> + }
> + }
> + }
> +
> return err;
> }
>
>
> --
> 2.34.1
>
>