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

From: Ian Rogers
Date: Sun Dec 15 2024 - 20:53:22 EST


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@xxxxxxxxxx>
---
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