Skip to content

Commit

Permalink
openvswitch: Silence RCU lockdep checks from flow lookup.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jesse Gross committed Jan 6, 2014
1 parent 5bb5063 commit 663efa3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 1 addition & 2 deletions net/openvswitch/datapath.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions net/openvswitch/datapath.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion net/openvswitch/flow_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 663efa3

Please sign in to comment.