[ovs-git] Open vSwitch: datapath: Use local variable for freeing on flow put error. (master)

dev at openvswitch.org dev at openvswitch.org
Wed Dec 29 18:48:48 UTC 2010


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Open vSwitch".

The branch, master has been updated
       via  3d82583c40055f6cc257fc4663c2ac14498c7464 (commit)
       via  1326754973a4ecb53ede31e8d3e38d472ca50091 (commit)
       via  6b02c20141e318bf95ecbd384c73bdf7f74920d3 (commit)
       via  39872c70e2feefb85e3d7aa577d281d20c8decf6 (commit)
       via  9c150f6a7039218080e067e9955aac0f6a55a712 (commit)
       via  4885254becfd531f8a24adb33f8c62c2f17debb0 (commit)
       via  7e71ab66e9a164359c0a5f1d6a20bb2efc15500f (commit)
       via  1452b28ca636521b6e16f76787524f83205ec7a3 (commit)
       via  6f20002c1201c1fc78fc7cedb49b103d8afe9da6 (commit)
       via  f827d749920e1bcc275660695144d25c7adbbd4b (commit)
      from  e70f33fc8ae27732edd40841402bc38a3ca5d42a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 3d82583c40055f6cc257fc4663c2ac14498c7464
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=3d82583c40055f6cc257fc4663c2ac14498c7464
Author: Jesse Gross <jesse at nicira.com>
		
datapath: Use local variable for freeing on flow put error.
		
If inserting a flow failed and we need to free the actions, we
currently directly free them from the flow struct.  This is fine
but it makes sparse complain about directly accessing an RCU
protected field.  We could insert some casts to avoid this but
it's cleaner to just free the data from the local variable
instead.

Found with sparse.

Signed-off-by: Jesse Gross <jesse at nicira.com>
Acked-by: Ben Pfaff <blp at nicira.com>


commit 1326754973a4ecb53ede31e8d3e38d472ca50091
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=1326754973a4ecb53ede31e8d3e38d472ca50091
Author: Jesse Gross <jesse at nicira.com>
		
datapath: Allocate vports in more RCU friendly manner.
		
In a few places, when creating a new vport we also need to allocate
some memory for configuration that can change.  This data is protected
by RCU but we directly access the memory when initializing it.  This
is fine, since the vport has not yet been published and we use the
apropriate memory barriers when doing so.  However, it makes tools
like sparse unhappy and is also asymmetric since we use RCU to
dereference the pointers but not to assign them.  This cleans that
up somewhat by initializing the memory first and then using RCU
to assign it, which makes everyone happy.

Found with sparse.

Signed-off-by: Jesse Gross <jesse at nicira.com>
Acked-by: Ben Pfaff <blp at nicira.com>


commit 6b02c20141e318bf95ecbd384c73bdf7f74920d3
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=6b02c20141e318bf95ecbd384c73bdf7f74920d3
Author: Jesse Gross <jesse at nicira.com>
		
datapath: Use RCU dereference in vport_get_ifindex().
		
If we don't have an ifindex for a device (because it is a virtual
port), we fall back to using the ifindex of the local port.
However, we weren't properly dereferencing the vport from the ports
array, so this adds that.  This isn't a real problem though, because
the local port always exists and never changes as long as the
datapath exists.

Found with sparse.

Signed-off-by: Jesse Gross <jesse at nicira.com>
Acked-by: Ben Pfaff <blp at nicira.com>


commit 39872c70e2feefb85e3d7aa577d281d20c8decf6
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=39872c70e2feefb85e3d7aa577d281d20c8decf6
Author: Jesse Gross <jesse at nicira.com>
		
datapath: Add casts for direct freeing of RCU data.
		
There are a few places where we have two levels of RCU protected
data to allow the second level to change independently of the
first.  Although the two pieces are independent, they have the
same users and lifetime of the first level always exceeds that
of the second level.  This means that we can directly free the
second level when it is safe to free the first.  This implies
that we directly access RCU-protected data, which is generally
not allowed.  There are no locks to check, so none of the normal
RCU functions apply.  Instead, this adds an explicit cast.

Found with sparse.

Signed-off-by: Jesse Gross <jesse at nicira.com>
Acked-by: Ben Pfaff <blp at nicira.com>


commit 9c150f6a7039218080e067e9955aac0f6a55a712
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=9c150f6a7039218080e067e9955aac0f6a55a712
Author: Jesse Gross <jesse at nicira.com>
		
