fix division by zero exception with recent versions of GCC (bsc#1236038)
OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/hwloc?expand=0&rev=74
This commit is contained in:
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
## Default LFS
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.osc
|
@@ -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
|
||||
|
5
_service
Normal file
5
_service
Normal file
@@ -0,0 +1,5 @@
|
||||
<services>
|
||||
<service name="download_files" mode="localonly">
|
||||
<param name="enforceupstream">yes</param>
|
||||
</service>
|
||||
</services>
|
3
hwloc-2.10.0.tar.bz2
Normal file
3
hwloc-2.10.0.tar.bz2
Normal file
@@ -0,0 +1,3 @@
|
||||
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
BIN
hwloc-2.11.2.tar.bz2
(Stored with Git LFS)
Normal file
Binary file not shown.
1173
hwloc.changes
Normal file
1173
hwloc.changes
Normal file
File diff suppressed because it is too large
Load Diff
270
hwloc.spec
Normal file
270
hwloc.spec
Normal file
@@ -0,0 +1,270 @@
|
||||
#
|
||||
# spec file for package hwloc
|
||||
#
|
||||
# Copyright (c) 2025 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
# upon. The license for this file, and modifications and additions to the
|
||||
# file, is the same license as for the pristine package itself (unless the
|
||||
# license for the pristine package is not an Open Source License, in which
|
||||
# case the license is the MIT License). An "Open Source License" is a
|
||||
# license that conforms to the Open Source Definition (Version 1.9)
|
||||
# published by the Open Source Initiative.
|
||||
|
||||
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
|
||||
%if 0%{?suse_version} > 1500
|
||||
%bcond_without XNVCtrl
|
||||
%else
|
||||
%bcond_with XNVCtrl
|
||||
%endif
|
||||
%if 0%{?sle_version} < 150600
|
||||
%bcond_with OpenCL
|
||||
%else
|
||||
%bcond_without OpenCL
|
||||
%endif
|
||||
|
||||
%global lname libhwloc15
|
||||
Name: hwloc
|
||||
Version: 2.11.2
|
||||
Release: 0
|
||||
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
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: libnuma-devel
|
||||
BuildRequires: libtool
|
||||
BuildRequires: ncurses-devel
|
||||
BuildRequires: perl
|
||||
BuildRequires: pkgconfig
|
||||
BuildRequires: systemd-rpm-macros
|
||||
BuildRequires: update-desktop-files
|
||||
BuildRequires: pkgconfig(cairo)
|
||||
BuildRequires: pkgconfig(libxml-2.0)
|
||||
BuildRequires: pkgconfig(pciaccess)
|
||||
BuildRequires: pkgconfig(x11)
|
||||
%if %{with XNVCtrl}
|
||||
BuildRequires: libXNVCtrl-devel
|
||||
%endif
|
||||
%if %{with OpenCL}
|
||||
BuildRequires: opencl-headers
|
||||
BuildRequires: pkgconfig(OpenCL)
|
||||
%endif
|
||||
Requires: %{lname} = %{version}-%{release}
|
||||
Requires: perl-JSON
|
||||
Requires: perl-base >= 5.18.2
|
||||
Requires(post): desktop-file-utils
|
||||
Requires(postun): desktop-file-utils
|
||||
%{?systemd_ordering}
|
||||
|
||||
%description
|
||||
The Portable Hardware Locality (hwloc) software package provides
|
||||
an abstraction (across OS, versions, architectures, ...)
|
||||
of the hierarchical topology of modern architectures, including
|
||||
NUMA memory nodes, shared caches, processor sockets, processor cores
|
||||
and processing units (logical processors or "threads"). It also gathers
|
||||
various system attributes such as cache and memory information. It primarily
|
||||
aims at helping applications with gathering information about modern
|
||||
computing hardware so as to exploit it accordingly and efficiently.
|
||||
|
||||
hwloc may display the topology in multiple convenient formats.
|
||||
It also offers a powerful programming interface (C API) to gather information
|
||||
about the hardware, bind processes, and much more.
|
||||
|
||||
%package gui
|
||||
Summary: Hwloc GUI tool
|
||||
Requires: %{name} = %{version}
|
||||
|
||||
%description gui
|
||||
Hwloc GUI visualization tool - requires X11
|
||||
|
||||
%package devel
|
||||
Summary: Headers and shared development libraries for hwloc
|
||||
Requires: %{lname} = %{version}
|
||||
Provides: libhwloc-devel = %{version}
|
||||
Obsoletes: libhwloc-devel < %{version}
|
||||
Obsoletes: libhwloc-devel = 0.0.0
|
||||
|
||||
%description devel
|
||||
This package contains the headers and shared object symbolic links
|
||||
for the hwloc.
|
||||
|
||||
%package -n %{lname}
|
||||
Summary: Runtime libraries for hwloc
|
||||
Requires: %{name}-data
|
||||
|
||||
%description -n %{lname}
|
||||
This package contains the run time libraries for hwloc.
|
||||
|
||||
%package data
|
||||
Summary: Run time data for hwloc
|
||||
BuildArch: noarch
|
||||
|
||||
%description data
|
||||
This package contains the run time data for the hwloc.
|
||||
|
||||
%package doc
|
||||
Summary: Documentation for hwloc
|
||||
BuildArch: noarch
|
||||
|
||||
%description doc
|
||||
This package contains the documentation for hwloc.
|
||||
|
||||
%package gl
|
||||
Summary: OpenGL Plugin for HWLOC (NVIDIA Only)
|
||||
Requires: hwloc
|
||||
|
||||
%description gl
|
||||
Plugin for HWLOC to detect and enumerate OpenGL devices. This works only
|
||||
for NVIDIA devices running the proprietary driver by using the NV-CONTROL
|
||||
X Window System extension.
|
||||
|
||||
%package opencl
|
||||
Summary: OpenCL Plugin for HWLOC
|
||||
Requires: hwloc
|
||||
|
||||
%description opencl
|
||||
Plugin for HWLOC to detect and enumerate OpenCL devices. It detects
|
||||
HW accelerators from AMD and NVIDIA
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%autopatch -p1
|
||||
|
||||
%build
|
||||
autoreconf -fvi
|
||||
# We let the supported components autodetect and mark those as plugins
|
||||
# which we don't want to have included statically - regardless available
|
||||
%configure \
|
||||
--disable-silent-rules \
|
||||
--enable-plugins=opencl,gl,cuda,levelzero,nvml,rsmi \
|
||||
--with-hwloc-plugins-path=%{_libdir}/hwloc
|
||||
%make_build
|
||||
|
||||
%install
|
||||
%make_install
|
||||
%suse_update_desktop_file -r lstopo System Monitor
|
||||
# We don't ship .la files.
|
||||
rm -rf %{buildroot}%{_libdir}/libhwloc.la
|
||||
|
||||
# documentation will be handled by % doc macro
|
||||
rm -rf %{buildroot}%{_datadir}/doc/
|
||||
# remove .la files for plugins
|
||||
rm -f %{buildroot}/%{_libdir}/hwloc/*.la
|
||||
|
||||
# This binary is built only for intel architectures
|
||||
%ifarch %{ix86} x86_64
|
||||
install -D -m 644 %{buildroot}%{_datadir}/hwloc/hwloc-dump-hwdata.service %{buildroot}%{_unitdir}/hwloc-dump-hwdata.service
|
||||
%endif
|
||||
rm %{buildroot}%{_datadir}/hwloc/hwloc-dump-hwdata.service
|
||||
|
||||
#remove headers for features we don't ship
|
||||
rm %{buildroot}%{_includedir}/hwloc/rsmi.h
|
||||
rm %{buildroot}%{_includedir}/hwloc/nvml.h
|
||||
rm %{buildroot}%{_includedir}/hwloc/levelzero.h
|
||||
rm %{buildroot}%{_includedir}/hwloc/cuda.h
|
||||
rm %{buildroot}%{_includedir}/hwloc/cudart.h
|
||||
%{!?with_XNVCtrl:rm %{buildroot}%{_includedir}/hwloc/gl.h}
|
||||
%{!?with_OpenCL:rm %{buildroot}%{_includedir}/hwloc/opencl.h}
|
||||
|
||||
%fdupes -s %{buildroot}/%{_mandir}/man1
|
||||
%fdupes -s %{buildroot}/%{_mandir}/man3
|
||||
%fdupes -s %{buildroot}/%{_mandir}/man7
|
||||
|
||||
%check
|
||||
#XXX: this is weird, but make check got broken by removing doxygen-doc/man above
|
||||
# the only one fix is to install documentation by hand, or to ignore check error
|
||||
%make_build check || :
|
||||
|
||||
%post -n %{lname} -p /sbin/ldconfig
|
||||
%postun -n %{lname} -p /sbin/ldconfig
|
||||
|
||||
%ifarch %{ix86} x86_64
|
||||
%pre
|
||||
%service_add_pre hwloc-dump-hwdata.service
|
||||
%endif
|
||||
|
||||
%post
|
||||
%ifarch %{ix86} x86_64
|
||||
%service_add_post hwloc-dump-hwdata.service
|
||||
%endif
|
||||
%desktop_database_post
|
||||
|
||||
%ifarch %{ix86} x86_64
|
||||
%preun
|
||||
%service_del_preun hwloc-dump-hwdata.service
|
||||
%endif
|
||||
|
||||
%postun
|
||||
%ifarch %{ix86} x86_64
|
||||
%service_del_postun hwloc-dump-hwdata.service
|
||||
%endif
|
||||
%desktop_database_postun
|
||||
|
||||
%files
|
||||
%license COPYING
|
||||
%doc NEWS README VERSION
|
||||
%if %{with OpenCL} || %{with XNVCtrl}
|
||||
%dir %{_libdir}/hwloc
|
||||
%endif
|
||||
%{_mandir}/man7/hwloc*
|
||||
%{_mandir}/man1/hwloc*
|
||||
%{_mandir}/man1/lstopo-no-graphics*
|
||||
%{_bindir}/hwloc*
|
||||
%{_bindir}/lstopo-no-graphics
|
||||
%{_datadir}/applications/*.desktop
|
||||
%{_datadir}/bash-completion/completions/%{name}
|
||||
%ifarch %{ix86} x86_64
|
||||
%attr(0755,root,root) %{_sbindir}/hwloc-dump-hwdata
|
||||
%{_unitdir}/hwloc-dump-hwdata.service
|
||||
%endif
|
||||
|
||||
%files gui
|
||||
%{_bindir}/lstopo
|
||||
%{_mandir}/man1/lstopo.*
|
||||
|
||||
%files devel
|
||||
%exclude %{_includedir}/hwloc/opencl.h
|
||||
%exclude %{_includedir}/hwloc/gl.h
|
||||
%{_includedir}/hwloc
|
||||
%{_includedir}/hwloc.h
|
||||
%{_libdir}/libhwloc.so
|
||||
%{_libdir}/pkgconfig/hwloc.pc
|
||||
|
||||
%files -n %{lname}
|
||||
%{_libdir}/libhwloc*so.*
|
||||
|
||||
%files data
|
||||
%dir %{_datadir}/hwloc
|
||||
%dir %{_datadir}/hwloc/hwloc-ps.www
|
||||
%{_datadir}/hwloc/hwloc.dtd
|
||||
%{_datadir}/hwloc/hwloc2-diff.dtd
|
||||
%{_datadir}/hwloc/hwloc2.dtd
|
||||
%{_datadir}/hwloc/hwloc-valgrind.supp
|
||||
%{_datadir}/hwloc/hwloc-ps.www/*
|
||||
|
||||
%if %{with OpenCL}
|
||||
%files opencl
|
||||
%{_libdir}/hwloc/hwloc_opencl.so
|
||||
%endif
|
||||
|
||||
%if %{with XNVCtrl}
|
||||
%files gl
|
||||
%{_libdir}/hwloc/hwloc_gl.so
|
||||
%endif
|
||||
|
||||
%files doc
|
||||
%doc ./doc/doxygen-doc/html/*
|
||||
%{_mandir}/man3/*
|
||||
|
||||
%changelog
|
Reference in New Issue
Block a user