From: Lennert Buytenhek <buytenh@wantstofly.org>
To: Roopa Prabhu <roopa@cumulusnetworks.com>
Cc: David Ahern <dsa@cumulusnetworks.com>,
Robert Shearman <rshearma@brocade.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: rcu locking issue in mpls output code?
Date: Mon, 20 Jun 2016 19:33:17 +0300 [thread overview]
Message-ID: <20160620163317.GS20238@wantstofly.org> (raw)
In-Reply-To: <CAJieiUi8WX1=Yri_b8aZpP2sEkQ6CqARcX29M94Qdf4gczFDjg@mail.gmail.com>
On Mon, Jun 20, 2016 at 09:13:36AM -0700, Roopa Prabhu wrote:
> >>>> diff --git a/net/mpls/mpls_iptunnel.c b/net/mpls/mpls_iptunnel.c
> >>>> index fb31aa8..802956b 100644
> >>>> --- a/net/mpls/mpls_iptunnel.c
> >>>> +++ b/net/mpls/mpls_iptunnel.c
> >>>> @@ -105,12 +105,15 @@ static int mpls_output(struct net *net, struct
> >>>> sock *sk, struct sk_buff *skb)
> >>>> bos = false;
> >>>> }
> >>>>
> >>>> + rcu_read_lock_bh();
> >>>> if (rt)
> >>>> err = neigh_xmit(NEIGH_ARP_TABLE, out_dev,
> >>>> &rt->rt_gateway,
> >>>> skb);
> >>>> else if (rt6)
> >>>> err = neigh_xmit(NEIGH_ND_TABLE, out_dev,
> >>>> &rt6->rt6i_gateway,
> >>>> skb);
> >>>> + rcu_read_unlock_bh();
> >>>> +
> >>>> if (err)
> >>>> net_dbg_ratelimited("%s: packet transmission failed:
> >>>> %d\n",
> >>>> __func__, err);
> >>>>
> >>>
> >>> I think those need to be added to neigh_xmit in the
> >>>
> >>> if (likely(index < NEIGH_NR_TABLES)) {
> >>>
> >>> }
> >>
> >>
> >> That'll force callers that don't need the extra protection (i.e.
> >> mpls_forward(), since that always runs from softirq and it's enough
> >> to protect the neigh state with rcu_read_lock() from softirq and we're
> >> already running under rcu_read_lock() when we get to neigh_xmit()) to
> >> eat the useless overhead of an extra rcu_read_{,un}lock_bh() pair, but
> >> sure, functionally that's correct, I think, and in my workload I don't
> >> care about MPLS forwarding performance anyway. ;-)
> >
> >
> > __neigh_lookup_noref expects bh level protection. Since the if block in
> > neigh_xmit requires the locking seems like this the appropriate place for
> > it.
> >
> >>
> >> Want me to send a patch moving it to neigh_xmit() ?
> >
> >
> > Roopa/Robert: agree?
>
> yes, seems like an appropriate place for it. provided it does not add
> unnecessary overhead for others.
> But then neigh_xmit seems to be only called from mpls_output and mpls_forward.
OK, patch coming up. Thanks!
next prev parent reply other threads:[~2016-06-20 16:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-20 0:45 rcu locking issue in mpls output code? Lennert Buytenhek
2016-06-20 2:19 ` David Ahern
2016-06-20 6:30 ` Lennert Buytenhek
2016-06-20 15:19 ` David Ahern
2016-06-20 16:13 ` Roopa Prabhu
2016-06-20 16:33 ` Lennert Buytenhek [this message]
2016-06-20 16:38 ` David Ahern
2016-06-20 17:44 ` Lennert Buytenhek
2016-06-20 19:37 ` Stephen Hemminger
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=20160620163317.GS20238@wantstofly.org \
--to=buytenh@wantstofly.org \
--cc=dsa@cumulusnetworks.com \
--cc=netdev@vger.kernel.org \
--cc=roopa@cumulusnetworks.com \
--cc=rshearma@brocade.com \
/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).