[ovs-dev] [PATCH 00/12] sparse/lockdep fixes
Jesse Gross
jesse at nicira.com
Sun Dec 12 20:52:55 UTC 2010
This series of patches adds the annotations/casts/etc. that
make sparse and lockdep happy. It does not contain any actual
fixes - everything that I found using these tools I have already
pushed. When not used with either of these tools there should
be almost no impact on the compiled binary whatsoever. The one
change is that some instances of rcu_dereference() have been
coverted to rcu_dereference_protected() in places where a lock
is always held. The reason for this change was simply to better
annotate the expected conditions, however, it also has the effect
of allowing the read memory barrier to be omitted and some additional
freedom to the compiler for optimizations.
These changes make sparse and lockdep much more helpful by providing
them with correct information. However, there are still a few issues
that I know about (applies to the current net-next-2.6 branch, earlier
kernels have less complete annotations in the headers):
* When configured with CONFIG_SPARSE_RCU_POINTER, we get a number
of warnings from sparse in kmem.h. It does not appear that these
are actually our problem and seem to show up when we allocate
memory.
* Functions in table.c do not currently check for update side locks.
We access these functions when protected by a lock and without
holding rcu_read_lock, which causes lockdep to warn. I actually
have a patch for this but decided not to include it because it is
ugly and hopefully table.c is going away soon.
* The network stack calls us with rcu_read_lock_bh() but we don't
use rcu_dereference_bh(), which again causes lockdep to warn. This
isn't actually a problem (though we could get shorter grace period
times if we used the _bh versions). I think the right long term
solution is to always run with bottom halves disabled, if only to
better match up with the rest of the network stack and have less to
worry about. Nearly all of our packets are already processed in
softirq context, so this isn't a major change, it would simply
require disabling bottom halves when we get packets from userspace.
I decided to leave this change for another day though.
Jesse Gross (12):
datapath: Add compatibility code for sparse annotations.
datapath: Compatibility code for RCU check functions.
datapath: Correct usage of __user annotation.
datapath: Add usage of __percpu annotation.
datapath: Add usage of __rcu annotation.
datapath: Correct byte order annotations.
datapath: Don't directly access RCU protected pointers.
datapath: Convert rcu_dereference() to correct variant.
tunneling: Add checks for header cache lock.
datapath: Validate access to DP array.
datapath: Check locks on access to flow table.
datapath: Validate lock when handling flow actions.
datapath/datapath.c | 117 ++++++++++++--------
datapath/datapath.h | 8 +-
datapath/dp_sysfs_dp.c | 6 +-
datapath/dp_sysfs_if.c | 5 +-
datapath/flow.c | 2 +-
datapath/flow.h | 2 +-
datapath/linux-2.6/Modules.mk | 1 +
.../linux-2.6/compat-2.6/include/linux/compiler.h | 14 +++
.../linux-2.6/compat-2.6/include/linux/rtnetlink.h | 48 ++++++++
datapath/table.c | 10 +-
datapath/table.h | 2 +-
datapath/tunnel.c | 63 ++++++-----
datapath/tunnel.h | 4 +-
datapath/vport-gre.c | 8 +-
datapath/vport-netdev.c | 4 +-
datapath/vport-patch.c | 14 +--
datapath/vport.h | 2 +-
17 files changed, 206 insertions(+), 104 deletions(-)
create mode 100644 datapath/linux-2.6/compat-2.6/include/linux/compiler.h
More information about the dev
mailing list