From: Joel Fernandes <joelagnelf@nvidia.com>
To: rcu@vger.kernel.org
Cc: "Paul E . McKenney" <paulmck@kernel.org>,
Frederic Weisbecker <frederic@kernel.org>,
Neeraj Upadhyay <neeraj.upadhyay@kernel.org>,
Josh Triplett <josh@joshtriplett.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.zhang@linux.dev>,
linux-kernel@vger.kernel.org,
Joel Fernandes <joelagnelf@nvidia.com>
Subject: [PATCH] rcu: Reset stall detection after ftrace dump
Date: Sun, 4 Jan 2026 15:36:42 -0500 [thread overview]
Message-ID: <20260104203642.3171854-1-joelagnelf@nvidia.com> (raw)
During some recent expedited RCU testing with rcutorture, I noticed RCU
stalls when using ftrace_dump() to analyze traces. The issue that since
ftrace_dump() can take a long time, any accumulated issue can show up
just after the stall is unsupressed. Due to this a stall can be
detected and reported.
The problem is something like this:
1. rcu_ftrace_dump_stall_suppress() sets suppression value.
2. ftrace_dump() runs for a long time.
3. rcu_ftrace_dump_stall_unsuppress() clears suppression.
4. Immediately later, stall is detected.
Fix this by calling rcu_cpu_stall_reset() when clearing suppression.
This resets jiffies_stall to ULONG_MAX, preventing the issue.
Tested with gp_exp=true enabled with rcutorture and ftrace_dump() and no
stall is reported, with only clean traces in the output.
Signed-off-by: Joel Fernandes <joelagnelf@nvidia.com>
---
This is a non-urgent fix and could go in either this or the next merge
window (Boqun's call).
kernel/rcu/rcu.h | 5 ++++-
kernel/rcu/tree_stall.h | 1 +
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/kernel/rcu/rcu.h b/kernel/rcu/rcu.h
index 9cf01832a6c3..87fcf528b9ac 100644
--- a/kernel/rcu/rcu.h
+++ b/kernel/rcu/rcu.h
@@ -288,6 +288,7 @@ extern int rcu_cpu_stall_cputime;
extern bool rcu_exp_stall_task_details __read_mostly;
int rcu_jiffies_till_stall_check(void);
int rcu_exp_jiffies_till_stall_check(void);
+void rcu_cpu_stall_reset(void);
static inline bool rcu_stall_is_suppressed(void)
{
@@ -302,8 +303,10 @@ do { \
#define rcu_ftrace_dump_stall_unsuppress() \
do { \
- if (rcu_cpu_stall_suppress == 3) \
+ if (rcu_cpu_stall_suppress == 3) { \
rcu_cpu_stall_suppress = 0; \
+ rcu_cpu_stall_reset(); \
+ } \
} while (0)
#else /* #endif #ifdef CONFIG_RCU_STALL_COMMON */
diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h
index b67532cb8770..9a036fc27fed 100644
--- a/kernel/rcu/tree_stall.h
+++ b/kernel/rcu/tree_stall.h
@@ -192,6 +192,7 @@ void rcu_cpu_stall_reset(void)
WRITE_ONCE(rcu_state.nr_fqs_jiffies_stall, 3);
WRITE_ONCE(rcu_state.jiffies_stall, ULONG_MAX);
}
+EXPORT_SYMBOL_GPL(rcu_cpu_stall_reset);
//////////////////////////////////////////////////////////////////////////////
//
--
2.34.1
next reply other threads:[~2026-01-04 20:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-04 20:36 Joel Fernandes [this message]
2026-01-05 4:46 ` 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=20260104203642.3171854-1-joelagnelf@nvidia.com \
--to=joelagnelf@nvidia.com \
--cc=boqun.feng@gmail.com \
--cc=frederic@kernel.org \
--cc=jiangshanlai@gmail.com \
--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.zhang@linux.dev \
--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
all inboxes | Powered by JetHome®