Skip to content

Commit 5087c8f

Browse files
committed
linux: ignore single-PU dies explicitly
At least sparc/5.7 reports buggy die information (one per PU), likely because the kernel doesn't setup the die_cpus sysfs fields properly (they were added in Linux 5.3). Found on gcc102 (Sparc T3 running Debian 5.7.6-1). Signed-off-by: Brice Goglin <[email protected]>
1 parent 777e694 commit 5087c8f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

hwloc/topology-linux.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4521,14 +4521,18 @@ look_sysfscpu(struct hwloc_topology *topology,
45214521
}
45224522
}
45234523

4524-
if (!notfirstofcore /* don't look at the package unless we are the first of the core */
4524+
if (!notfirstofcore /* don't look at the die unless we are the first of the core */
45254525
&& hwloc_filter_check_keep_object_type(topology, HWLOC_OBJ_DIE)) {
45264526
/* look at the die */
45274527
sprintf(str, "%s/cpu%d/topology/die_cpus", path, i);
45284528
dieset = hwloc__alloc_read_path_as_cpumask(str, data->root_fd);
45294529
if (dieset) {
45304530
hwloc_bitmap_and(dieset, dieset, cpuset);
4531-
if (hwloc_bitmap_first(dieset) != i) {
4531+
if (hwloc_bitmap_weight(dieset) == 1) {
4532+
/* die with single PU (non-x86 arch using default die sysfs values), ignore the die */
4533+
hwloc_bitmap_free(dieset);
4534+
dieset = NULL;
4535+
} else if (hwloc_bitmap_first(dieset) != i) {
45324536
/* not first cpu in this die, ignore the die */
45334537
hwloc_bitmap_free(dieset);
45344538
dieset = NULL;

0 commit comments

Comments
 (0)