diff --git a/SOURCES/0001-linux-fix-support-for-NUMA-node0-being-offline.patch b/SOURCES/0001-linux-fix-support-for-NUMA-node0-being-offline.patch new file mode 100644 index 0000000..35c5438 --- /dev/null +++ b/SOURCES/0001-linux-fix-support-for-NUMA-node0-being-offline.patch @@ -0,0 +1,74 @@ +From 0114c2b0b3e39265e0829eebfff87ac9f4412fe9 Mon Sep 17 00:00:00 2001 +From: Brice Goglin +Date: Mon, 26 Apr 2021 20:35:42 +0200 +Subject: [PATCH] linux: fix support for NUMA node0 being offline + +Just like we didn't support offline CPU#0 until commit +7bcc273efd50536961ba16d474efca4ae163229b, we need to +support node0 being offline as well. +It's not clear whether it's a new Linux feature or not, +this was reported on a POWER LPAR VM. + +The symptoms are different here because we got no NUMA +nodes at all, hence the core hwloc added a default +machine-wide node. But this node got marked disallowed +by Linux cgroups. Hence load() failed with + "Topology does not contain any NUMA node, aborting!" + +We opportunistically assume node0 is online to avoid +the overhead in the vast majority of cases. If node0 +is missing, we parse "online" to find the first node. + +Thanks to Jirka Hladky for the report. + +Signed-off-by: Brice Goglin +--- + hwloc/topology-linux.c | 25 +++++++++++++++++++++++++ + 1 file changed, 25 insertions(+) + +diff --git a/hwloc/topology-linux.c b/hwloc/topology-linux.c +index 94b242dd03e6..10e038e6449b 100644 +--- a/hwloc/topology-linux.c ++++ b/hwloc/topology-linux.c +@@ -5264,6 +5264,9 @@ static const char *find_sysfs_cpu_path(int root_fd, int *old_filenames) + + static const char *find_sysfs_node_path(int root_fd) + { ++ unsigned first; ++ int err; ++ + if (!hwloc_access("/sys/bus/node/devices", R_OK|X_OK, root_fd) + && !hwloc_access("/sys/bus/node/devices/node0/cpumap", R_OK, root_fd)) + return "/sys/bus/node/devices"; +@@ -5272,6 +5275,28 @@ static const char *find_sysfs_node_path(int root_fd) + && !hwloc_access("/sys/devices/system/node/node0/cpumap", R_OK, root_fd)) + return "/sys/devices/system/node"; + ++ /* node0 might be offline, fallback to looking at the first online node. ++ * online contains comma-separated ranges, just read the first number. ++ */ ++ hwloc_debug("Failed to find sysfs node files using node0, looking at online nodes...\n"); ++ err = hwloc_read_path_as_uint("/sys/devices/system/node/online", &first, root_fd); ++ if (err) { ++ hwloc_debug("Failed to find read /sys/devices/system/node/online.\n"); ++ } else { ++ char path[PATH_MAX]; ++ hwloc_debug("Found node#%u as first online node\n", first); ++ ++ snprintf(path, sizeof(path), "/sys/bus/node/devices/node%u/cpumap", first); ++ if (!hwloc_access("/sys/bus/node/devices", R_OK|X_OK, root_fd) ++ && !hwloc_access(path, R_OK, root_fd)) ++ return "/sys/bus/node/devices"; ++ ++ snprintf(path, sizeof(path), "/sys/devices/system/node/node%u/cpumap", first); ++ if (!hwloc_access("/sys/devices/system/node", R_OK|X_OK, root_fd) ++ && !hwloc_access(path, R_OK, root_fd)) ++ return "/sys/devices/system/node"; ++ } ++ + return NULL; + } + +-- +2.51.0 + diff --git a/SPECS/hwloc.spec b/SPECS/hwloc.spec index 3be31f1..59185da 100644 --- a/SPECS/hwloc.spec +++ b/SPECS/hwloc.spec @@ -1,10 +1,12 @@ Summary: Portable Hardware Locality - portable abstraction of hierarchical architectures Name: hwloc Version: 2.4.1 -Release: 5%{?dist} +Release: 6%{?dist} License: BSD URL: http://www.open-mpi.org/projects/hwloc/ Source0: http://www.open-mpi.org/software/hwloc/v2.4/downloads/%{name}-%{version}.tar.bz2 +# https://github.com/open-mpi/hwloc/commit/0114c2b0b3e39265e0829eebfff87ac9f4412fe9 +Patch0: 0001-linux-fix-support-for-NUMA-node0-being-offline.patch Requires: %{name}-libs%{?_isa} = %{version}-%{release} BuildRequires: gcc @@ -174,6 +176,10 @@ LD_LIBRARY_PATH=$PWD/hwloc/.libs make check %{_libdir}/%{name}/hwloc* %changelog +* Wed Oct 15 2025 Dan HorĂ¡k - 2.4.1-6 +- linux: fix support for NUMA node0 being offline (RHEL-118677) +- Resolves: RHEL-118677 + * Mon Aug 09 2021 Mohan Boddu - 2.4.1-5 - Rebuilt for IMA sigs, glibc 2.34, aarch64 flags Related: rhbz#1991688