From: "Paul E. McKenney" <paulmck@kernel.org>
To: Paul Menzel <pmenzel@molgen.mpg.de>
Cc: Josh Triplett <josh@joshtriplett.org>,
Steven Rostedt <rostedt@goodmis.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Lai Jiangshan <jiangshanlai@gmail.com>,
Shuah Khan <shuah@kernel.org>, Zhouyi Zhou <zhouzhouyi@gmail.com>,
rcu@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] torture: Make thread detection more robust by using lspcu
Date: Tue, 22 Feb 2022 09:43:28 -0800 [thread overview]
Message-ID: <20220222174328.GL4285@paulmck-ThinkPad-P17-Gen-1> (raw)
In-Reply-To: <20220222120718.17141-2-pmenzel@molgen.mpg.de>
On Tue, Feb 22, 2022 at 01:07:17PM +0100, Paul Menzel wrote:
> For consecutive numbers *lscpu* 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 | sed -n -e '/^NUMA node0/s/^[^,]*,\([0-9]*\),.*$/\1/p'
> $
>
> (Before the last patch, the whole line was returned.)
>
> $ lscpu | grep '^NUMA node0' | sed -e 's/^[^,-]*(,|\-)\([0-9]*\),.*$/\1/'
> NUMA node0 CPU(s): 0-79
>
> *lscpu* shows the number of threads per core, so use that value directly.
>
> $ 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
>
> Note, the replaced heuristic is also incorrect for that case, where the
> threads per core are disabled.
>
> $ lscpu | sed -n -e '/^NUMA node0/s/^[^,]*,\([0-9]*\),.*$/\1/p'
> 8
>
> Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
Makes sense, and thank you for chasing this down and for the fix!
But should this patch and 1/2 be merged? Or am I confused and they
are somehow affecting two different lines of scripting?
Thanx, Paul
> ---
> tools/testing/selftests/rcutorture/bin/functions.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/rcutorture/bin/functions.sh b/tools/testing/selftests/rcutorture/bin/functions.sh
> index 5cff520955e6..66d0414d8e4b 100644
> --- a/tools/testing/selftests/rcutorture/bin/functions.sh
> +++ b/tools/testing/selftests/rcutorture/bin/functions.sh
> @@ -301,7 +301,7 @@ specify_qemu_cpus () {
> echo $2 -smp $3
> ;;
> qemu-system-ppc64)
> - nt="`lscpu | sed -n -e '/^NUMA node0/s/^[^,]*,\([0-9]*\),.*$/\1/p'`"
> + nt="`lscpu | sed -n 's/^Thread(s) per core:\s*//p'`"
> echo $2 -smp cores=`expr \( $3 + $nt - 1 \) / $nt`,threads=$nt
> ;;
> esac
> --
> 2.35.1
>
next prev parent reply other threads:[~2022-02-22 17:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-22 12:07 [PATCH 1/2] torture: Select line in sed and replace grep Paul Menzel
2022-02-22 12:07 ` [PATCH 2/2] torture: Make thread detection more robust by using lspcu Paul Menzel
2022-02-22 17:43 ` Paul E. McKenney [this message]
2022-02-24 8:24 ` Paul Menzel
2022-02-24 20:56 ` Paul E. McKenney
2022-02-25 5:49 ` Paul Menzel
2022-02-25 20:45 ` Paul E. McKenney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220222174328.GL4285@paulmck-ThinkPad-P17-Gen-1 \
--to=paulmck@kernel.org \
--cc=jiangshanlai@gmail.com \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=pmenzel@molgen.mpg.de \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=shuah@kernel.org \
--cc=zhouzhouyi@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®