SHA256
8
0
forked from pool/hwloc

1 Commits

Author SHA256 Message Date
dda6614b7b Sync changes to SLFO-1.2 branch 2025-08-20 09:25:45 +02:00
3 changed files with 31 additions and 98 deletions

View File

@@ -1,54 +0,0 @@
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,12 +1,5 @@
-------------------------------------------------------------------
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>
Thu Feb 13 16:25:01 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.
@@ -54,9 +47,6 @@ Tue Jan 7 08:56:48 UTC 2025 - Thomas Blume <Thomas.Blume@suse.com>
+ 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>
- update to 2.10.0:
Heterogeneous Memory core improvements
+ Better heuristics to identify the subtype of memory such

View File

@@ -1,7 +1,7 @@
#
# spec file for package hwloc
#
# Copyright (c) 2025 SUSE LLC
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -35,8 +35,6 @@ Summary: Portable Hardware Locality
License: BSD-3-Clause
URL: https://www.open-mpi.org/projects/hwloc/
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: automake
BuildRequires: doxygen
@@ -139,7 +137,6 @@ HW accelerators from AMD and NVIDIA
%prep
%setup -q
%autopatch -p1
%build
autoreconf -fvi