Skip to content

Commit 9fae588

Browse files
james-c-linaronamhyung
authored andcommitted
perf cpumap: Fix die and cluster IDs
Now that filename__read_int() returns -errno instead of -1 these statements need to be updated otherwise error values will be used as die IDs. This appears as a -2 die ID when the platform doesn't export one: $ perf stat --per-core -a -- true S36-D-2-C0 1 9.45 msec cpu-clock And the session topology test fails: $ perf test -vvv topology CPU 0, core 0, socket 36 CPU 1, core 1, socket 36 CPU 2, core 2, socket 36 CPU 3, core 3, socket 36 FAILED tests/topology.c:137 Cpu map - Die ID doesn't match ---- end(-1) ---- 38: Session topology : FAILED! Fixes: 05be17e ("tool api fs: Correctly encode errno for read/write open failures") Reported-by: Thomas Richter <[email protected]> Signed-off-by: James Clark <[email protected]> Acked-by: Namhyung Kim <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
1 parent 72d81e1 commit 9fae588

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/perf/util/cpumap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ struct aggr_cpu_id aggr_cpu_id__die(struct perf_cpu cpu, void *data)
293293

294294
die = cpu__get_die_id(cpu);
295295
/* There is no die_id on legacy system. */
296-
if (die == -1)
296+
if (die < 0)
297297
die = 0;
298298

299299
/*
@@ -322,7 +322,7 @@ struct aggr_cpu_id aggr_cpu_id__cluster(struct perf_cpu cpu, void *data)
322322
struct aggr_cpu_id id;
323323

324324
/* There is no cluster_id on legacy system. */
325-
if (cluster == -1)
325+
if (cluster < 0)
326326
cluster = 0;
327327

328328
id = aggr_cpu_id__die(cpu, data);

0 commit comments

Comments
 (0)