Linux RCU subsystem development
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@kernel.org>
To: rcu@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com,
	rostedt@goodmis.org, "Paul E. McKenney" <paulmck@kernel.org>
Subject: [PATCH rcu 02/11] rcutorture: Add a test_boost_holdoff module parameter
Date: Thu, 16 Jan 2025 12:24:25 -0800	[thread overview]
Message-ID: <20250116202434.3783613-2-paulmck@kernel.org> (raw)
In-Reply-To: <c4864e07-93b8-4bc9-80fd-62b00a64e329@paulmck-laptop>

This commit adds a test_boost_holdoff module parameter that tells the RCU
priority-boosting tests to wait for the specified number of seconds past
the start of the rcutorture test.  This can be useful when rcutorture
is built into the kernel (as opposed to being modprobed), especially on
large systems where early start of RCU priority boosting can delay the
boot sequence, which adds a full CPU's worth of load onto the system.
This can in turn result in pointless stall warnings.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 .../admin-guide/kernel-parameters.txt         |  5 +++++
 kernel/rcu/rcutorture.c                       | 19 ++++++++++++++++---
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 3152f2c1da294..d6c3f9d9d3a73 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -5592,6 +5592,11 @@
 	rcutorture.test_boost_duration= [KNL]
 			Duration (s) of each individual boost test.
 
+	rcutorture.test_boost_holdoff= [KNL]
+			Holdoff time (s) from start of test to the start
+			of RCU priority-boost testing.	Defaults to zero,
+			that is, no holdoff.
+
 	rcutorture.test_boost_interval= [KNL]
 			Interval (s) between each boost test.
 
diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index 1bd3eaa0b8e7a..9788933984655 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -135,6 +135,7 @@ torture_param(int, stat_interval, 60, "Number of seconds between stats printk()s
 torture_param(int, stutter, 5, "Number of seconds to run/halt test");
 torture_param(int, test_boost, 1, "Test RCU prio boost: 0=no, 1=maybe, 2=yes.");
 torture_param(int, test_boost_duration, 4, "Duration of each boost test, seconds.");
+torture_param(int, test_boost_holdoff, 0, "Holdoff time from rcutorture start, seconds.");
 torture_param(int, test_boost_interval, 7, "Interval between boost tests, seconds.");
 torture_param(int, test_nmis, 0, "End-test NMI tests, 0 to disable.");
 torture_param(bool, test_no_idle_hz, true, "Test support for tickless idle CPUs");
@@ -1159,8 +1160,19 @@ static int rcu_torture_boost(void *arg)
 	unsigned long gp_state;
 	unsigned long gp_state_time;
 	unsigned long oldstarttime;
+	unsigned long booststarttime = get_torture_init_jiffies() + test_boost_holdoff * HZ;
 
-	VERBOSE_TOROUT_STRING("rcu_torture_boost started");
+	if (test_boost_holdoff <= 0 || time_after(jiffies, booststarttime)) {
+		VERBOSE_TOROUT_STRING("rcu_torture_boost started");
+	} else {
+		VERBOSE_TOROUT_STRING("rcu_torture_boost started holdoff period");
+		while (time_before(jiffies, booststarttime)) {
+			schedule_timeout_idle(HZ);
+			if (kthread_should_stop())
+				goto cleanup;
+		}
+		VERBOSE_TOROUT_STRING("rcu_torture_boost finished holdoff period");
+	}
 
 	/* Set real-time priority. */
 	sched_set_fifo_low(current);
@@ -1236,6 +1248,7 @@ checkwait:	if (stutter_wait("rcu_torture_boost"))
 			sched_set_fifo_low(current);
 	} while (!torture_must_stop());
 
