mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: KunWu Chan <kunwu.chan@gmail.com>
To: Joel Fernandes <joelagnelf@nvidia.com>
Cc: linux-kernel@vger.kernel.org,
	"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@kernel.org>,
	 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>,
	rcu@vger.kernel.org
Subject: Re: [PATCH] rcu-tasks: Track barrier callbacks in debugobjects
Date: Thu, 5 Nov 2026 10:55:17 +0800	[thread overview]
Message-ID: <CAN_Opa9t9gL3O2dkBTiHKHAnJCbUNOYBmQkzWevCFr8r6ypGhQ@mail.gmail.com> (raw)
In-Reply-To: <20261104153046.965890-1-joelagnelf@nvidia.com>

Hi Joel,

I ran into the same warnings while testing rcutorture changes on top
of my earlier series,
so thanks for posting the fix.

Verified on x86_64 with torture_type=tasks object_debug=1 n_barrier_cbs=2:

Without the patch, each barrier round triggers:
ODEBUG: active_state not available (active state 0) object:
(____ptrval____) object type: rcu_head hint: 0x0

With the patch applied, the warnings are gone, and 300+ barrier rounds
complete cleanly.

I'd like to include this as the first patch in my follow-up series,
since the new
rcutorture tasks coverage depends on it. Please let me know if that's an issue.

Tested-by:  Kunwu Chan <chentao@kylinos.cn>
Reviewed-by: Kunwu Chan <chentao@kylinos.cn>

Thanks,
Kunwu

On Wed, Nov 4, 2026 at 11:31 PM 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>
> 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
>

      parent reply	other threads:[~2026-11-05  2:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04 15:30 Joel Fernandes
2026-11-04 19:01 ` Bradley Morgan
2026-11-05  2:55 ` KunWu Chan [this message]

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=CAN_Opa9t9gL3O2dkBTiHKHAnJCbUNOYBmQkzWevCFr8r6ypGhQ@mail.gmail.com \
    --to=kunwu.chan@gmail.com \
    --cc=boqun@kernel.org \
    --cc=frederic@kernel.org \
    --cc=jiangshanlai@gmail.com \
    --cc=joelagnelf@nvidia.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®