Skip to content

Commit 64a9213

Browse files
Leo-Yanarighi
authored andcommitted
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@arm.com> Reviewed-by: James Clark <james.clark@linaro.org> Link: https://lore.kernel.org/r/20241003185322.192357-4-leo.yan@arm.com Signed-off-by: Namhyung Kim <namhyung@kernel.org> (cherry picked from commit 56ae663) Signed-off-by: Andrea Righi <arighi@nvidia.com>
1 parent 807ef6b commit 64a9213

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

tools/perf/util/arm-spe.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ struct arm_spe {
8484
u64 **metadata;
8585
u64 metadata_ver;
8686
u64 metadata_nr_cpu;
87+
bool is_homogeneous;
8788
};
8889

8990
struct arm_spe_queue {
@@ -1401,6 +1402,30 @@ arm_spe_synth_events(struct arm_spe *spe, struct perf_session *session)
14011402
return 0;
14021403
}
14031404

1405+
static bool arm_spe__is_homogeneous(u64 **metadata, int nr_cpu)
1406+
{
1407+
u64 midr;
1408+
int i;
1409+
1410+
if (!nr_cpu)
1411+
return false;
1412+
1413+
for (i = 0; i < nr_cpu; i++) {
1414+
if (!metadata[i])
1415+
return false;
1416+
1417+
if (i == 0) {
1418+
midr = metadata[i][ARM_SPE_CPU_MIDR];
1419+
continue;
1420+
}
1421+
1422+
if (midr != metadata[i][ARM_SPE_CPU_MIDR])
1423+
return false;
1424+
}
1425+
1426+
return true;
1427+
}
1428+
14041429
int arm_spe_process_auxtrace_info(union perf_event *event,
14051430
struct perf_session *session)
14061431
{
@@ -1446,6 +1471,7 @@ int arm_spe_process_auxtrace_info(union perf_event *event,
14461471
spe->metadata = metadata;
14471472
spe->metadata_ver = metadata_ver;
14481473
spe->metadata_nr_cpu = nr_cpu;
1474+
spe->is_homogeneous = arm_spe__is_homogeneous(metadata, nr_cpu);
14491475

14501476
spe->timeless_decoding = arm_spe__is_timeless_decoding(spe);
14511477

0 commit comments

Comments
 (0)