From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [PATCH net-next] net: sched: always disable bh when taking tcf_lock Date: Sun, 19 Aug 2018 10:51:00 -0700 (PDT) Message-ID: <20180819.105100.1954465468537272629.davem@davemloft.net> References: <1534272376-7830-1-git-send-email-vladbu@mellanox.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, ast@kernel.org, daniel@iogearbox.net To: vladbu@mellanox.com Return-path: Received: from shards.monkeyblade.net ([23.128.96.9]:33414 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726425AbeHSVDQ (ORCPT ); Sun, 19 Aug 2018 17:03:16 -0400 In-Reply-To: <1534272376-7830-1-git-send-email-vladbu@mellanox.com> Sender: netdev-owner@vger.kernel.org List-ID: From: Vlad Buslov Date: Tue, 14 Aug 2018 21:46:16 +0300 > Recently, ops->init() and ops->dump() of all actions were modified to > always obtain tcf_lock when accessing private action state. Actions that > don't depend on tcf_lock for synchronization with their data path use > non-bh locking API. However, tcf_lock is also used to protect rate > estimator stats in softirq context by timer callback. > > Change ops->init() and ops->dump() of all actions to disable bh when using > tcf_lock to prevent deadlock reported by following lockdep warning: ... > Taking tcf_lock in sample action with bh disabled causes lockdep to issue a > warning regarding possible irq lock inversion dependency between tcf_lock, > and psample_groups_lock that is taken when holding tcf_lock in sample init: ... > In order to prevent potential lock inversion dependency between tcf_lock > and psample_groups_lock, extract call to psample_group_get() from tcf_lock > protected section in sample action init function. > > Fixes: 4e232818bd32 ("net: sched: act_mirred: remove dependency on rtnl lock") > Fixes: 764e9a24480f ("net: sched: act_vlan: remove dependency on rtnl lock") > Fixes: 729e01260989 ("net: sched: act_tunnel_key: remove dependency on rtnl lock") > Fixes: d77284956656 ("net: sched: act_sample: remove dependency on rtnl lock") > Fixes: e8917f437006 ("net: sched: act_gact: remove dependency on rtnl lock") > Fixes: b6a2b971c0b0 ("net: sched: act_csum: remove dependency on rtnl lock") > Fixes: 2142236b4584 ("net: sched: act_bpf: remove dependency on rtnl lock") > Signed-off-by: Vlad Buslov Applied, thanks Vlad.