netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* What protects rcu_dereference() in __in6_dev_get()?
@ 2010-01-14 18:32 Paul E. McKenney
  2010-01-15  5:50 ` Eric Dumazet
  0 siblings, 1 reply; 6+ messages in thread
From: Paul E. McKenney @ 2010-01-14 18:32 UTC (permalink / raw)
  To: yoshfuji; +Cc: netdev, eric.dumazet, mingo, akpm, peterz

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-01-15 15:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-14 18:32 What protects rcu_dereference() in __in6_dev_get()? Paul E. McKenney
2010-01-15  5:50 ` Eric Dumazet
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

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).