Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp918050rdb; Sun, 1 Oct 2023 10:54:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGwMcJsKpHsV7XUYXKaOcFg3+IuAT69qRj+u0rslSkJeWCpwVddTyoJ1qjQYEbBxl3WE64r X-Received: by 2002:a17:902:c948:b0:1bf:193a:70b6 with SMTP id i8-20020a170902c94800b001bf193a70b6mr14704635pla.5.1696182880937; Sun, 01 Oct 2023 10:54:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696182880; cv=none; d=google.com; s=arc-20160816; b=SA+KQFelYuWPaSl6pEjQQyQp0v06gWsuxHsKRbfhhDP6ismW6ajDUUbEhcVhCW5Mog KssXEKBsHbm+u92QXLhUQ/C3mdSbXcKAqlJ5c8tc8It/OMTU7EGnMJCZvaEZhUmAfazy 7i1wZJuQS66rTQomA/bMyMW6MdwIZgWBhpQdEwiUREdihqGm+zHu5RtgBQUuSWUW9oxS F5twaIofu6uqNS6c3dBY0QIxIx37O5mx4bodUYcynKdWu/sSzir3JOoUjJSUXCa3Idy0 +eBUXt7km8smktTBaR7nqVGoad+YjjD5VuraAnOwhe7GLJOrAsDxwn9+3/A6pw0maNHJ wiTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ZGdH6OGA28D4kIb2fOA4jtf1yjVWZCjTMvX5Ivuec8g=; fh=OjINi0+dZO1++6J7T5+qj8gtW17n7RqUbB8zEmJcqmo=; b=OrKwdq/wd7R0GynyRHgsa53TVmO5anvw6nMa7T1ywL7PLUtVDsUQnM7LZmQy1nQXfu dWmN+XZjD0/Co3lDF43nYkwB5KvqjjrCYwEHygnP/nRrrgIHNRXVlfSWtQnROHpqXRgC 9Qdl/pjf15s2kjYxZ+PgcR9PPyo7MY5YBXcQXZGl4J9m7CIuEEEBvPLtzYcNnsYzaZdN +z49vG5islXBUwpVyRcPSpbf9MFadXLUkXbnIhLaD46EwY8vlAsxl+197cRkSdrTxcfL /Ri7JHZJhHF5P+dLXWKUpcPK3DjmLU6tuPaf6FPfFVFRlR09ZDXlsor02zOWt893g/CF dIaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SYU3gK0l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id c15-20020a170902d48f00b001b81fe65fa3si27916092plg.569.2023.10.01.10.54.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 10:54:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SYU3gK0l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 91FA4808D21F; Sun, 1 Oct 2023 10:54:38 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235270AbjJARyb (ORCPT + 99 others); Sun, 1 Oct 2023 13:54:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233932AbjJARya (ORCPT ); Sun, 1 Oct 2023 13:54:30 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D32F3A7 for ; Sun, 1 Oct 2023 10:54:27 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 238FBC433C7; Sun, 1 Oct 2023 17:54:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696182867; bh=Lk94c1Pr/kdJ6GO1+4Jo2iWmzYgaMVSKIR6PfPgI5DY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SYU3gK0lrlOPDbGgFKYHIZ1a5cj3aSJUVifwAp4V56PstaLW5RB0/24mz2NM0QbSA 7i7VeKINiCQRgHFuuugaxJ5Jk73ff3OIyfu2U2Jv9k9XXXlXxYkCT6pkqtWFipNpNy 6A3T9LgCnRV5gOfNuKBxlsYOeljTfTCMvXngAIDh6ZOoAHrxXtEdE8KXkJGikpfapH ciixqEYsQwnm/AqHuodprrxzFqt1PO5S76zJHXoBTeXtdur/pA2nxYoQGC8VyvZuGq flPPtlzVXgeIpxzz8n+HImPLBgydJ5qPWpibnQQpdz51zaNXMW+ctkz2oAZOIm5EL8 FT58b0nHnXItw== Date: Sun, 1 Oct 2023 19:54:22 +0200 From: Simon Horman To: Chengfeng Ye Cc: jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Pedro Tammela , Po Liu Subject: Re: [PATCH] net/sched: use spin_lock_bh() on &gact->tcf_lock Message-ID: <20231001175422.GT92317@kernel.org> References: <20230926182625.72475-1-dg573847474@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230926182625.72475-1-dg573847474@gmail.com> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Sun, 01 Oct 2023 10:54:38 -0700 (PDT) + Pedro Tammela Po Liu On Tue, Sep 26, 2023 at 06:26:25PM +0000, Chengfeng Ye wrote: > I find tcf_gate_act() acquires &gact->tcf_lock without disable > bh explicitly, as gact->tcf_lock is acquired inside timer under > softirq context, if tcf_gate_act() is not called with bh disable > by default or under softirq context(which I am not sure as I cannot > find corresponding documentation), then it could be the following > deadlocks. > > tcf_gate_act() > --> spin_loc(&gact->tcf_lock) > > --> gate_timer_func() > --> spin_lock(&gact->tcf_lock) > > Signed-off-by: Chengfeng Ye Hi Chengfeng Ye, thanks for your patch. As a fix for Networking this should probably be targeted at the 'net' tree. Which should be denoted in the subject. Subject: [PATCH net] ... And as a fix this patch should probably have a Fixes tag. This ones seem appropriate to me, but I could be wrong. Fixes: a51c328df310 ("net: qos: introduce a gate control flow action") I don't think it is necessary to repost just to address these issues, but the Networking maintainers may think otherwise. The code change itself looks good to me. Reviewed-by: Simon Horman > --- > net/sched/act_gate.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/net/sched/act_gate.c b/net/sched/act_gate.c > index c9a811f4c7ee..b82daf7401a5 100644 > --- a/net/sched/act_gate.c > +++ b/net/sched/act_gate.c > @@ -124,25 +124,25 @@ TC_INDIRECT_SCOPE int tcf_gate_act(struct sk_buff *skb, > tcf_lastuse_update(&gact->tcf_tm); > tcf_action_update_bstats(&gact->common, skb); > > - spin_lock(&gact->tcf_lock); > + spin_lock_bh(&gact->tcf_lock); > if (unlikely(gact->current_gate_status & GATE_ACT_PENDING)) { > - spin_unlock(&gact->tcf_lock); > + spin_unlock_bh(&gact->tcf_lock); > return action; > } > > if (!(gact->current_gate_status & GATE_ACT_GATE_OPEN)) { > - spin_unlock(&gact->tcf_lock); > + spin_unlock_bh(&gact->tcf_lock); > goto drop; > } > > if (gact->current_max_octets >= 0) { > gact->current_entry_octets += qdisc_pkt_len(skb); > if (gact->current_entry_octets > gact->current_max_octets) { > - spin_unlock(&gact->tcf_lock); > + spin_unlock_bh(&gact->tcf_lock); > goto overlimit; > } > } > - spin_unlock(&gact->tcf_lock); > + spin_unlock_bh(&gact->tcf_lock); > > return action; > > -- > 2.17.1 > >