Linux RCU subsystem development
 help / color / mirror / Atom feed
From: Joel Fernandes <joelagnelf@nvidia.com>
To: linux-kernel@vger.kernel.org, Davidlohr Bueso <dave@stgolabs.net>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	Josh Triplett <josh@joshtriplett.org>,
	Frederic Weisbecker <frederic@kernel.org>,
	Neeraj Upadhyay <neeraj.upadhyay@kernel.org>,
	Joel Fernandes <joel@joelfernandes.org>,
	Boqun Feng <boqun.feng@gmail.com>,
	Uladzislau Rezki <urezki@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Lai Jiangshan <jiangshanlai@gmail.com>,
	Zqiang <qiang.zhang1211@gmail.com>
Cc: rcu@vger.kernel.org, Joel Fernandes <joelagnelf@nvidia.com>
Subject: [PATCH 08/14] rcutorture: Complain if an ->up_read() is delayed more than 10 seconds
Date: Fri, 18 Apr 2025 12:09:40 -0400	[thread overview]
Message-ID: <20250418161005.2425391-9-joelagnelf@nvidia.com> (raw)
In-Reply-To: <20250418161005.2425391-1-joelagnelf@nvidia.com>

From: "Paul E. McKenney" <paulmck@kernel.org>

The down/up SRCU reader testing uses an hrtimer handler to exit the SRCU
read-side critical section.  This might be delayed, and if delayed for
too long, it can prevent the rcutorture run from completing.  This commit
therefore complains if the hrtimer handler is delayed for more than
ten seconds.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Joel Fernandes <joelagnelf@nvidia.com>
---
 kernel/rcu/rcutorture.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index 25010666576b..0b998609c7dc 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -2438,6 +2438,7 @@ rcu_torture_reader(void *arg)
 struct rcu_torture_one_read_state_updown {
 	struct hrtimer rtorsu_hrt;
 	bool rtorsu_inuse;
+	unsigned long rtorsu_j;
 	struct torture_random_state rtorsu_trs;
 	struct rcu_torture_one_read_state rtorsu_rtors;
 };
@@ -2520,6 +2521,7 @@ static void rcu_torture_updown_one(struct rcu_torture_one_read_state_updown *rto
 		schedule_timeout_idle(HZ);
 		return;
 	}
+	rtorsup->rtorsu_j = jiffies;
 	smp_store_release(&rtorsup->rtorsu_inuse, true);
 	t = torture_random(&rtorsup->rtorsu_trs) & 0xfffff; // One per million.
 	if (t < 10 * 1000)
@@ -2542,8 +2544,10 @@ rcu_torture_updown(void *arg)
 		for (rtorsup = updownreaders; rtorsup < &updownreaders[n_up_down]; rtorsup++) {
 			if (torture_must_stop())
 				break;
-			if (smp_load_acquire(&rtorsup->rtorsu_inuse))
+			if (smp_load_acquire(&rtorsup->rtorsu_inuse)) {
+				WARN_ON_ONCE(time_after(jiffies, rtorsup->rtorsu_j + 10 * HZ));
 				continue;
+			}
 			rcu_torture_updown_one(rtorsup);
 		}
 		torture_hrtimeout_ms(1, 1000, &rcu_torture_updown_rand);
