rcu.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Frederic Weisbecker <frederic@kernel.org>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: "Paul E. McKenney" <paulmck@kernel.org>,
	rcu@vger.kernel.org, Josh Triplett <josh@joshtriplett.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Lai Jiangshan <jiangshanlai@gmail.com>,
	Joel Fernandes <joel@joelfernandes.org>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] rcu/nocb: Extend checks for offloaded rdp by migrate_disable
Date: Wed, 28 Jul 2021 01:26:23 +0200	[thread overview]
Message-ID: <20210727232623.GE283787@lothringen> (raw)
In-Reply-To: <20210727192605.7q6ez2kbhd3a64wy@linutronix.de>

On Tue, Jul 27, 2021 at 09:26:05PM +0200, Sebastian Andrzej Siewior wrote:
> On 2021-07-27 10:23:51 [-0700], Paul E. McKenney wrote:
> > > I don't fully understand why the CPU-hotplug lock matters here but this
> > > is beside the point ;)
> > 
> > If I remember correctly, any attempt to change the offloaded state
> > must hold off CPU-hotplug operations.  So if the current thread is
> > holding off CPU-hotplug operations, no other thread can be doing
> > an offload or de-offload operation.
> 
> I'm not sure what you mean by "change the offloaded state". If the
> CPU-hotplug read-lock is acquired you are still preemptible. So you
> could migrate to another CPU at which point this_cpu_ptr(&rcu_data)
> would change.

Sure but it's fine to read the offloaded state of a remote CPU if
CPU hotplug lock is held.

> > > diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
> > > index 0ff5e4fb933e7..d8a623ba7d243 100644
> > > --- a/kernel/rcu/tree_plugin.h
> > > +++ b/kernel/rcu/tree_plugin.h
> > > @@ -57,16 +57,18 @@ static bool rcu_rdp_is_offloaded(struct rcu_data *rdp)
> > >  	 * timers have their own means of synchronization against the
> > >  	 * offloaded state updaters.
> > >  	 */
> > > +#ifdef CONFIG_SMP
> > >  	RCU_LOCKDEP_WARN(
> > >  		!(lockdep_is_held(&rcu_state.barrier_mutex) ||
> > >  		  (IS_ENABLED(CONFIG_HOTPLUG_CPU) && lockdep_is_cpus_held()) ||
> > >  		  rcu_lockdep_is_held_nocb(rdp) ||
> > >  		  (rdp == this_cpu_ptr(&rcu_data) &&
> > > -		   !(IS_ENABLED(CONFIG_PREEMPT_COUNT) && preemptible())) ||
> > > +		   (!(IS_ENABLED(CONFIG_PREEMPT_COUNT) && preemptible()) ||
> > 
> > 
> > > +		    current->migration_disabled)) ||
> > 
> > How does this change interact with the one proposed by Valentin?
> > 
> > https://lore.kernel.org/lkml/20210721115118.729943-3-valentin.schneider@arm.com/
> 
> So by looking at the series, it does the same thing. I would prefer
> is_pcpu_stable() rather then is_pcpu_safe() but that is a different
> topic.
> If we settle for this series instead someone should respond to that
> thread. Let me see if I find someone.
> I'm fine either way :)

Either way I believe it won't work, please check:

https://lore.kernel.org/lkml/20210727230814.GC283787@lothringen/

I wonder also, how many similar assumption out there do we have that
rely on softirqs not being preemptible. Most of them probably silent.

Thanks.

  reply	other threads:[~2021-07-27 23:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-27 16:38 [PATCH] rcu/nocb: Extend checks for offloaded rdp by migrate_disable Sebastian Andrzej Siewior
2021-07-27 17:23 ` Paul E. McKenney
2021-07-27 19:26   ` Sebastian Andrzej Siewior
2021-07-27 23:26     ` Frederic Weisbecker [this message]
2021-07-27 19:33   ` Thomas Gleixner
2021-07-27 23:32     ` Frederic Weisbecker
2021-07-28  8:34       ` Thomas Gleixner
2021-07-28 11:50         ` Frederic Weisbecker
2021-07-27 23:20   ` Frederic Weisbecker

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=20210727232623.GE283787@lothringen \
    --to=frederic@kernel.org \
    --cc=bigeasy@linutronix.de \
    --cc=jiangshanlai@gmail.com \
    --cc=joel@joelfernandes.org \
    --cc=josh@joshtriplett.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=paulmck@kernel.org \
    --cc=rcu@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).