All of lore.kernel.org
 help / color / mirror / Atom feed
* rcutorture: Question about `specify_qemu_cpus()` and qemu-system-ppc64
@ 2022-02-16  9:06 Paul Menzel
  0 siblings, 0 replies; only message in thread
From: Paul Menzel @ 2022-02-16  9:06 UTC (permalink / raw)
  To: Paul E. McKenney, Josh Triplett; +Cc: rcu, Zhouyi Zhou

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?

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-02-16  9:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-16  9:06 rcutorture: Question about `specify_qemu_cpus()` and qemu-system-ppc64 Paul Menzel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.