* [PATCH] rcu-tasks: Track barrier callbacks in debugobjects
@ 2026-11-04 15:30 Joel Fernandes
2026-11-04 19:01 ` Bradley Morgan
0 siblings, 1 reply; 2+ messages in thread
From: Joel Fernandes @ 2026-11-04 15:30 UTC (permalink / raw)
To: linux-kernel, Paul E. McKenney, Frederic Weisbecker,
Neeraj Upadhyay, Joel Fernandes, Josh Triplett, Boqun Feng,
Uladzislau Rezki, Steven Rostedt, Mathieu Desnoyers,
Lai Jiangshan, Zqiang
Cc: Kunwu Chan, rcu
rcu_tasks_invoke_cbs() now unqueues each callback from debugobjects.
However, rcu_barrier_tasks_generic() inserts its per-CPU barrier heads
directly with rcu_segcblist_entrain(), bypassing the queue hook in
call_rcu_tasks_generic(). This produces active_state and deactivate
warnings for untracked objects when a barrier callback runs.
Activate each barrier head before entrainment and undo that activation
when there are no callbacks to entrain behind. Successful entrainment
is balanced by the invocation path, as for ordinary callbacks.
The existing n_barrier_cbs=2 torture test reproduces the warnings before
this change and completes without them afterwards.
This fixes patch "rcu-tasks: Detect duplicate callback enqueue".
Cc: Kunwu Chan <kunwu.chan@gmail.com>
Cc: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Joel Fernandes <joelagnelf@nvidia.com>
---
kernel/rcu/tasks.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
index d5d060a5c4b6..a20db323612b 100644
--- a/kernel/rcu/tasks.h
+++ b/kernel/rcu/tasks.h
@@ -470,9 +470,12 @@ static void __maybe_unused rcu_barrier_tasks_generic(struct rcu_tasks *rtp)
break;
rtpcp = per_cpu_ptr(rtp->rtpcpu, cpu);
rtpcp->barrier_q_head.func = rcu_barrier_tasks_generic_cb;
+ debug_rcu_head_queue(&rtpcp->barrier_q_head);
raw_spin_lock_irqsave_rcu_node(rtpcp, flags);
if (rcu_segcblist_entrain(&rtpcp->cblist, &rtpcp->barrier_q_head))
atomic_inc(&rtp->barrier_q_count);
+ else
+ debug_rcu_head_unqueue(&rtpcp->barrier_q_head);
raw_spin_unlock_irqrestore_rcu_node(rtpcp, flags);
}
if (atomic_sub_and_test(2, &rtp->barrier_q_count))
--
2.54.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] rcu-tasks: Track barrier callbacks in debugobjects
2026-11-04 15:30 [PATCH] rcu-tasks: Track barrier callbacks in debugobjects Joel Fernandes
@ 2026-11-04 19:01 ` Bradley Morgan
0 siblings, 0 replies; 2+ messages in thread
From: Bradley Morgan @ 2026-11-04 19:01 UTC (permalink / raw)
To: joelagnelf
Cc: boqun, frederic, jiangshanlai, josh, kunwu.chan, linux-kernel,
mathieu.desnoyers, neeraj.upadhyay, paulmck, qiang.zhang, rcu,
rostedt, urezki
On 4 November 2026 15:30:45 GMT, Joel Fernandes <joelagnelf@nvidia.com>
wrote:
>rcu_tasks_invoke_cbs() now unqueues each callback from debugobjects.
>However, rcu_barrier_tasks_generic() inserts its per-CPU barrier heads
>directly with rcu_segcblist_entrain(), bypassing the queue hook in
>call_rcu_tasks_generic(). This produces active_state and deactivate
>warnings for untracked objects when a barrier callback runs.
>
>Activate each barrier head before entrainment and undo that activation
>when there are no callbacks to entrain behind. Successful entrainment
>is balanced by the invocation path, as for ordinary callbacks.
>
>The existing n_barrier_cbs=2 torture test reproduces the warnings before
>this change and completes without them afterwards.
>
>This fixes patch "rcu-tasks: Detect duplicate callback enqueue".
>
>Cc: Kunwu Chan <kunwu.chan@gmail.com>
>Cc: Paul E. McKenney <paulmck@kernel.org>
Thanks,
Reviewed-by: Bradley Morgan <brads@mainlining.org>
>Signed-off-by: Joel Fernandes <joelagnelf@nvidia.com>
>---
> kernel/rcu/tasks.h | 3 +++
> 1 file changed, 3 insertions(+)
>
>diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
>index d5d060a5c4b6..a20db323612b 100644
>--- a/kernel/rcu/tasks.h
>+++ b/kernel/rcu/tasks.h
>@@ -470,9 +470,12 @@ static void __maybe_unused rcu_barrier_tasks_generic(struct rcu_tasks *rtp)
> break;
> rtpcp = per_cpu_ptr(rtp->rtpcpu, cpu);
> rtpcp->barrier_q_head.func = rcu_barrier_tasks_generic_cb;
>+ debug_rcu_head_queue(&rtpcp->barrier_q_head);
> raw_spin_lock_irqsave_rcu_node(rtpcp, flags);
> if (rcu_segcblist_entrain(&rtpcp->cblist, &rtpcp->barrier_q_head))
> atomic_inc(&rtp->barrier_q_count);
>+ else
>+
Wow!
debug_rcu_head_unqueue(&rtpcp->barrier_q_head);
> raw_spin_unlock_irqrestore_rcu_node(rtpcp, flags);
> }
> if (atomic_sub_and_test(2, &rtp->barrier_q_count))
>
--- Thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-04 19:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-04 15:30 [PATCH] rcu-tasks: Track barrier callbacks in debugobjects Joel Fernandes
2026-11-04 19:01 ` Bradley Morgan
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®