openvswitch: Silence RCU lockdep checks from flow lookup.
authorJesse Gross <jesse@nicira.com>
Tue, 3 Dec 2013 18:58:53 +0000 (10:58 -0800)
committerJesse Gross <jesse@nicira.com>
Mon, 6 Jan 2014 23:51:48 +0000 (15:51 -0800)
Flow lookup can happen either in packet processing context or userspace
context but it was annotated as requiring RCU read lock to be held. This
also allows OVS mutex to be held without causing warnings.

Reported-by: Justin Pettit <jpettit@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Reviewed-by: Thomas Graf <tgraf@redhat.com>
net/openvswitch/datapath.c
net/openvswitch/datapath.h
net/openvswitch/flow_table.c

index fcaed98b2c0d0b4df73da61f84e47c450716803a..0727aaa2c825916c2b6902841282cce154eefe94 100644 (file)
@@ -701,8 +701,7 @@ static int ovs_flow_cmd_fill_info(struct sw_flow *flow, struct datapath *dp,
        if (start) {
                const struct sw_flow_actions *sf_acts;
 
-               sf_acts = rcu_dereference_check(flow->sf_acts,
-                                               lockdep_ovsl_is_held());
+               sf_acts = rcu_dereference_ovsl(flow->sf_acts);
 
                err = ovs_nla_put_actions(sf_acts->actions,
                                          sf_acts->actions_len, skb);
index 4067ea41be28d725c1312f2bb995df4e2c2209ab..ba13be4a680f51c4a20fb946a33b6f5dffa6d01d 100644 (file)
@@ -145,6 +145,8 @@ int lockdep_ovsl_is_held(void);
 #define ASSERT_OVSL()          WARN_ON(unlikely(!lockdep_ovsl_is_held()))
 #define ovsl_dereference(p)                                    \
        rcu_dereference_protected(p, lockdep_ovsl_is_held())
+#define rcu_dereference_ovsl(p)                                        \
+       rcu_dereference_check(p, lockdep_ovsl_is_held())
 
 static inline struct net *ovs_dp_get_net(struct datapath *dp)
 {
index 261a54e77503e885f41355c3f702ad1bff958f94..7b9cf2c43813c1d90917ce735dd85dc358cf8aea 100644 (file)
@@ -433,7 +433,7 @@ struct sw_flow *ovs_flow_tbl_lookup_stats(struct flow_table *tbl,
                                    const struct sw_flow_key *key,
                                    u32 *n_mask_hit)
 {
-       struct table_instance *ti = rcu_dereference(tbl->ti);
+       struct table_instance *ti = rcu_dereference_ovsl(tbl->ti);
        struct sw_flow_mask *mask;
        struct sw_flow *flow;