[PATCH v2 1/4] perf header: Write out even empty die_cpus_list

Ian Rogers posted 4 patches 1 year ago
There is a newer version of this series
[PATCH v2 1/4] perf header: Write out even empty die_cpus_list
Posted by Ian Rogers 1 year ago
Reading the CPU topology is tolerant to the dies_cpus_list being
missing by using the feature's size in the data file/pipe. However,
the feature's size is just the header size and may be
unaligned. Making the header size aligned breaks detecting a missing
die_cpus_list. To allow the header size to be aligned always write the
die_cpus_lists even if empty.

Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/perf/util/header.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 048e563069bc..03e43a9894d4 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -628,9 +628,6 @@ static int write_cpu_topology(struct feat_fd *ff,
 			return ret;
 	}
 
-	if (!tp->die_cpus_lists)
-		goto done;
-
 	ret = do_write(ff, &tp->die_cpus_lists, sizeof(tp->die_cpus_lists));
 	if (ret < 0)
 		goto done;
-- 
2.47.1.613.gc27f4b7a9f-goog
Re: [PATCH v2 1/4] perf header: Write out even empty die_cpus_list
Posted by Ian Rogers 1 year ago
On Sun, Dec 15, 2024 at 5:46 PM Ian Rogers <irogers@google.com> wrote:
>
> Reading the CPU topology is tolerant to the dies_cpus_list being
> missing by using the feature's size in the data file/pipe. However,
> the feature's size is just the header size and may be
> unaligned. Making the header size aligned breaks detecting a missing
> die_cpus_list. To allow the header size to be aligned always write the
> die_cpus_lists even if empty.
>
> Signed-off-by: Ian Rogers <irogers@google.com>

This change breaks the "Session topology" test on ARM with "Cpu map -
Die ID doesn't match" . One die id is -1 and the other is 0. I'll look
into addressing this in v3.

Thanks,
Ian