mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: mingo@kernel.org, jiangshanlai@gmail.com, dipankar@in.ibm.com,
	akpm@linux-foundation.org, mathieu.desnoyers@efficios.com,
	josh@joshtriplett.org, tglx@linutronix.de, peterz@infradead.org,
	rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com,
	fweisbec@gmail.com, oleg@redhat.com,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Subject: [PATCH tip/core/rcu 09/13] rcutorture: Use nr_cpus rather than maxcpus to limit test size
Date: Mon, 24 Jul 2017 15:23:39 -0700	[thread overview]
Message-ID: <1500935023-16620-9-git-send-email-paulmck@linux.vnet.ibm.com> (raw)
In-Reply-To: <20170724222326.GA15933@linux.vnet.ibm.com>

The maxcpus= kernel boot parameter limits the number of CPUs brought
online at boot time, but it does nothing to prevent additional CPUs
from being brought up later.  Placing a hard cap on the total number
of CPUs is instead the job of the nr_cpus= boot parameter.  This commit
therefore switches the configfrag_boot_cpus() shell function from maxcpus=
to nr_cpus=.  This commit also adds a nr_cpus=43 kernel parameter to RCU's
TREE01 test scenario, but retains the maxcpus=8 kernel parameter in order
to test the ability of RCU expedited grace periods to handle new CPUs
coming online for the first time during grace-period initialization.
Finally, this commit makes the torture scheduling allow maxcpus= to
override other means of specifying the number of CPUs to allow for.
This last works because the torture kernel modules size their workloads
based on the number of CPUs present at the start of the test, not the
ultimate number of CPUs.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 .../testing/selftests/rcutorture/bin/functions.sh  | 27 +++++++++++++++++++++-
 tools/testing/selftests/rcutorture/bin/kvm.sh      |  1 +
 .../selftests/rcutorture/configs/rcu/TREE01.boot   |  2 +-
 3 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/bin/functions.sh b/tools/testing/selftests/rcutorture/bin/functions.sh
