Accepting request 1273668 from devel:libraries:c_c++
OBS-URL: https://build.opensuse.org/request/show/1273668 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/hwloc?expand=0&rev=34
This commit is contained in:
@@ -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
|
||||
|
@@ -1,3 +1,10 @@
|
||||
-------------------------------------------------------------------
|
||||
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>
|
||||
|
||||
|
@@ -35,6 +35,8 @@ 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
|
||||
@@ -137,6 +139,7 @@ HW accelerators from AMD and NVIDIA
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%autopatch -p1
|
||||
|
||||
%build
|
||||
autoreconf -fvi
|
||||
|
Reference in New Issue
Block a user