[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241216232459.427642-2-irogers@google.com>
Date: Mon, 16 Dec 2024 15:24:55 -0800
From: Ian Rogers <irogers@...gle.com>
To: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>, Namhyung Kim <namhyung@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>, Jiri Olsa <jolsa@...nel.org>,
Ian Rogers <irogers@...gle.com>, Adrian Hunter <adrian.hunter@...el.com>,
Kan Liang <kan.liang@...ux.intel.com>, Sun Haiyong <sunhaiyong@...ngson.cn>,
Yanteng Si <siyanteng@...ngson.cn>, linux-perf-users@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH v3 1/5] perf cpumap: If the die_id is missing use socket/physical_package_id
An error value for a missing die_id may be written into things like
the cpu_topology_map. As the topology needs to be fully written out,
including the die_id, to allow perf.data file features to be aligned
we can't allow error values to be written out. Instead base the
missing die_id value off of the socket/physical_package_id assuming
they correlate 1:1.
Signed-off-by: Ian Rogers <irogers@...gle.com>
---
tools/perf/util/cpumap.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/cpumap.c b/tools/perf/util/cpumap.c
index 27094211edd8..d362272f8466 100644
--- a/tools/perf/util/cpumap.c
+++ b/tools/perf/util/cpumap.c
@@ -283,7 +283,8 @@ int cpu__get_die_id(struct perf_cpu cpu)
{
int value, ret = cpu__get_topology_int(cpu.cpu, "die_id", &value);
- return ret ?: value;
+ /* If die_id is missing fallback on using the socket/physical_package_id. */
+ return ret || value < 0 ? cpu__get_socket_id(cpu) : value;
}
struct aggr_cpu_id aggr_cpu_id__die(struct perf_cpu cpu, void *data)
--
2.47.1.613.gc27f4b7a9f-goog
Powered by blists - more mailing lists