index 1426a9b97494..07a13779eece 100644
--- a/tools/testing/selftests/rcutorture/bin/functions.sh
+++ b/tools/testing/selftests/rcutorture/bin/functions.sh
@@ -66,9 +66,34 @@ configfrag_boot_params () {
 
 # configfrag_boot_cpus bootparam-string config-fragment-file config-cpus
 #
-# Decreases number of CPUs based on any maxcpus= boot parameters specified.
+# Decreases number of CPUs based on any nr_cpus= boot parameters specified.
 configfrag_boot_cpus () {
 	local bootargs="`configfrag_boot_params "$1" "$2"`"
+	local nr_cpus
+	if echo "${bootargs}" | grep -q 'nr_cpus=[0-9]'
+	then
+		nr_cpus="`echo "${bootargs}" | sed -e 's/^.*nr_cpus=\([0-9]*\).*$/\1/'`"
+		if test "$3" -gt "$nr_cpus"
+		then
+			echo $nr_cpus
+		else
+			echo $3
+		fi
+	else
+		echo $3
+	fi
+}
+
+# configfrag_boot_maxcpus bootparam-string config-fragment-file config-cpus
+#
+# Decreases number of CPUs based on any maxcpus= boot parameters specified.
+# This allows tests where additional CPUs come online later during the
+# test run.  However, the torture parameters will be set based on the
+# number of CPUs initially present, so the scripting should schedule
+# test runs based on the maxcpus= boot parameter controlling the initial
+# number of CPUs instead of on the ultimate number of CPUs.
+configfrag_boot_maxcpus () {
+	local bootargs="`configfrag_boot_params "$1" "$2"`"
 	local maxcpus
 	if echo "${bootargs}" | grep -q 'maxcpus=[0-9]'
 	then
diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh b/tools/testing/selftests/rcutorture/bin/kvm.sh
index cdb32aa79366..b55895fb10ed 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm.sh
@@ -212,6 +212,7 @@ do
 	then
 		cpu_count=`configNR_CPUS.sh $CONFIGFRAG/$CF1`
 		cpu_count=`configfrag_boot_cpus "$TORTURE_BOOTARGS" "$CONFIGFRAG/$CF1" "$cpu_count"`
+		cpu_count=`configfrag_boot_maxcpus "$TORTURE_BOOTARGS" "$CONFIGFRAG/$CF1" "$cpu_count"`
 		for ((cur_rep=0;cur_rep<$config_reps;cur_rep++))
 		do
 			echo $CF1 $cpu_count >> $T/cfgcpu
diff --git a/tools/testing/selftests/rcutorture/configs/rcu/TREE01.boot b/tools/testing/selftests/rcutorture/configs/rcu/TREE01.boot
index 1d14e1383016..9f3a4d28e508 100644
--- a/tools/testing/selftests/rcutorture/configs/rcu/TREE01.boot
+++ b/tools/testing/selftests/rcutorture/configs/rcu/TREE01.boot
@@ -1,4 +1,4 @@
-rcutorture.torture_type=rcu_bh maxcpus=8
+rcutorture.torture_type=rcu_bh maxcpus=8 nr_cpus=43
 rcutree.gp_preinit_delay=3
 rcutree.gp_init_delay=3
 rcutree.gp_cleanup_delay=3
-- 
2.5.2

  parent reply	other threads:[~2017-07-24 22:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-24 22:23 [PATCH tip/core/rcu 0/13] Torture-test updates Paul E. McKenney
2017-07-24 22:23 ` [PATCH tip/core/rcu 01/13] rcutorture: Move SRCU status printing to SRCU implementations Paul E. McKenney
2017-07-24 22:23 ` [PATCH tip/core/rcu 02/13] rcutorture: Print SRCU lock/unlock totals Paul E. McKenney
2017-07-24 22:23 ` [PATCH tip/core/rcu 03/13] rcu: Remove CONFIG_TASKS_RCU ifdef from rcuperf.c Paul E. McKenney
2017-07-24 22:23 ` [PATCH tip/core/rcu 04/13] rcutorture: Select CONFIG_PROVE_LOCKING for Tiny SRCU scenario Paul E. McKenney
2017-07-24 22:23 ` [PATCH tip/core/rcu 05/13] torture: Add --kconfig argument to kvm.sh Paul E. McKenney
2017-07-24 22:23 ` [PATCH tip/core/rcu 06/13] rcutorture: Don't wait for kernel when all builds fail Paul E. McKenney
2017-07-24 22:23 ` [PATCH tip/core/rcu 07/13] rcutorture: Enable SRCU readers from timer handler Paul E. McKenney
2017-07-24 22:23 ` [PATCH tip/core/rcu 08/13] rcutorture: Place event-traced strings into trace buffer Paul E. McKenney
2017-07-24 22:23 ` Paul E. McKenney [this message]
2017-07-24 22:23 ` [PATCH tip/core/rcu 10/13] rcutorture: Add task's CPU for rcutorture writer stalls Paul E. McKenney
2017-07-24 22:23 ` [PATCH tip/core/rcu 11/13] rcutorture: Eliminate unused ts_rem local from rcu_trace_clock_local() Paul E. McKenney
2017-07-24 22:23 ` [PATCH tip/core/rcu 12/13] rcu: Add last-CPU to GP-kthread starvation messages Paul E. McKenney
2017-07-24 22:23 ` [PATCH tip/core/rcu 13/13] rcutorture: Invoke call_rcu() from timer handler 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=1500935023-16620-9-git-send-email-paulmck@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=dhowells@redhat.com \
    --cc=dipankar@in.ibm.com \
    --cc=edumazet@google.com \
    --cc=fweisbec@gmail.com \
    --cc=jiangshanlai@gmail.com \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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®