[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180325184307.GE3675@linux.vnet.ibm.com>
Date: Sun, 25 Mar 2018 11:43:07 -0700
From: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Joel Fernandes <joelaf@...gle.com>,
Thomas Gleixner <tglx@...utronix.de>,
LKML <linux-kernel@...r.kernel.org>,
Peter Zijlstra <peterz@...radead.org>,
Josh Triplett <josh@...htriplett.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Lai Jiangshan <jiangshanlai@...il.com>
Subject: Re: rcu: Add might_sleep() check to synchronize_rcu()
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@...gle.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
Powered by blists - more mailing lists