Dear Linux folks,
`tools/testing/selftests/rcutorture/bin/functions.sh` contains:
```
# specify_qemu_cpus qemu-cmd qemu-args #cpus
#
# Appends a string containing "-smp XXX" to qemu-args, unless the incoming
# qemu-args already contains "-smp".
specify_qemu_cpus () {
local nt;
if echo $2 | grep -q -e -smp
then
echo $2
else
case "$1" in
qemu-system-x86_64|qemu-system-i386|qemu-system-aarch64)
echo $2 -smp $3
;;
qemu-system-ppc64)
nt="`lscpu | grep '^NUMA node0' | sed -e
's/^[^,]*,\([0-9]*\),.*$/\1/'`"
echo $2 -smp cores=`expr \( $3 + $nt - 1 \) /
$nt`,threads=$nt
;;
esac
fi
}
```
`lscpu` collapses(?) if all numbers are consecutive:
$ lscpu | grep '^NUMA node0'
NUMA node0 CPU(s): 0-79
Currently, the second number is taken to find out the number of threads.
`lscpu` contains a separate line containing the thread number though:
$ lscpu | grep 'Thread'
Thread(s) per core: 8
Could that be used instead?
Kind regards,
Paul
PS: Out of curiosity, what is `expr \( $3 + $nt - 1 \) / $nt` supposed
to do? $3 contains the arguments of CPU number. If that should be the
number of (total) threads, then it rounds it up?