All of lore.kernel.org
 help / color / mirror / Atom feed
From: <gregkh@linuxfoundation.org>
To: Julio.Suarez@arm.com,Kiel.Friedt@arm.com,Ryan.Roberts@arm.com,bwicaksono@nvidia.com,gregkh@linuxfoundation.org,james.clark@linaro.org,john.g.garry@oracle.com,leo.yan@arm.com,linux-arm-kernel@lists.infradead.org,mike.leach@linaro.org,namhyung@kernel.org,will@kernel.org
Cc: <stable-commits@vger.kernel.org>
Subject: Patch "perf arm-spe: Use old behavior when opening old SPE files" has been added to the 6.12-stable tree
Date: Tue, 21 Jul 2026 16:42:11 +0200	[thread overview]
Message-ID: <2026072111-progeny-perfected-c5e4@gregkh> (raw)


This is a note to let you know that I've just added the patch titled

    perf arm-spe: Use old behavior when opening old SPE files

to the 6.12-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     perf-arm-spe-use-old-behavior-when-opening-old-spe-files.patch
and it can be found in the queue-6.12 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


From ba993e5ada1ddce7a71140dc85ef65bc2cd981bc Mon Sep 17 00:00:00 2001
From: James Clark <james.clark@linaro.org>
Date: Tue, 29 Oct 2024 14:37:33 +0000
Subject: perf arm-spe: Use old behavior when opening old SPE files

From: James Clark <james.clark@linaro.org>

commit ba993e5ada1ddce7a71140dc85ef65bc2cd981bc upstream.

Since the linked commit, we stopped interpreting data source if the
perf.data file doesn't have the new metadata version. This means that
perf c2c will show no samples in this case.

Keep the old behavior so old files can be opened, but also still show
the new warning that updating might improve the decoding.

Also re-write the warning to be more concise and specific to a user.

Fixes: ba5e7169e548 ("perf arm-spe: Use metadata to decide the data source feature")
Signed-off-by: James Clark <james.clark@linaro.org>
Reviewed-by: Leo Yan <leo.yan@arm.com>
Cc: Julio.Suarez@arm.com
Cc: Kiel.Friedt@arm.com
Cc: Ryan.Roberts@arm.com
Cc: Will Deacon <will@kernel.org>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: Besar Wicaksono <bwicaksono@nvidia.com>
Cc: John Garry <john.g.garry@oracle.com>
Link: https://lore.kernel.org/r/20241029143734.291638-1-james.clark@linaro.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 tools/perf/util/arm-spe.c |   50 ++++++++++++++++++++++------------------------
 1 file changed, 24 insertions(+), 26 deletions(-)

--- a/tools/perf/util/arm-spe.c
+++ b/tools/perf/util/arm-spe.c
@@ -655,37 +655,35 @@ static bool arm_spe__is_common_ds_encodi
 	u64 *metadata = NULL;
 	u64 midr = 0;
 
-	/*
-	 * Metadata version 1 doesn't contain any info for MIDR.
-	 * Simply return false in this case.
-	 */
+	/* Metadata version 1 assumes all CPUs are the same (old behavior) */
 	if (spe->metadata_ver == 1) {
-		pr_warning_once("The data file contains metadata version 1, "
-				"which is absent the info for data source. "
-				"Please upgrade the tool to record data.\n");
-		return false;
-	}
-
-	/* CPU ID is -1 for per-thread mode */
-	if (speq->cpu < 0) {
-		/*
-		 * On the heterogeneous system, due to CPU ID is -1,
-		 * cannot confirm the data source packet is supported.
-		 */
-		if (!spe->is_homogeneous)
-			return false;
+		const char *cpuid;
 
-		/* In homogeneous system, simply use CPU0's metadata */
-		if (spe->metadata)
-			metadata = spe->metadata[0];
+		pr_warning_once("Old SPE metadata, re-record to improve decode accuracy\n");
+		cpuid = perf_env__cpuid(spe->session->evlist->env);
+		midr = strtol(cpuid, NULL, 16);
 	} else {
-		metadata = arm_spe__get_metadata_by_cpu(spe, speq->cpu);
-	}
+		/* CPU ID is -1 for per-thread mode */
+		if (speq->cpu < 0) {
+			/*
+			 * On the heterogeneous system, due to CPU ID is -1,
+			 * cannot confirm the data source packet is supported.
+			 */
+			if (!spe->is_homogeneous)
+				return false;
+
+			/* In homogeneous system, simply use CPU0's metadata */
+			if (spe->metadata)
+				metadata = spe->metadata[0];
+		} else {
+			metadata = arm_spe__get_metadata_by_cpu(spe, speq->cpu);
+		}
 
-	if (!metadata)
-		return false;
+		if (!metadata)
+			return false;
 
-	midr = metadata[ARM_SPE_CPU_MIDR];
+		midr = metadata[ARM_SPE_CPU_MIDR];
+	}
 
 	is_in_cpu_list = is_midr_in_range_list(midr, common_ds_encoding_cpus);
 	if (is_in_cpu_list)


Patches currently in stable-queue which might be from james.clark@linaro.org are

queue-6.12/perf-arm-spe-use-arm_spe_op_branch_eret-when-synthes.patch
queue-6.12/perf-arm-spe-correctly-set-sample-flags.patch
queue-6.12/perf-cs-etm-queue-context-packets-for-frontend.patch
queue-6.12/perf-arm-spe-add-branch-stack.patch
queue-6.12/perf-arm-spe-use-metadata-to-decide-the-data-source-.patch
queue-6.12/perf-pmu-skip-test-on-arm64-when-slots-is-zero.patch
queue-6.12/perf-sched-add-missing-mmap2-handler-in-timehist.patch
queue-6.12/perf-synthetic-events-fix-stale-build-id-in-module-mmap2-records.patch
queue-6.12/perf-inject-add-convert-callchain-option.patch
queue-6.12/perf-build-id-ensure-snprintf-string-is-empty-when-size-is-0.patch
queue-6.12/perf-debuginfo-fix-libdw-api-contract-violations.patch
queue-6.12/coresight-etm4x-correct-trcvmidcctlr1-save-and-resto.patch
queue-6.12/perf-event-fix-size-of-synthesized-sample-with-branc.patch
queue-6.12/perf-remove-redundant-kernel.h-include.patch
queue-6.12/perf-fix-off-by-one-stack-buffer-overflow-in-kallsym.patch
queue-6.12/perf-inject-with-convert-callchain-ignore-the-dummy-event-for-dwarf-stacks.patch
queue-6.12/perf-maps-add-maps__mutate_mapping.patch
queue-6.12/perf-arm-spe-use-old-behavior-when-opening-old-spe-files.patch


                 reply	other threads:[~2026-07-21 14:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=2026072111-progeny-perfected-c5e4@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=Julio.Suarez@arm.com \
    --cc=Kiel.Friedt@arm.com \
    --cc=Ryan.Roberts@arm.com \
    --cc=bwicaksono@nvidia.com \
    --cc=james.clark@linaro.org \
    --cc=john.g.garry@oracle.com \
    --cc=leo.yan@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mike.leach@linaro.org \
    --cc=namhyung@kernel.org \
    --cc=stable-commits@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.