[PATCH RFC v4 11/13] rcutorture: Make Tasks RCU readers Tasks Trace readers where required
From: Josef Bacik
Date: Fri Sep 18 2026 - 11:54:23 EST
rcutorture's "tasks" flavor has empty readlock/readunlock hooks because
a classic Tasks RCU reader is simply code that does not block. Under
CONFIG_TASKS_RCU_TRAMPOLINE_READERS a preemption outside trampoline text
is also a quiescent state, and the thing real readers (trampolines) do
to stay protected across their call-outs is take rcu_read_lock_trace(),
so have the torture readers do the same there. Otherwise a preempted
torture reader would rightly be treated as quiescent and the test would
report false-positive too-short grace periods.
Assisted-by: LLM
Signed-off-by: Josef Bacik <josef@xxxxxxxxxxxxxx>
---
kernel/rcu/rcutorture.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index 794937e13e7c..ab870ef09af0 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -1142,13 +1142,23 @@ static struct rcu_torture_ops trivial_preempt_ops = {
* Definitions for RCU-tasks torture testing.
*/
+/*
+ * A classic Tasks RCU reader is any stretch of kernel code that does not
+ * voluntarily block. With CONFIG_TASKS_RCU_TRAMPOLINE_READERS a preemption
+ * outside trampoline text also ends it, and what a trampoline does to stay
+ * protected across its call-out is take a Tasks Trace reader, so model that.
+ */
static int tasks_torture_read_lock(void)
{
+ if (IS_ENABLED(CONFIG_TASKS_RCU_TRAMPOLINE_READERS))
+ rcu_read_lock_trace();
return 0;
}
static void tasks_torture_read_unlock(int idx)
{
+ if (IS_ENABLED(CONFIG_TASKS_RCU_TRAMPOLINE_READERS))
+ rcu_read_unlock_trace();
}
static void rcu_tasks_torture_deferred_free(struct rcu_torture *p)
--
2.55.0