[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240827165125.3311306-4-leo.yan@arm.com>
Date: Tue, 27 Aug 2024 17:51:21 +0100
From: Leo Yan <leo.yan@....com>
To: Arnaldo Carvalho de Melo <acme@...nel.org>,
James Clark <james.clark@...aro.org>,
Namhyung Kim <namhyung@...nel.org>,
Ian Rogers <irogers@...gle.com>,
Jiri Olsa <jolsa@...nel.org>,
Adrian Hunter <adrian.hunter@...el.com>,
John Garry <john.g.garry@...cle.com>,
Will Deacon <will@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Mike Leach <mike.leach@...aro.org>,
linux-perf-users@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org
Cc: Leo Yan <leo.yan@....com>
Subject: [PATCH v1 3/7] perf arm-spe: Introduce arm_spe__is_homogeneous()
Introduce the arm_spe__is_homogeneous() function, it uses to check if
Arm SPE is homogeneous cross all CPUs.
Signed-off-by: Leo Yan <leo.yan@....com>
---
tools/perf/util/arm-spe.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c
index 2ab9078d49fc..e7ad52215066 100644
--- a/tools/perf/util/arm-spe.c
+++ b/tools/perf/util/arm-spe.c
@@ -82,6 +82,7 @@ struct arm_spe {
u64 **metadata;
u64 metadata_ver;
u64 metadata_num_cpu;
+ bool is_homogeneous;
};
struct arm_spe_queue {
@@ -1316,6 +1317,30 @@ static u64 *arm_spe__create_meta_blk(u64 *buf, int per_cpu_size)
return metadata;
}
+static bool arm_spe__is_homogeneous(u64 **metadata, int num_cpu)
+{
+ u64 midr;
+ int i;
+
+ if (!num_cpu)
+ return false;
+
+ for (i = 0; i < num_cpu; i++) {
+ if (!metadata[i])
+ return false;
+
+ if (i == 0) {
+ midr = metadata[i][ARM_SPE_CPU_MIDR];
+ continue;
+ }
+
+ if (midr != metadata[i][ARM_SPE_CPU_MIDR])
+ return false;
+ }
+
+ return true;
+}
+
int arm_spe_process_auxtrace_info(union perf_event *event,
struct perf_session *session)
{
@@ -1384,6 +1409,7 @@ int arm_spe_process_auxtrace_info(union perf_event *event,
spe->metadata = metadata;
spe->metadata_ver = metadata_ver;
spe->metadata_num_cpu = num_cpu;
+ spe->is_homogeneous = arm_spe__is_homogeneous(metadata, num_cpu);
spe->timeless_decoding = arm_spe__is_timeless_decoding(spe);
--
2.34.1
Powered by blists - more mailing lists