linux/tools/testing/selftests/rcutorture
Paul Menzel 8e82c28ea2 torture: Make thread detection more robust by using lspcu
For consecutive numbers the lscpu command collapses the output and just
shows the range with start and end. The processors are numbered that
way on POWER8.

    $ sudo ppc64_cpu --smt=8
    $ lscpu | grep '^NUMA node'
    NUMA node(s):                    2
    NUMA node0 CPU(s):               0-79
    NUMA node8 CPU(s):               80-159

This causes the heuristic to detect the number threads per core, looking
for the number after the first comma, to fail, and QEMU aborts because of
invalid arguments.

    $ lscpu | grep '^NUMA node0' | sed -e 's/^[^,-]*(,|\-)\([0-9]*\),.*$/\1/'
    NUMA node0 CPU(s):               0-79

But the lscpu command shows the number of threads per core:

    $ sudo ppc64_cpu --smt=8
    $ lscpu | grep 'Thread(s) per core'
    Thread(s) per core:              8
    $ sudo ppc64_cpu --smt=off
    $ lscpu | grep 'Thread(s) per core'
    Thread(s) per core:              1

This commit therefore directly uses that value and replaces use of grep
with "sed -n" and its "p" command.

Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2022-04-11 17:08:59 -07:00
..
bin torture: Make thread detection more robust by using lspcu 2022-04-11 17:08:59 -07:00
configs rcutorture: Provide non-power-of-two Tasks RCU scenarios 2022-02-08 11:19:15 -08:00
doc rcu: Remove the RCU_FAST_NO_HZ Kconfig option 2021-11-30 17:24:47 -08:00
formal/srcu-cbmc rcu: Fix various typos in comments 2021-05-12 12:11:05 -07:00
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
Makefile rcutorture: Provide rudimentary Makefile 2019-05-28 09:06:09 -07:00