Skip to content

Commit 8b22aea

Browse files
committed
gather-topology: bring back /proc/device-tree/cpus if --dt is given
May be useful for debugging what Linux exposes in sysfs, at least on ARM. This reverts commit 9f37aae and adds conditionals on top of the old code. Signed-off-by: Brice Goglin <[email protected]>
1 parent 4960975 commit 8b22aea

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

contrib/completion/bash/hwloc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,7 @@ complete -F _hwloc_gather_cpuid hwloc-gather-cpuid
555555
_hwloc_gather_topology(){
556556
local OPTIONS=(--io
557557
--dmi
558+
--dt
558559
--no-cpuid
559560
--keep
560561
--version

utils/hwloc/hwloc-gather-topology.1in

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.\" -*- nroff -*-
22
.\" Copyright © 2010 Jirka Hladky
3-
.\" Copyright © 2010-2021 Inria. All rights reserved.
3+
.\" Copyright © 2010-2023 Inria. All rights reserved.
44
.\" See COPYING in top-level directory.
55
.TH HWLOC-GATHER-TOPOLOGY "1" "%HWLOC_DATE%" "%PACKAGE_VERSION%" "%PACKAGE_NAME%"
66
.SH NAME
@@ -30,6 +30,11 @@ Also gather DMI/SMBIOS related files.
3030
The gathering requires root access, and the dmi-sysfs kernel module should be loaded.
3131
.
3232
.TP
33+
\fB\-\-dt\fR
34+
Also gather Device-Tree CPU files. These files aren't needed for hwloc,
35+
but they may be used for debugging what Linux exposes in /sys.
36+
.
37+
.TP
3338
\fB\-\-no\-cpuid\fR
3439
Do not gather x86 CPUID dump using \fIhwloc\-gather\-cpuid\fR.
3540
.

utils/hwloc/hwloc-gather-topology.in

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ unalias ls
3131
gathercpuid=1
3232
gatherio=0
3333
gatherdmi=0
34+
gatherdt=0
3435
keep=0
3536

3637
if [ ! -x "$lstopo" ]
@@ -52,6 +53,7 @@ usage()
5253
echo "Options:"
5354
echo " --io Gather I/O files (takes much longer and generates much larger tarball)"
5455
echo " --dmi Gather SMBIOS files. Works only when run as root. Requires dmi-sysfs kernel module"
56+
echo " --dt Gather Device-Tree CPU files under /proc/device-tree/cpus"
5557
echo " --no-cpuid Do not gather x86 CPUID using hwloc-gather-cpuid"
5658
echo " --keep Keep the temporary copy of dumped files"
5759
echo " --version Report version and exit"
@@ -64,6 +66,7 @@ while [ x`echo "$1" | cut -c1` = x- ] ; do
6466
case $1 in
6567
--io) gatherio=1;;
6668
--dmi) gatherdmi=1;;
69+
--dt) gatherdt=1;;
6770
--no-cpuid) gathercpuid=0;;
6871
--keep) keep=1;;
6972
--version) echo `basename $0`" $HWLOC_VERSION"; exit 0;;
@@ -87,6 +90,9 @@ fi
8790
if [ x$gatherdmi = x0 ]; then
8891
echo "DMI files won't be saved (--dmi not given)."
8992
fi
93+
if [ x$gatherdt = x0 ]; then
94+
echo "Device-Tree CPU files won't be saved (--dt not given)."
95+
fi
9096

9197
echo
9298
echo "*** Note that this tool may be slow on large nodes or when I/O is enabled. ***"
@@ -249,6 +255,11 @@ savedir "$destdir/$basename" /sys/devices/virtual/dmi/id/
249255
# Gather hugepage information
250256
savedir "$destdir/$basename" /sys/kernel/mm/hugepages/
251257

258+
if [ x$gatherdt = x1 ]; then
259+
# Gather device-tree cpus
260+
savedir "$destdir/$basename" /proc/device-tree/cpus/
261+
fi
262+
252263
# Gather the default /var/run/hwloc (in case it was created by a system-wide hwloc-dump-hwdata)
253264
if test -d /var/run/hwloc; then
254265
savedir "$destdir/$basename" /var/run/hwloc

0 commit comments

Comments
 (0)