public inbox for linux-perf-users@vger.kernel.org
 help / color / mirror / Atom feed
From: Jie Gan <jie.gan@oss.qualcomm.com>
To: James Clark <james.clark@linaro.org>,
	John Garry <john.g.garry@oracle.com>,
	Will Deacon <will@kernel.org>, Mike Leach <mike.leach@linaro.org>,
	Leo Yan <leo.yan@linux.dev>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Al Grant <al.grant@arm.com>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 6/6] perf arm_spe: Print remaining IMPDEF event numbers
Date: Sat, 11 Apr 2026 09:08:18 +0800	[thread overview]
Message-ID: <3e7645cf-28cb-4021-89e6-e467e9555ff4@oss.qualcomm.com> (raw)
In-Reply-To: <20260407-james-spe-impdef-decode-v2-6-55d3ef997c48@linaro.org>

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@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 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;
>   }
>   
> 


  parent reply	other threads:[~2026-04-11  1:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-07 14:05 [PATCH v2 0/6] perf arm_spe: Dump IMPDEF events James Clark
2026-04-07 14:05 ` [PATCH v2 1/6] perf arm_spe: Make a function to get the MIDR James Clark
2026-04-07 14:05 ` [PATCH v2 2/6] perf arm_spe: Handle missing CPU IDs James Clark
2026-04-07 15:30   ` Leo Yan
2026-04-07 14:05 ` [PATCH v2 3/6] perf arm_spe: Store MIDR in arm_spe_pkt James Clark
2026-04-07 15:41   ` Leo Yan
2026-04-07 14:05 ` [PATCH v2 4/6] perf arm_spe: Turn event name mappings into an array James Clark
2026-04-07 14:05 ` [PATCH v2 5/6] perf arm_spe: Decode Arm N1 IMPDEF events James Clark
2026-04-07 15:44   ` Leo Yan
2026-04-07 14:05 ` [PATCH v2 6/6] perf arm_spe: Print remaining IMPDEF event numbers James Clark
2026-04-07 15:46   ` Leo Yan
2026-04-11  1:08   ` Jie Gan [this message]
2026-04-10 16:50 ` [PATCH v2 0/6] perf arm_spe: Dump IMPDEF events Namhyung Kim
2026-04-10 22:05   ` Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3e7645cf-28cb-4021-89e6-e467e9555ff4@oss.qualcomm.com \
    --to=jie.gan@oss.qualcomm.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=al.grant@arm.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=john.g.garry@oracle.com \
    --cc=jolsa@kernel.org \
    --cc=leo.yan@linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mike.leach@linaro.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox