[ovs-dev] [vport-stats 2/3] datapath: Push locking down from vport_get_stats() to ->get_stats().
Ben Pfaff
blp at nicira.com
Wed Jan 5 22:40:45 UTC 2011
On Wed, Jan 05, 2011 at 05:34:23PM -0500, Jesse Gross wrote:
> On Wed, Jan 5, 2011 at 1:24 PM, Ben Pfaff <blp at nicira.com> wrote:
> > It seems odd to take and release a lock around this function call in
> > vport_get_stats(), since it doesn't provide any additional protection to
> > the caller and there is only one implementation. So push it down into
> > the callee.
> >
> > I'm not certain that rcu_read_lock() is necessary for dev_get_stats().
> > Documentation/networking/netdevices.txt claims that dev_base_lock is to be
> > used, but existing kernel callers don't all take that. Some do take
> > rcu_read_lock(). Really what we need to guarantee is that the network
> > device won't disappear on us, and it looks like we have sufficient locking
> > for that.
>
> rcu_read_lock() isn't required for dev_get_stats(). The reason for
> taking it here is that it keeps the locking guarantees for vport
> implementations simple. They are:
> * All write operations hold RTNL.
> * All read operations hold RCU.
>
> So this is just for consistency, which I think has some value.
OK, I'll buy that.
I'll drop this and update the next patch instead.
More information about the dev
mailing list