From 780ec6aea9f2c664953c3c84468d77f6daf53925 Mon Sep 17 00:00:00 2001 From: Jesse Gross Date: Mon, 2 Dec 2013 18:56:32 -0800 Subject: [PATCH] datapath: Silence RCU lockdep checks from flow lookup. 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 Signed-off-by: Jesse Gross Reviewed-by: Thomas Graf --- datapath/datapath.c | 3 +-- datapath/datapath.h | 2 ++ datapath/flow_table.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index d0a85958c..75edd178d 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -695,8 +695,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); diff --git a/datapath/datapath.h b/datapath/datapath.h index 879a8309c..89ba80f9e 100644 --- a/datapath/datapath.h +++ b/datapath/datapath.h @@ -148,6 +148,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) { diff --git a/datapath/flow_table.c b/datapath/flow_table.c index 29cfcbe86..859765141 100644 --- a/datapath/flow_table.c +++ b/datapath/flow_table.c @@ -438,7 +438,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; -- 2.20.1