From patchwork Tue Feb 24 19:10:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Salisbury X-Patchwork-Id: 443108 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 4F360140151; Wed, 25 Feb 2015 06:10:42 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1YQKsN-00057L-H2; Tue, 24 Feb 2015 19:10:35 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1YQKsF-00055i-6W for kernel-team@lists.ubuntu.com; Tue, 24 Feb 2015 19:10:27 +0000 Received: from [10.172.67.212] (helo=salisbury) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1YQKsF-00069f-1x for kernel-team@lists.ubuntu.com; Tue, 24 Feb 2015 19:10:27 +0000 Received: by salisbury (Postfix, from userid 1000) id 6F6BD780667; Tue, 24 Feb 2015 14:10:24 -0500 (EST) From: Joseph Salisbury To: kernel-team@lists.ubuntu.com Subject: [SRU][Trusty][PATCH 1/2] openvswitch: Silence RCU lockdep checks from flow lookup. Date: Tue, 24 Feb 2015 14:10:23 -0500 Message-Id: <1006bc4539d6f0df8df09e6a0a6179b3af7a30db.1424801573.git.joseph.salisbury@canonical.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: References: In-Reply-To: References: X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com From: Jesse Gross BugLink: http://bugs.launchpad.net/bugs/1408972 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 (cherry picked from commit 663efa3696232300a8ad3a46bb10482fc0b861cf) Signed-off-by: Joseph Salisbury --- net/openvswitch/datapath.c | 3 +-- net/openvswitch/datapath.h | 2 ++ net/openvswitch/flow_table.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index 654e058..1582faf 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -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); diff --git a/net/openvswitch/datapath.h b/net/openvswitch/datapath.h index 4067ea4..ba13be4 100644 --- a/net/openvswitch/datapath.h +++ b/net/openvswitch/datapath.h @@ -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) { diff --git a/net/openvswitch/flow_table.c b/net/openvswitch/flow_table.c index e425427..0ddf2bc 100644 --- a/net/openvswitch/flow_table.c +++ b/net/openvswitch/flow_table.c @@ -433,7 +433,7 @@ struct sw_flow *ovs_flow_tbl_lookup(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;