All of lore.kernel.org
 help / color / mirror / Atom feed
* Prototype patch to avoid TREE07 rcu_torture_writer() stalls
@ 2024-01-03 19:29 Paul E. McKenney
  2024-01-05 22:52 ` Frederic Weisbecker
  0 siblings, 1 reply; 6+ messages in thread
From: Paul E. McKenney @ 2024-01-03 19:29 UTC (permalink / raw)
  To: Frederic Weisbecker; +Cc: linux-kernel

Hello, Frederic,

You mentioned rcu_torture_writer() stall issues on TREE07.  Does the
patch shown below help?

If so, I predict that your bisection will converge on commit af19a2526cba9
("rcutorture: Add mid-sized stall to TREE07").

							Thanx, Paul

------------------------------------------------------------------------

commit 7e9794bb7017593da427f555e4e23da2d42744e5
Author: Paul E. McKenney <paulmck@kernel.org>
Date:   Wed Jan 3 10:59:25 2024 -0800

    rcutorture: Suppress rtort_pipe_count warnings until after stalls
    
    Currently, if rcu_torture_writer() sees fewer than ten grace periods
    having elapsed during a call to stutter_wait() that actually waited,
    the rtort_pipe_count warning is emitted.  This has worked well for
    a long time.  Except that the rcutorture TREE07 scenario now does a
    short-term 14-second RCU CPU stall, which can most definitely case
    false-positive rtort_pipe_count warnings.
    
    This commit therefore changes rcu_torture_writer() to compute the
    full expected holdoff and stall duration, and to refuse to report any
    rtort_pipe_count warnings until after all stalls have completed.
    
    Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
    Cc: Frederic Weisbecker <frederic@kernel.org>

diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index 50ac86a34876..b4317ef1b092 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -1372,9 +1372,13 @@ rcu_torture_writer(void *arg)
 	struct rcu_torture *rp;
 	struct rcu_torture *old_rp;
 	static DEFINE_TORTURE_RANDOM(rand);
+	unsigned long stallsdone = jiffies;
 	bool stutter_waited;
 	unsigned long ulo[NUM_ACTIVE_RCU_POLL_OLDSTATE];
 
+	// If a new stall test is added, this must be adjusted.
+	if (stall_cpu_holdoff + stall_gp_kthread + stall_cpu)
+		stallsdone += (stall_cpu_holdoff + stall_gp_kthread + stall_cpu + 60) * HZ;
 	VERBOSE_TOROUT_STRING("rcu_torture_writer task started");
 	if (!can_expedite)
 		pr_alert("%s" TORTURE_FLAG
@@ -1580,11 +1584,11 @@ rcu_torture_writer(void *arg)
 		    !atomic_read(&rcu_fwd_cb_nodelay) &&
 		    !cur_ops->slow_gps &&
 		    !torture_must_stop() &&
-		    boot_ended)
+		    boot_ended &&
+		    time_after(jiffies, stallsdone))
 			for (i = 0; i < ARRAY_SIZE(rcu_tortures); i++)
 				if (list_empty(&rcu_tortures[i].rtort_free) &&
-				    rcu_access_pointer(rcu_torture_current) !=
-				    &rcu_tortures[i]) {
+				    rcu_access_pointer(rcu_torture_current) != &rcu_tortures[i]) {
 					tracing_off();
 					show_rcu_gp_kthreads();
 					WARN(1, "%s: rtort_pipe_count: %d\n", __func__, rcu_tortures[i].rtort_pipe_count);
@@ -2445,7 +2449,8 @@ static struct notifier_block rcu_torture_stall_block = {
 
 /*
  * CPU-stall kthread.  It waits as specified by stall_cpu_holdoff, then
- * induces a CPU stall for the time specified by stall_cpu.
+ * induces a CPU stall for the time specified by stall_cpu.  If a new
+ * stall test is added, stallsdone in rcu_torture_writer() must be adjusted.
  */
 static int rcu_torture_stall(void *args)
 {

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-01-07  0:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-03 19:29 Prototype patch to avoid TREE07 rcu_torture_writer() stalls Paul E. McKenney
2024-01-05 22:52 ` Frederic Weisbecker
2024-01-06  0:05   ` Paul E. McKenney
2024-01-06 14:55     ` Paul E. McKenney
2024-01-06 22:36       ` Frederic Weisbecker
2024-01-07  0:49         ` Paul E. McKenney

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.