From: Eric Dumazet <eric.dumazet@gmail.com>
To: paulmck@linux.vnet.ibm.com
Cc: yoshfuji@linux-ipv6.org, netdev@vger.kernel.org, mingo@elte.hu,
akpm@linux-foundation.org, peterz@infradead.org
Subject: Re: What protects rcu_dereference() in __in6_dev_get()?
Date: Fri, 15 Jan 2010 06:50:15 +0100 [thread overview]
Message-ID: <4B500217.6070908@gmail.com> (raw)
In-Reply-To: <20100114183215.GA16866@linux.vnet.ibm.com>
Le 14/01/2010 19:32, Paul E. McKenney a écrit :
> Hello, Yoshi,
>
> Could you please tell me what protects the rcu_dereference() in
> __in6_dev_get()? I am adding lockdep-based checking to RCU, and
> "git blame" said I should ask you about this one.
>
> The current code, rcu_dereference(), assumes that this is protected only
> by RCU. My problem might be any of the following:
>
> o Some other flavor of RCU protects this, e.g., RCU-bh, which
> would require rcu_dereference_bh().
>
> o This is called from updates as well as from readers, and
> some lock protects the updates.
>
> o This is called during initialization, when this pointer is
> inaccessible to readers.
>
> Please note that I can add a check to cover multiple possibilities.
> For a real example in include/linux/fdtable.h:
>
> file = rcu_dereference_check(fdt->fd[fd],
> rcu_read_lock_held() ||
> lockdep_is_held(&files->file_lock) ||
> atomic_read(&files->count) == 1);
>
> The first argument is the pointer, and the second argument says that
> this may be protected by either RCU (as opposed to RCU-bh, RCU-sched,
> or SRCU), the files->file_lock as recorded by lockdep, or by being in
> a single-threaded process as noted by the value of files->count.
> (Please see http://lwn.net/Articles/368683/ for a recent patch, another
> will go out soon.)
>
> So, could you please tell me what protects the rcu_dereference()
> in __in6_dev_get() so that I can craft the appropriate form of
> rcu_dereference()?
>
> Thanx, Paul
Hi Paul
__in6_dev_get() is called either with rcu_read_lock()/rcu_read_unlock() protection,
or with the RTNL mutex held.
Well, thats the theory, we could have some bugs of course :)
Thanks
next prev parent reply other threads:[~2010-01-15 5:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-14 18:32 What protects rcu_dereference() in __in6_dev_get()? Paul E. McKenney
2010-01-15 5:50 ` Eric Dumazet [this message]
2010-01-15 15:15 ` Paul E. McKenney
2010-01-15 15:29 ` Eric Dumazet
2010-01-15 15:31 ` Peter Zijlstra
2010-01-15 15:53 ` 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=4B500217.6070908@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=mingo@elte.hu \
--cc=netdev@vger.kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=yoshfuji@linux-ipv6.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).