From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Cong Wang <cwang@twopensource.com>,
Tom Herbert <therbert@google.com>,
netdev <netdev@vger.kernel.org>
Subject: Re: suspicious RCU usage in net/ipv4/ip_tunnel.c:80
Date: Mon, 13 Jan 2014 20:53:16 -0800 [thread overview]
Message-ID: <20140114045316.GV10038@linux.vnet.ibm.com> (raw)
In-Reply-To: <1389601233.31367.213.camel@edumazet-glaptop2.roam.corp.google.com>
On Mon, Jan 13, 2014 at 12:20:33AM -0800, Eric Dumazet wrote:
> On Sun, 2014-01-12 at 22:36 -0800, Cong Wang wrote:
> > > Please read rcu_dereference_protected() documentation in
> > > include/linux/rcupdate.h
> >
> > I did before I replied.
>
>
>
> >
> > >
> > > Also you can run sparse, with CONFIG_SPARSE_RCU_POINTER=y in
> > > your .config
> > >
> > > make C=2 net/ipv4/ip_tunnel.o
> > >
> > > And then you'll know the answer to this question.
> > >
> >
> > Sounds like it is only to shut up a sparse warning, then its name
> > is misleading, we clearly don't dereference it here.
OK, I'll bite... This code invokes dst_release() which looks to me
like it dereferences this pointer:
void dst_release(struct dst_entry *dst)
{
if (dst) {
int newrefcnt;
newrefcnt = atomic_dec_return(&dst->__refcnt);
WARN_ON(newrefcnt < 0);
if (unlikely(dst->flags & DST_NOCACHE) && !newrefcnt) {
dst = dst_destroy(dst);
if (dst)
__dst_free(dst);
}
}
}
If you really were not dereferencing the pointer, for example, if you
were only testing it against NULL or some such, then you can use
rcu_access_pointer(). This is a bit cheaper on DEC Alpha, FWIW.
You can think of rcu_dereference() as meaning "fetch this RCU-protected
pointer with intent to dereference()" if that helps.
Or am I missing your point?
> Historical reasons, you should have been there when Paul invented the
> name and lazy people like us let him do so !
>
> http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=b62730baea32f86fe91a7930e4b7ee8d82778b79
Indeed! ;-)
And rcu_dereference() is at least an improvement over the earlier
hand-placed smp_read_barrier_depends().
Thanx, Paul
> You are lucky, there is plenty of documentation, maybe too much..
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2014-01-14 4:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-11 0:37 suspicious RCU usage in net/ipv4/ip_tunnel.c:80 Cong Wang
2014-01-11 1:21 ` Eric Dumazet
2014-01-11 19:15 ` Cong Wang
2014-01-12 17:44 ` Eric Dumazet
2014-01-13 6:36 ` Cong Wang
2014-01-13 8:20 ` Eric Dumazet
2014-01-14 4:53 ` Paul E. McKenney [this message]
2014-01-17 0:26 ` Cong Wang
2014-01-17 0:49 ` Eric Dumazet
2014-01-13 19:35 ` Cong Wang
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=20140114045316.GV10038@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=cwang@twopensource.com \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=therbert@google.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 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.