* using rcu_read_lock() after calling dst_neigh_lookup
@ 2017-01-10 14:22 Hadar Hen Zion
2017-01-10 17:02 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Hadar Hen Zion @ 2017-01-10 14:22 UTC (permalink / raw)
To: davem; +Cc: netdev, ogerlitz, idosch
Hi Dave,
Drivers which are calling dst_neigh_lookup() are also using
rcu_read_lock() before accessing the neigh pointer (and asking it's ll
address data and its validity state).
You can find the same behavior in:
drivers/infiniband/core/addr.c, drivers/infiniband/hw/i40iw/i40iw_cm.c,
drivers/infiniband/hw/nes/nes_cm.c, etc.
(the above locations are just an example).
While the documentation in neighbour.c says:
"Neighbour entries are protected:
- with reference count.
- with rwlock neigh->lock
Reference count prevents destruction.
neigh->lock mainly serializes ll address data and its validity state."
So what is the right way to protect the neigh entry parameters? I
couldn't find why rcu_read_lock() is helping here (dst_neigh_lookup
already takes a reference on the neigh).
Thank you,
Hadar
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: using rcu_read_lock() after calling dst_neigh_lookup
2017-01-10 14:22 using rcu_read_lock() after calling dst_neigh_lookup Hadar Hen Zion
@ 2017-01-10 17:02 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-01-10 17:02 UTC (permalink / raw)
To: hadarh; +Cc: netdev, ogerlitz, idosch
From: Hadar Hen Zion <hadarh@mellanox.com>
Date: Tue, 10 Jan 2017 16:22:51 +0200
> While the documentation in neighbour.c says:
>
> "Neighbour entries are protected:
> - with reference count.
> - with rwlock neigh->lock
> Reference count prevents destruction.
> neigh->lock mainly serializes ll address data and its validity state."
>
> So what is the right way to protect the neigh entry parameters? I
> couldn't find why rcu_read_lock() is helping here (dst_neigh_lookup
> already takes a reference on the neigh).
Documentation is, unfortunately, out of date.
When there is a mis-match, usually the behavior of the code in the
tree trumps whatever the documentation says.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-01-10 17:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-10 14:22 using rcu_read_lock() after calling dst_neigh_lookup Hadar Hen Zion
2017-01-10 17:02 ` David Miller
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.