All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Joel Fernandes <joelaf@google.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	LKML <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Josh Triplett <josh@joshtriplett.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Lai Jiangshan <jiangshanlai@gmail.com>
Subject: Re: rcu: Add might_sleep() check to synchronize_rcu()
Date: Sun, 25 Mar 2018 11:43:07 -0700	[thread overview]
Message-ID: <20180325184307.GE3675@linux.vnet.ibm.com> (raw)
In-Reply-To: <20180323212105.40766d1c@vmware.local.home>

On Fri, Mar 23, 2018 at 09:21:05PM -0400, Steven Rostedt wrote:
> On Fri, 23 Mar 2018 15:57:04 -0700
> Joel Fernandes <joelaf@google.com> wrote:
> 
> > > diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
> > > index 194a7483bb93..857b494bee29 100644
> > > --- a/net/l2tp/l2tp_core.c
> > > +++ b/net/l2tp/l2tp_core.c
> > > @@ -1677,6 +1677,8 @@ void __l2tp_session_unhash(struct l2tp_session *session)
> > >  {
> > >         struct l2tp_tunnel *tunnel = session->tunnel;
> > >
> > > +       might_sleep();
> > > +
> > >         /* Remove the session from core hashes */
> > >         if (tunnel) {
> > >                 /* Remove from the per-tunnel hash */  
> > 
> > Thanks Thomas and Steven, also shouldn't this code be calling
> > synchronize_rcu_bh instead of synchronize_rcu, to complement the
> > rcu_read_lock_bh? In which situations would you call one versus the
> > other?
> 
> Probably, as the comment above rcu_read_lock_bh is:
> 
>  * rcu_read_lock_bh() - mark the beginning of an RCU-bh critical section
>  *
>  * This is equivalent of rcu_read_lock(), but to be used when updates
>  * are being done using call_rcu_bh() or synchronize_rcu_bh(). Since
>  * both call_rcu_bh() and synchronize_rcu_bh() consider completion of a
>  * softirq handler to be a quiescent state, a process in RCU read-side
>  * critical section must be protected by disabling softirqs.
> 
> It appears that the reason to use rcu_read_lock_bh() is if you are
> calling synchronize_rcu_bh(). Otherwise, one could just be using
> straight rcu_read_lock().

Agreed, these do have to match.  (I am still working on collapsing
RCU-preempt, RCU-bh, and RCU-sched into one thing per Linus's request,
but still at the pen-and-paper stage.  Not all that difficult, just a
lot of cases to cover.)

							Thanx, Paul

  reply	other threads:[~2018-03-25 18:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-23 21:12 rcu: Add might_sleep() check to synchronize_rcu() Thomas Gleixner
2018-03-23 21:28 ` Steven Rostedt
2018-03-23 21:33   ` Thomas Gleixner
2018-03-23 21:40     ` Steven Rostedt
2018-03-23 21:46       ` Thomas Gleixner
2018-03-23 22:57       ` Joel Fernandes
2018-03-24  1:21         ` Steven Rostedt
2018-03-25 18:43           ` Paul E. McKenney [this message]
2018-03-25 18:50 ` Paul E. McKenney

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=20180325184307.GE3675@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=jiangshanlai@gmail.com \
    --cc=joelaf@google.com \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=peterz@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.