tunnel: Drop spinlock around cache free.
		
We hold a spinlock when freeing the cache, since you're generally
supposed to do that when writing to RCU protected data.  However,
there's really no point in doing that here because the port has
already been removed from both the transmit and receive side
data structures and we've waited for an RCU grace period.  In
addition, we're about to free the port itself, which contains the
spinlock and will be in trouble if anyone else is trying to
access it.  For clarity, drop the spinlock.

Signed-off-by: Jesse Gross <jesse at nicira.com>
Acked-by: Ben Pfaff <blp at nicira.com>


commit 4885254becfd531f8a24adb33f8c62c2f17debb0
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=4885254becfd531f8a24adb33f8c62c2f17debb0
Author: Jesse Gross <jesse at nicira.com>
		
datapath: Fix table sparse annotations.
		
Several of the pointers in table.c were missing the correct
__rcu annotation and the pointer type in the actual declaration
of struct tbl was incorrect, so this fixes that.  It also adds
usage of rcu_dereference() to access an RCU protected pointer,
which is not strictly correct since an update side lock should
be held.  However, since the table is used in different pieces
of code and therefore different locks are used it is difficult
to know which lock to check without threading the information
though, which is ugly.  Since other places in table.c have this
same problem and this code should go away in the future it is
left as is.

Found with sparse.

Signed-off-by: Jesse Gross <jesse at nicira.com>
Acked-by: Ben Pfaff <blp at nicira.com>


commit 7e71ab66e9a164359c0a5f1d6a20bb2efc15500f
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=7e71ab66e9a164359c0a5f1d6a20bb2efc15500f
Author: Jesse Gross <jesse at nicira.com>
		
datapath: Don't directly access port array in query_port().
		
query_port() directly accesses the datapath port array, without
using any kind of RCU dereference.  It's OK, since it is holding
DP mutex but this adds an explicit check to make sparse happy.
It also simplifies the code path somewhat.

Found with sparse.

Signed-off-by: Jesse Gross <jesse at nicira.com>
Acked-by: Ben Pfaff <blp at nicira.com>


commit 1452b28ca636521b6e16f76787524f83205ec7a3
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=1452b28ca636521b6e16f76787524f83205ec7a3
Author: Jesse Gross <jesse at nicira.com>
		
datapath: Add get_vport_protected().
		
In some places we access the array of datapath ports without
RCU protection.  This introduces a new function to check that in
these case the dp mutex is held for protection.

Found with sparse.

Signed-off-by: Jesse Gross <jesse at nicira.com>
Acked-by: Ben Pfaff <blp at nicira.com>


commit 6f20002c1201c1fc78fc7cedb49b103d8afe9da6
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=6f20002c1201c1fc78fc7cedb49b103d8afe9da6
Author: Jesse Gross <jesse at nicira.com>
		
datapath: Use get_table_protected() in additional places.
		
There are several places where the flow table is accessed
without any kind of RCU protection.  This is fine because dp
mutex is held so this adds checks for that condition.

Found with sparse.

Signed-off-by: Jesse Gross <jesse at nicira.com>
Acked-by: Ben Pfaff <blp at nicira.com>


commit f827d749920e1bcc275660695144d25c7adbbd4b
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=f827d749920e1bcc275660695144d25c7adbbd4b
Author: Jesse Gross <jesse at nicira.com>
		
datapath: Add missing rtnl_dereference() calls.
		
There are a few additional places where RCU protected pointers
are directly dereferenced because they assume RTNL lock.  These
were previously not reported due to some other sparse errors in
the Linux headers files.  This adds the necessary rtnl_dereference()
calls to make sparse happy and allow lockdep to validate.

Found with sparse.

Signed-off-by: Jesse Gross <jesse at nicira.com>
Acked-by: Ben Pfaff <blp at nicira.com>


-----------------------------------------------------------------------

Summary of changes:
 datapath/datapath.c    |   63 +++++++++++++++++++++--------------------------
 datapath/flow.c        |    2 +-
 datapath/table.c       |   13 +++++----
 datapath/table.h       |    2 +-
 datapath/tunnel.c      |   48 +++++++++++++++++++----------------
 datapath/vport-patch.c |   31 +++++++++++++----------
 datapath/vport.c       |   11 ++++----
 7 files changed, 87 insertions(+), 83 deletions(-)


hooks/post-receive
-- 
Open vSwitch




More information about the git mailing list