From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "John W. Linville" <linville@tuxdriver.com>,
netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH] netpoll: use non-BH variant of RCU
Date: Tue, 10 Aug 2010 14:19:32 -0700 [thread overview]
Message-ID: <20100810211932.GG2379@linux.vnet.ibm.com> (raw)
In-Reply-To: <20100810204358.GA1076@gondor.apana.org.au>
On Tue, Aug 10, 2010 at 04:43:58PM -0400, Herbert Xu wrote:
> On Tue, Aug 10, 2010 at 04:25:24PM -0400, John W. Linville wrote:
> > "netpoll: Fix RCU usage" switched netpoll_rx to use the BH variant
> > of RCU. Unfortunately, calling netpoll_rx from netif_rx resulted in
> > the following backtrace:
>
> Thanks for catching this John!
>
> > diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
> > index 413742c..0bdd527 100644
> > --- a/include/linux/netpoll.h
> > +++ b/include/linux/netpoll.h
> > @@ -63,8 +63,8 @@ static inline bool netpoll_rx(struct sk_buff *skb)
> > unsigned long flags;
> > bool ret = false;
> >
> > - rcu_read_lock_bh();
> > - npinfo = rcu_dereference_bh(skb->dev->npinfo);
> > + rcu_read_lock();
> > + npinfo = rcu_dereference(skb->dev->npinfo);
>
> I really wanted to avoid mixing the two different RCU primitives
> because they require different synchronisations.
>
> In this case, the problem is that we're being called in IRQ
> context, where BH is diabled anyway, so we don't actually need
> to do anything (assuming IRQ is off).
>
> Paul, what could we do to resolve this (other than by switching
> to the non-BH variant of RCU)? Perhaps an additional variant
> of rcu_read_lock_bh that checks whether IRQ is off?
Hello, Herbert,
Your suggestion of providing another API rcu_read_lock_irqsoff()
and rcu_read_unlock_irqsoff() is the best I can think of right offhand.
What tree/commit do you need the patch against?
Thanx, Paul
next prev parent reply other threads:[~2010-08-10 21:19 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-10 20:25 [PATCH] netpoll: use non-BH variant of RCU John W. Linville
2010-08-10 20:43 ` Herbert Xu
2010-08-10 21:19 ` Paul E. McKenney [this message]
2010-08-10 23:31 ` David Miller
2010-08-11 11:03 ` Herbert Xu
2010-08-11 11:27 ` Herbert Xu
2010-08-11 15:37 ` John W. Linville
2010-08-12 6:16 ` David Miller
2010-08-11 12:20 ` Paul E. McKenney
2010-08-11 22:00 ` Paul E. McKenney
2010-08-12 6:09 ` David Miller
2010-08-12 15:42 ` Paul E. McKenney
2010-08-13 14:39 ` Herbert Xu
2010-08-13 16:29 ` Paul E. McKenney
2010-08-13 17:51 ` Herbert Xu
2010-08-15 6:50 ` David Miller
2010-09-02 17:26 ` Paul E. McKenney
2010-09-03 15:34 ` David Miller
2010-09-03 15:52 ` 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=20100810211932.GG2379@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linville@tuxdriver.com \
--cc=netdev@vger.kernel.org \
/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).