-- 
2.43.0


  parent reply	other threads:[~2025-04-18 16:10 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-18 16:09 [PATCH 00/14] RCU torture changes for v6.16 Joel Fernandes
2025-04-18 16:09 ` [PATCH 01/14] rcutorture: Make srcu_lockdep.sh check kernel Kconfig Joel Fernandes
2025-04-18 16:09 ` [PATCH 02/14] rcutorture: Make srcu_lockdep.sh check reader-conflict handling Joel Fernandes
2025-04-18 16:09 ` [PATCH 03/14] rcutorture: Split out beginning and end from rcu_torture_one_read() Joel Fernandes
2025-04-18 16:09 ` [PATCH 04/14] rcutorture: Make torture.sh --do-rt use CONFIG_PREEMPT_RT Joel Fernandes
2025-04-18 16:09 ` [PATCH 05/14] rcutorture: Add tests for SRCU up/down reader primitives Joel Fernandes
2025-04-18 16:09 ` [PATCH 06/14] rcutorture: Pull rcu_torture_updown() loop body into new function Joel Fernandes
2025-04-18 16:09 ` [PATCH 07/14] rcutorture: Comment invocations of tick_dep_set_task() Joel Fernandes
2025-04-18 16:09 ` Joel Fernandes [this message]
2025-04-18 16:09 ` [PATCH 09/14] rcutorture: Check for ->up_read() without matching ->down_read() Joel Fernandes
2025-04-18 20:26   ` Joel Fernandes
2025-04-18 16:09 ` [PATCH 10/14] checkpatch: Deprecate srcu_read_lock_lite() and srcu_read_unlock_lite() Joel Fernandes
2025-04-18 16:09 ` [PATCH 11/14] torture: Add --do-{,no-}normal to torture.sh Joel Fernandes
2025-04-18 16:09 ` [PATCH 12/14] torture: Add testing of RCU's Rust bindings " Joel Fernandes
2025-04-18 17:31   ` Miguel Ojeda
2025-04-18 18:04     ` Paul E. McKenney
2025-04-18 18:32       ` Miguel Ojeda
2025-04-18 20:28         ` Paul E. McKenney
2025-04-18 22:29           ` [12/14] " Joel Fernandes
2025-04-18 22:29           ` Joel Fernandes
2025-04-18 22:45             ` Paul E. McKenney
2025-04-19 22:24               ` Joel Fernandes
2025-04-20  0:17                 ` Paul E. McKenney
2025-04-18 16:09 ` [PATCH 13/14] rcutorture: Perform more frequent testing of ->gpwrap Joel Fernandes
2025-04-18 16:09 ` [PATCH 14/14] rcutorture: Fix issue with re-using old images on ARM64 Joel Fernandes
2025-04-18 16:09 ` [PATCH 01/12] rcutorture: Make srcu_lockdep.sh check kernel Kconfig Joel Fernandes
2025-04-18 16:09 ` [PATCH 02/12] rcutorture: Make srcu_lockdep.sh check reader-conflict handling Joel Fernandes
2025-04-18 16:09 ` [PATCH 03/12] rcutorture: Split out beginning and end from rcu_torture_one_read() Joel Fernandes
2025-04-18 16:09 ` [PATCH 04/12] rcutorture: Make torture.sh --do-rt use CONFIG_PREEMPT_RT Joel Fernandes
2025-04-18 16:09 ` [PATCH 05/12] rcutorture: Add tests for SRCU up/down reader primitives Joel Fernandes
2025-04-18 16:09 ` [PATCH 06/12] rcutorture: Pull rcu_torture_updown() loop body into new function Joel Fernandes
2025-04-18 16:09 ` [PATCH 07/12] rcutorture: Comment invocations of tick_dep_set_task() Joel Fernandes
2025-04-18 16:09 ` [PATCH 08/12] rcutorture: Complain if an ->up_read() is delayed more than 10 seconds Joel Fernandes
2025-04-18 16:09 ` [PATCH 09/12] rcutorture: Check for ->up_read() without matching ->down_read() Joel Fernandes
2025-04-18 16:09 ` [PATCH 10/12] checkpatch: Deprecate srcu_read_lock_lite() and srcu_read_unlock_lite() Joel Fernandes
2025-04-18 16:09 ` [PATCH 11/12] torture: Add --do-{,no-}normal to torture.sh Joel Fernandes
2025-04-18 16:09 ` [PATCH 12/12] torture: Add testing of RCU's Rust bindings " Joel Fernandes
2025-04-18 16:23 ` [PATCH 00/14] RCU torture changes for v6.16 Joel Fernandes

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=20250418161005.2425391-9-joelagnelf@nvidia.com \
    --to=joelagnelf@nvidia.com \
    --cc=boqun.feng@gmail.com \
    --cc=dave@stgolabs.net \
    --cc=frederic@kernel.org \
    --cc=jiangshanlai@gmail.com \
    --cc=joel@joelfernandes.org \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=neeraj.upadhyay@kernel.org \
    --cc=paulmck@kernel.org \
    --cc=qiang.zhang1211@gmail.com \
    --cc=rcu@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=urezki@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