From: Leo Yan <leo.yan@arm.com>
To: James Clark <james.clark@linaro.org>
Cc: 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>,
linux-arm-kernel@lists.infradead.org,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] perf arm_spe: Make a function to get the MIDR
Date: Thu, 2 Apr 2026 09:55:26 +0100 [thread overview]
Message-ID: <20260402085526.GE356832@e132581.arm.com> (raw)
In-Reply-To: <20260401-james-spe-impdef-decode-v1-1-ad0d372c220c@linaro.org>
On Wed, Apr 01, 2026 at 03:25:49PM +0100, James Clark wrote:
> We'll need the MIDR to dump IMPDEF events in the next commits so extract
> a function for it.
>
> No functional changes intended.
>
> Signed-off-by: James Clark <james.clark@linaro.org>
Reviewed-by: Leo Yan <leo.yan@arm.com>
> ---
> tools/perf/util/arm-spe.c | 36 ++++++++++++++++++++++--------------
> 1 file changed, 22 insertions(+), 14 deletions(-)
>
> diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c
> index 70dd9bee47c7..7447b000f9cd 100644
> --- a/tools/perf/util/arm-spe.c
> +++ b/tools/perf/util/arm-spe.c
> @@ -958,14 +958,9 @@ static void arm_spe__synth_memory_level(struct arm_spe_queue *speq,
> }
> }
>
> -static void arm_spe__synth_ds(struct arm_spe_queue *speq,
> - const struct arm_spe_record *record,
> - union perf_mem_data_src *data_src)
> +static int arm_spe__get_midr(struct arm_spe *spe, int cpu, u64 *midr)
> {
> - struct arm_spe *spe = speq->spe;
> - u64 *metadata = NULL;
> - u64 midr;
> - unsigned int i;
> + u64 *metadata;
>
> /* Metadata version 1 assumes all CPUs are the same (old behavior) */
> if (spe->metadata_ver == 1) {
> @@ -973,15 +968,28 @@ static void arm_spe__synth_ds(struct arm_spe_queue *speq,
>
> pr_warning_once("Old SPE metadata, re-record to improve decode accuracy\n");
> cpuid = perf_env__cpuid(perf_session__env(spe->session));
> - midr = strtol(cpuid, NULL, 16);
> - } else {
> - metadata = arm_spe__get_metadata_by_cpu(spe, speq->cpu);
> - if (!metadata)
> - return;
> -
> - midr = metadata[ARM_SPE_CPU_MIDR];
> + *midr = strtol(cpuid, NULL, 16);
> + return 0;
> }
>
> + metadata = arm_spe__get_metadata_by_cpu(spe, cpu);
> + if (!metadata)
> + return -EINVAL;
> +
> + *midr = metadata[ARM_SPE_CPU_MIDR];
> + return 0;
> +}
> +
> +static void arm_spe__synth_ds(struct arm_spe_queue *speq,
> + const struct arm_spe_record *record,
> + union perf_mem_data_src *data_src)
> +{
> + u64 midr;
> + unsigned int i;
> +
> + if (arm_spe__get_midr(speq->spe, speq->cpu, &midr))
> + return;
> +
> for (i = 0; i < ARRAY_SIZE(data_source_handles); i++) {
> if (is_midr_in_range_list(midr, data_source_handles[i].midr_ranges)) {
> return data_source_handles[i].ds_synth(record, data_src);
>
> --
> 2.34.1
>
>
next prev parent reply other threads:[~2026-04-02 8:55 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-01 14:25 [PATCH 0/4] perf arm_spe: Dump IMPDEF events James Clark
2026-04-01 14:25 ` [PATCH 1/4] perf arm_spe: Make a function to get the MIDR James Clark
2026-04-02 8:55 ` Leo Yan [this message]
2026-04-01 14:25 ` [PATCH 2/4] perf arm_spe: Turn event name mappings into an array James Clark
2026-04-02 9:13 ` Leo Yan
2026-04-02 9:48 ` James Clark
2026-04-02 15:30 ` Ian Rogers
2026-04-01 14:25 ` [PATCH 3/4] perf arm_spe: Decode Arm N1 IMPDEF events James Clark
2026-04-02 9:32 ` Leo Yan
2026-04-02 9:49 ` James Clark
2026-04-02 15:26 ` Ian Rogers
2026-04-01 14:25 ` [PATCH 4/4] perf arm_spe: Print remaining IMPDEF event numbers James Clark
2026-04-02 9:46 ` Leo Yan
2026-04-06 18:18 ` [PATCH 0/4] perf arm_spe: Dump IMPDEF events Namhyung Kim
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=20260402085526.GE356832@e132581.arm.com \
--to=leo.yan@arm.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