Re: [PATCH v3 4/7] perf arm-spe: Use metadata to decide the data source feature

From: Leo Yan
Date: Thu Oct 10 2024 - 11:03:03 EST


On 10/10/24 14:53, James Clark wrote:

[...]

+static bool arm_spe__is_common_ds_encoding(struct arm_spe_queue *speq)
+{
+     struct arm_spe *spe = speq->spe;
+     bool is_in_cpu_list;
+     u64 *metadata = NULL;
+     u64 midr = 0;
+
+     /*
+      * Metadata version 1 doesn't contain any info for MIDR.
+      * Simply return false in this case.
+      */
+     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;

Technically you could look at timestamps and context switches to find
the CPU for non-homogeneous per-thread mode. But it's such an edge case
I'm not sure it's even worth leaving a TODO for.

Good point. Let’s bear the idea in mind in case we need it later.

Thanks,
Leo