+cleanup:
 	/* Clean up and exit. */
 	while (!kthread_should_stop()) {
 		torture_shutdown_absorb("rcu_torture_boost");
@@ -2523,7 +2536,7 @@ rcu_torture_print_module_parms(struct rcu_torture_ops *cur_ops, const char *tag)
 		 "shuffle_interval=%d stutter=%d irqreader=%d "
 		 "fqs_duration=%d fqs_holdoff=%d fqs_stutter=%d "
 		 "test_boost=%d/%d test_boost_interval=%d "
-		 "test_boost_duration=%d shutdown_secs=%d "
+		 "test_boost_duration=%d test_boost_holdoff=%d shutdown_secs=%d "
 		 "stall_cpu=%d stall_cpu_holdoff=%d stall_cpu_irqsoff=%d "
 		 "stall_cpu_block=%d stall_cpu_repeat=%d "
 		 "n_barrier_cbs=%d "
@@ -2537,7 +2550,7 @@ rcu_torture_print_module_parms(struct rcu_torture_ops *cur_ops, const char *tag)
 		 stat_interval, verbose, test_no_idle_hz, shuffle_interval,
 		 stutter, irqreader, fqs_duration, fqs_holdoff, fqs_stutter,
 		 test_boost, cur_ops->can_boost,
-		 test_boost_interval, test_boost_duration, shutdown_secs,
+		 test_boost_interval, test_boost_duration, test_boost_holdoff, shutdown_secs,
 		 stall_cpu, stall_cpu_holdoff, stall_cpu_irqsoff,
 		 stall_cpu_block, stall_cpu_repeat,
 		 n_barrier_cbs,
-- 
2.40.1


  parent reply	other threads:[~2025-01-16 20:24 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-16 20:24 [PATCH rcu 0/11] Torture-test updates Paul E. McKenney
2025-01-16 20:24 ` [PATCH rcu 01/11] torture: Add get_torture_init_jiffies() for test-start time Paul E. McKenney
2025-01-16 20:24 ` Paul E. McKenney [this message]
2025-01-16 20:24 ` [PATCH rcu 03/11] rcutorture: Include grace-period sequence numbers in failure/close-call Paul E. McKenney
2025-01-16 20:24 ` [PATCH rcu 04/11] rcutorture: Expand failure/close-call grace-period output Paul E. McKenney
2025-01-16 20:24 ` [PATCH rcu 05/11] rcu: Trace expedited grace-period numbers in hexadecimal Paul E. McKenney
2025-01-16 20:24 ` [PATCH rcu 06/11] rcutorture: Add ftrace-compatible timestamp to GP# failure/close-call output Paul E. McKenney
2025-01-16 20:24 ` [PATCH rcu 07/11] rcutorture: Make cur_ops->format_gp_seqs take buffer length Paul E. McKenney
2025-01-16 20:24 ` [PATCH rcu 08/11] rcutorture: Move RCU_TORTURE_TEST_{CHK_RDR_STATE,LOG_CPU} to bool Paul E. McKenney
2025-01-16 20:24 ` [PATCH rcu 09/11] rcutorture: Complain when invalid SRCU reader_flavor is specified Paul E. McKenney
2025-01-16 20:24 ` [PATCH rcu 10/11] srcu: Add FORCE_NEED_SRCU_NMI_SAFE Kconfig for testing Paul E. McKenney
2025-01-16 20:24 ` [PATCH rcu 11/11] torture: Make SRCU lockdep testing use srcu_read_lock_nmisafe() Paul E. McKenney
2025-01-30 19:04 ` [PATCH rcu 0/11] Torture-test updates Paul E. McKenney
2025-01-30 19:04   ` [PATCH rcu v2] 01/11] torture: Add get_torture_init_jiffies() for test-start time Paul E. McKenney
2025-01-30 19:04   ` [PATCH rcu v2] 02/11] rcutorture: Add a test_boost_holdoff module parameter Paul E. McKenney
2025-01-30 19:04   ` [PATCH rcu v2] 03/11] rcutorture: Include grace-period sequence numbers in failure/close-call Paul E. McKenney
2025-01-30 19:04   ` [PATCH rcu v2] 04/11] rcutorture: Expand failure/close-call grace-period output Paul E. McKenney
2025-01-30 19:04   ` [PATCH rcu v2] 05/11] rcu: Trace expedited grace-period numbers in hexadecimal Paul E. McKenney
2025-01-30 19:04   ` [PATCH rcu v2] 06/11] rcutorture: Add ftrace-compatible timestamp to GP# failure/close-call output Paul E. McKenney
2025-01-30 19:04   ` [PATCH rcu v2] 07/11] rcutorture: Make cur_ops->format_gp_seqs take buffer length Paul E. McKenney
2025-01-30 19:04   ` [PATCH rcu v2] 08/11] rcutorture: Move RCU_TORTURE_TEST_{CHK_RDR_STATE,LOG_CPU} to bool Paul E. McKenney
2025-01-30 19:04   ` [PATCH rcu v2] 09/11] rcutorture: Complain when invalid SRCU reader_flavor is specified Paul E. McKenney
2025-01-30 19:04   ` [PATCH rcu v2] 10/11] srcu: Add FORCE_NEED_SRCU_NMI_SAFE Kconfig for testing Paul E. McKenney
2025-01-30 19:04   ` [PATCH rcu v2] 11/11] torture: Make SRCU lockdep testing use srcu_read_lock_nmisafe() Paul E. McKenney
  -- strict thread matches above, loose matches on Subject: below --
2025-02-19 15:39 [PATCH rcu 00/11] RCU torture changes for v6.15 Boqun Feng
2025-02-19 15:39 ` [PATCH rcu 02/11] rcutorture: Add a test_boost_holdoff module parameter Boqun Feng

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=20250116202434.3783613-2-paulmck@kernel.org \
    --to=paulmck@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rcu@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /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