From: Steven Rostedt <rostedt@goodmis.org>
To: Joel Fernandes <joelaf@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
LKML <linux-kernel@vger.kernel.org>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
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: Fri, 23 Mar 2018 21:21:05 -0400 [thread overview]
Message-ID: <20180323212105.40766d1c@vmware.local.home> (raw)
In-Reply-To: <CAJWu+oqLnqGbuo9Y5DRJkskaMZ5=Krsxpbe1OhmEpd80CSG2mg@mail.gmail.com>
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().
-- Steve
next prev parent reply other threads:[~2018-03-24 1:21 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 [this message]
2018-03-25 18:43 ` Paul E. McKenney
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=20180323212105.40766d1c@vmware.local.home \
--to=rostedt@goodmis.org \
--cc=jiangshanlai@gmail.com \
--cc=joelaf@google.com \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.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).