mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Frederic Weisbecker <frederic@kernel.org>
To: Neeraj Upadhyay <Neeraj.Upadhyay@amd.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Zqiang <qiang.zhang1211@gmail.com>,
	Boqun Feng <boqun.feng@gmail.com>,
	Joel Fernandes <joel@joelfernandes.org>,
	Josh Triplett <josh@joshtriplett.org>,
	Lai Jiangshan <jiangshanlai@gmail.com>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	"Paul E . McKenney" <paulmck@kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Uladzislau Rezki <urezki@gmail.com>, rcu <rcu@vger.kernel.org>
Subject: Re: [PATCH 2/2] rcu/nocb: Fix missed RCU barrier on deoffloading
Date: Tue, 12 Nov 2024 22:37:26 +0100	[thread overview]
Message-ID: <ZzPKlujDt20gMkY3@pavilion.home> (raw)
In-Reply-To: <68c39e33-6281-4978-ba4e-131c6336aa7e@amd.com>

Le Mon, Nov 11, 2024 at 01:07:16PM +0530, Neeraj Upadhyay a écrit :
> 
> > diff --git a/kernel/rcu/tree_nocb.h b/kernel/rcu/tree_nocb.h
> > index 16865475120b..2605dd234a13 100644
> > --- a/kernel/rcu/tree_nocb.h
> > +++ b/kernel/rcu/tree_nocb.h
> > @@ -891,7 +891,18 @@ static void nocb_cb_wait(struct rcu_data *rdp)
> >  	swait_event_interruptible_exclusive(rdp->nocb_cb_wq,
> >  					    nocb_cb_wait_cond(rdp));
> >  	if (kthread_should_park()) {
> > -		kthread_parkme();
> > +		/*
> > +		 * kthread_park() must be preceded by an rcu_barrier().
> > +		 * But yet another rcu_barrier() might have sneaked in between
> > +		 * the barrier callback execution and the callbacks counter
> > +		 * decrement.
> > +		 */
> > +		if (rdp->nocb_cb_sleep) {
> 
> Is READ_ONCE() not required here?

No because it can't be written concurrently at this point. The value observed
here if kthread_should_park() must have been written locally on the previous
call to nocb_cb_wait().

Thanks.


> 
> 
> - Neeraj
> 
> > +			rcu_nocb_lock_irqsave(rdp, flags);
> > +			WARN_ON_ONCE(rcu_segcblist_n_cbs(&rdp->cblist));
> > +			rcu_nocb_unlock_irqrestore(rdp, flags);
> > +			kthread_parkme();
> > +		}
> >  	} else if (READ_ONCE(rdp->nocb_cb_sleep)) {
> >  		WARN_ON(signal_pending(current));
> >  		trace_rcu_nocb_wake(rcu_state.name, rdp->cpu, TPS("WokeEmpty"));
> 

  reply	other threads:[~2024-11-12 21:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-06 15:32 [PATCH 0/2] RCU NOCB for v6.13 Frederic Weisbecker
2024-11-06 15:32 ` [PATCH 1/2] rcu: Remove unused declaration rcu_segcblist_offload() Frederic Weisbecker
2024-11-06 15:32 ` [PATCH 2/2] rcu/nocb: Fix missed RCU barrier on deoffloading Frederic Weisbecker
2024-11-11  7:37   ` Neeraj Upadhyay
2024-11-12 21:37     ` Frederic Weisbecker [this message]
2024-11-13  3:22       ` Neeraj Upadhyay
2024-11-11 17:33 ` [PATCH 0/2] RCU NOCB for v6.13 Neeraj Upadhyay

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=ZzPKlujDt20gMkY3@pavilion.home \
    --to=frederic@kernel.org \
    --cc=Neeraj.Upadhyay@amd.com \
    --cc=boqun.feng@gmail.com \
    --cc=jiangshanlai@gmail.com \
    --cc=joel@joelfernandes.org \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --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

Powered by JetHome