SHA256
1
0
forked from pool/hwloc

4 Commits

5 changed files with 120 additions and 7 deletions

View File

@@ -0,0 +1,54 @@
From 77495cecad7178ccd73ad4962780328f079a0e65 Mon Sep 17 00:00:00 2001
From: Brice Goglin <Brice.Goglin@inria.fr>
Date: Thu, 24 Apr 2025 09:08:08 +0200
Subject: [PATCH] x86: work around legacy_max_proc being 0 while HTT feature
bit is set
The Intel manual says that legacy_max_proc (CPUID.1.EBX[16-23]) is valid
if CPUID.1.EDX.HTT[bit 28] is set.
AMD (at least recent ones) don't say anything about it being invalid.
Unfortunately some Qemu config may keep the former at 0 with the latter set.
At least this happens when libvirt passes -cpu EPYC-Rome,ht=on to Qemu
(which sets the HTT bit), and -smp 32,maxcpus=48,sockets=48,cores=1,threads=1
says each CPU is single threaded (which keeps legacy_max_log_proc to 0).
This config comes from https://bugzilla.opensuse.org/show_bug.cgi?id=1236038
Calling flsl on this invalid mask leads to undefined behavior and some division
by zero later (depending on the compiler).
Check whether legacy_max_proc is 0 before using it.
If 0, assume legacy_max_log_proc is 1, just like we did when HTT is unset.
Thanks to Georg Pfuetzenreuter for the report
and Anthony Iliopoulos for the debugging.
Refs #714
Signed-off-by: Brice Goglin <Brice.Goglin@inria.fr>
---
hwloc/topology-x86.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/hwloc/topology-x86.c b/hwloc/topology-x86.c
index a267ded49..5f63fc178 100644
--- a/hwloc/topology-x86.c
+++ b/hwloc/topology-x86.c
@@ -653,7 +653,13 @@ static void look_proc(struct hwloc_backend *backend, struct procinfo *infos, uns
cpuid_or_from_dump(&eax, &ebx, &ecx, &edx, src_cpuiddump);
infos->apicid = ebx >> 24;
if (edx & (1 << 28)) {
- legacy_max_log_proc = 1 << hwloc_flsl(((ebx >> 16) & 0xff) - 1);
+ unsigned ebx_16_23 = (ebx >> 16) & 0xff;
+ if (ebx_16_23) {
+ legacy_max_log_proc = 1 << hwloc_flsl(ebx_16_23 - 1);
+ } else {
+ hwloc_debug("HTT bit set in CPUID 0x01.edx, but legacy_max_proc = 0 in ebx, assuming legacy_max_log_proc = 1\n");
+ legacy_max_log_proc = 1;
+ }
} else {
hwloc_debug("HTT bit not set in CPUID 0x01.edx, assuming legacy_max_log_proc = 1\n");
legacy_max_log_proc = 1;
--
2.48.1

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0305dd60c9de2fbe6519fe2a4e8fdc6d3db8de574a0ca7812b92e80c05ae1392
size 5548699

BIN
hwloc-2.11.2.tar.bz2 (Stored with Git LFS) Normal file

Binary file not shown.

View File

@@ -1,3 +1,59 @@
-------------------------------------------------------------------
Mon Apr 28 07:32:19 UTC 2025 - Thomas Blume <Thomas.Blume@suse.com>
- fix division by zero exception with recent versions of GCC
(bsc#1236038)
* add 0001-x86-work-around-legacy_max_proc-being-0-while-HTT-fe.patch
-------------------------------------------------------------------
Tue Jan 7 08:56:48 UTC 2025 - Thomas Blume <Thomas.Blume@suse.com>
- update to 2.11.2 (jsc#PED-11875)
* Add missing CPU info attrs on aarch64 on Linux.
* Use ACPI CPPC on Linux to get better information about cpukinds,
at least on AMD CPUs.
* Fix crash when manipulating cpukinds after topology
duplication.
* Fix missing input target checks in memattr functions
* Fix a memory leak when ignoring NUMA distances on FreeBSD.
* Fix build failure on old Linux distributions without accessat().
* Fix non-Windows importing of XML topologies and CPUID dumps exported
on Windows.
* hwloc-calc --cpuset-output-format systemd-dbus-api now allows.
to generate AllowedCPUs information for systemd slices.
See the hwloc-calc manpage for examples.
* Some fixes in manpage EXAMPLES and split them into subsections.
* Fix bash completions
* API
+ Add HWLOC_MEMBIND_WEIGHTED_INTERLEAVE memory binding policy on
Linux 6.9+.
- weighted_interleave_membind is added to membind support bits.
- The "weighted" policy is added to the hwloc-bind tool.
+ Add hwloc_obj_set_subtype().
* GPU support
+ Don't hide the GPU NUMA node on NVIDIA Grace Hopper.
+ Get Intel GPU OpenCL device locality.
+ Add bandwidths between subdevices in the LevelZero XeLinkBandwidth
matrix.
+ Fix PCI Gen4+ link speed of NVIDIA GPU obtained from NVML.
* Tools
+ Option --best-memattr may now return multiple nodes. Additional
configuration flags may be given to tweak its behavior.
+ hwloc-info has a new --get-attr option to get a single attribute.
+ hwloc-info now supports "levels", "support" and "topology"
special keywords for backward compatibility for hwloc 3.0.
+ The --taskset command-line option is superseded by the new
--cpuset-output-format which also allows to export as list.
+ hwloc-calc may now import bitmasks described as a list of bits
with the new "--cpuset-input-format list".
* Misc
+ The MemoryTiersNr info attribute in the root object now says how many
memory tiers were built.
+ Fix the management of infinite cpusets in the bitmap printf/sscanf
API as well as in command-line tools.
+ Add section "Compiling software on top of hwloc's C API" in the
documentation with examples for GNU Make and CMake.
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Dec 27 19:01:59 UTC 2023 - Dirk Müller <dmueller@suse.com> Wed Dec 27 19:01:59 UTC 2023 - Dirk Müller <dmueller@suse.com>

View File

@@ -1,7 +1,7 @@
# #
# spec file for package hwloc # spec file for package hwloc
# #
# Copyright (c) 2023 SUSE LLC # Copyright (c) 2025 SUSE LLC
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@@ -29,12 +29,14 @@
%global lname libhwloc15 %global lname libhwloc15
Name: hwloc Name: hwloc
Version: 2.10.0 Version: 2.11.2
Release: 0 Release: 0
Summary: Portable Hardware Locality Summary: Portable Hardware Locality
License: BSD-3-Clause License: BSD-3-Clause
URL: https://www.open-mpi.org/projects/hwloc/ URL: https://www.open-mpi.org/projects/hwloc/
Source0: https://download.open-mpi.org/release/hwloc/v2.10/hwloc-%{version}.tar.bz2 Source0: https://download.open-mpi.org/release/hwloc/v2.11/hwloc-%{version}.tar.bz2
Patch0: 0001-x86-work-around-legacy_max_proc-being-0-while-HTT-fe.patch
BuildRequires: autoconf BuildRequires: autoconf
BuildRequires: automake BuildRequires: automake
BuildRequires: doxygen BuildRequires: doxygen
@@ -137,6 +139,7 @@ HW accelerators from AMD and NVIDIA
%prep %prep
%setup -q %setup -q
%autopatch -p1
%build %build
autoreconf -fvi autoreconf -fvi