Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp714530imm; Mon, 21 May 2018 13:03:50 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqy8yZYdFb5F+vlCeVwo/u7d6NY39ABBPEZL2a84MmZNNPOAD/lgHSY4lHq3eXKJ6rG03In X-Received: by 2002:a63:81c7:: with SMTP id t190-v6mr19105pgd.378.1526933030608; Mon, 21 May 2018 13:03:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526933030; cv=none; d=google.com; s=arc-20160816; b=WL3yRLgr9jphiLbB5K/xdll2qtvwbYo3nusb/OmlJeKIg0BPL8Xp2h12cg4+oQB3wx MMf1QbYuc/6HFlDCCwZRJM8fG5gB31SSuPGHiC0x90BJ6b5SBWTD4rjJkTcQiAWJdz+c Aqow1sxI8o7qotl1oBJ1OWDi8xXwEJ/xnlCyQ7qMUMZZ7yBW6wkBMkdtViRohP66y52I PDVJdZwMSkTld46mCVClJMcOHHAhLEgdO3n5+4D4RCtKUZRPk9rkJDI5afZ0ylF1MHcG i5FSmQSgQGCwqaQuVkUZbLBT6ZEenQPcD76OhQx+MqXE677cwjLREdT092JSnPp6L8ZS gA1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=BhQZaqhK2H+MaWHhfzc30ZW6wndBpA3ojWkl3fBVgVA=; b=MWFOtRzMHSylfMLSBiSoRWjX4zOxo4Yn0ANG3uMfl1hau5ZsqWseZhbRF5hvhoprBk 9vb7jtxJDNi91mDamTzfVos6q7Mr0Uhkg0t/q3Z0HpDnMqwc7pNgJu4rxexkPgoiewzT wU+e1Eg8vLaQ2DZ12qOZnY2Kd7LigMvWXXb42g5/qZbm+FphUfOFV4dWi9rAmePwQPAp JWsgYvTrfwJKc3iqzMQisW27K1fZnhE1D49m81HjkX1nuYVUnWrvI5R+tMdEVsyldhi2 Gcc8fHn0Y0KZKLaSrNwxsqVrBomuJ4QMfQ/32bpQ8RbR7zPkLe8WeukPP5FDoLgsKPsU trkg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h12-v6si14998528pfd.253.2018.05.21.13.03.33; Mon, 21 May 2018 13:03:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751246AbeEUUDV (ORCPT + 99 others); Mon, 21 May 2018 16:03:21 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:60559 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750947AbeEUUDT (ORCPT ); Mon, 21 May 2018 16:03:19 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from vladbu@mellanox.com) with ESMTPS (AES256-SHA encrypted); 21 May 2018 23:05:12 +0300 Received: from reg-r-vrt-018-180.mtr.labs.mlnx (reg-r-vrt-018-180.mtr.labs.mlnx [10.213.18.180]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id w4LK3HTB012434; Mon, 21 May 2018 23:03:17 +0300 From: Vlad Buslov To: davem@davemloft.net Cc: netdev@vger.kernel.org, jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, linux-kernel@vger.kernel.org, Vlad Buslov Subject: [PATCH net-next v2] net: sched: don't disable bh when accessing action idr Date: Mon, 21 May 2018 23:03:04 +0300 Message-Id: <1526932984-11544-1-git-send-email-vladbu@mellanox.com> X-Mailer: git-send-email 2.7.5 In-Reply-To: <20180519.230258.1374885458106197707.davem@davemloft.net> References: <20180519.230258.1374885458106197707.davem@davemloft.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Initial net_device implementation used ingress_lock spinlock to synchronize ingress path of device. This lock was used in both process and bh context. In some code paths action map lock was obtained while holding ingress_lock. Commit e1e992e52faa ("[NET_SCHED] protect action config/dump from irqs") modified actions to always disable bh, while using action map lock, in order to prevent deadlock on ingress_lock in softirq. This lock was removed from net_device, so disabling bh, while accessing action map, is no longer necessary. Replace all action idr spinlock usage with regular calls that do not disable bh. Signed-off-by: Vlad Buslov --- net/sched/act_api.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 72251241665a..3f4cf930f809 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@ -77,9 +77,9 @@ static void free_tcf(struct tc_action *p) static void tcf_idr_remove(struct tcf_idrinfo *idrinfo, struct tc_action *p) { - spin_lock_bh(&idrinfo->lock); + spin_lock(&idrinfo->lock); idr_remove(&idrinfo->action_idr, p->tcfa_index); - spin_unlock_bh(&idrinfo->lock); + spin_unlock(&idrinfo->lock); gen_kill_estimator(&p->tcfa_rate_est); free_tcf(p); } @@ -156,7 +156,7 @@ static int tcf_dump_walker(struct tcf_idrinfo *idrinfo, struct sk_buff *skb, struct tc_action *p; unsigned long id = 1; - spin_lock_bh(&idrinfo->lock); + spin_lock(&idrinfo->lock); s_i = cb->args[0]; @@ -191,7 +191,7 @@ static int tcf_dump_walker(struct tcf_idrinfo *idrinfo, struct sk_buff *skb, if (index >= 0) cb->args[0] = index + 1; - spin_unlock_bh(&idrinfo->lock); + spin_unlock(&idrinfo->lock); if (n_i) { if (act_flags & TCA_FLAG_LARGE_DUMP_ON) cb->args[1] = n_i; @@ -261,9 +261,9 @@ static struct tc_action *tcf_idr_lookup(u32 index, struct tcf_idrinfo *idrinfo) { struct tc_action *p = NULL; - spin_lock_bh(&idrinfo->lock); + spin_lock(&idrinfo->lock); p = idr_find(&idrinfo->action_idr, index); - spin_unlock_bh(&idrinfo->lock); + spin_unlock(&idrinfo->lock); return p; } @@ -323,7 +323,7 @@ int tcf_idr_create(struct tc_action_net *tn, u32 index, struct nlattr *est, } spin_lock_init(&p->tcfa_lock); idr_preload(GFP_KERNEL); - spin_lock_bh(&idrinfo->lock); + spin_lock(&idrinfo->lock); /* user doesn't specify an index */ if (!index) { index = 1; @@ -331,7 +331,7 @@ int tcf_idr_create(struct tc_action_net *tn, u32 index, struct nlattr *est, } else { err = idr_alloc_u32(idr, NULL, &index, index, GFP_ATOMIC); } - spin_unlock_bh(&idrinfo->lock); + spin_unlock(&idrinfo->lock); idr_preload_end(); if (err) goto err3; @@ -369,9 +369,9 @@ void tcf_idr_insert(struct tc_action_net *tn, struct tc_action *a) { struct tcf_idrinfo *idrinfo = tn->idrinfo; - spin_lock_bh(&idrinfo->lock); + spin_lock(&idrinfo->lock); idr_replace(&idrinfo->action_idr, a, a->tcfa_index); - spin_unlock_bh(&idrinfo->lock); + spin_unlock(&idrinfo->lock); } EXPORT_SYMBOL(tcf_idr_insert); -- 2.7.5