Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

openvswitch: 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 <jpettit@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Reviewed-by: Thomas Graf <tgraf@redhat.com>

+4 -3
+1 -2
net/openvswitch/datapath.c
··· 701 701 if (start) { 702 702 const struct sw_flow_actions *sf_acts; 703 703 704 - sf_acts = rcu_dereference_check(flow->sf_acts, 705 - lockdep_ovsl_is_held()); 704 + sf_acts = rcu_dereference_ovsl(flow->sf_acts); 706 705 707 706 err = ovs_nla_put_actions(sf_acts->actions, 708 707 sf_acts->actions_len, skb);
+2
net/openvswitch/datapath.h
··· 145 145 #define ASSERT_OVSL() WARN_ON(unlikely(!lockdep_ovsl_is_held())) 146 146 #define ovsl_dereference(p) \ 147 147 rcu_dereference_protected(p, lockdep_ovsl_is_held()) 148 + #define rcu_dereference_ovsl(p) \ 149 + rcu_dereference_check(p, lockdep_ovsl_is_held()) 148 150 149 151 static inline struct net *ovs_dp_get_net(struct datapath *dp) 150 152 {
+1 -1
net/openvswitch/flow_table.c
··· 433 433 const struct sw_flow_key *key, 434 434 u32 *n_mask_hit) 435 435 { 436 - struct table_instance *ti = rcu_dereference(tbl->ti); 436 + struct table_instance *ti = rcu_dereference_ovsl(tbl->ti); 437 437 struct sw_flow_mask *mask; 438 438 struct sw_flow *flow; 439 439