From patchwork Sun Jan 8 09:48:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Schultz X-Patchwork-Id: 40486 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1639268wrt; Sun, 8 Jan 2023 01:54:11 -0800 (PST) X-Google-Smtp-Source: AMrXdXtG2FJzLkiOck4dlo6Irbvx73Eb1tzyFzqqR9FEs0QrbmdY/4a24fDUXHnZ9xWtqaJ0y68q X-Received: by 2002:a05:6a20:3c8f:b0:a3:bdd3:8cb0 with SMTP id b15-20020a056a203c8f00b000a3bdd38cb0mr89743341pzj.56.1673171650906; Sun, 08 Jan 2023 01:54:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673171650; cv=none; d=google.com; s=arc-20160816; b=LMOQZJdVGlc3Zhsq7vrnQNhQMrJwoxd589oycz/x492ymRCw5Z8PAbPfo2CBtpats8 FwkTx/sX2Qh1glFY9ZK7suIIy7U7YzNCv8YE8ejV2MD5UmdIc8VsBaIn+SZ6YkN8GY0w 0ri8nMsRoLD8CfpfENf2zL8pftwTmil6xq9EFme51r4TxwRKqPoQCu6VjT+i28irMO/r RmmbmMMG/1fRpjL1dOMkn9GkFoIFajqTp++ZTpU3MwVJlLrcBFHqKpRRj6ZMc95p/eW5 rGzlJaoX0uATCe6syGVzQqGNyoPJNIyAd8E+m5uUV9+Hz84w+s5KrJs44InTDw0OE4Xu wZqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:organization :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=zgkG+I50iPd6i4aKg0fhVxbe0sxsb6fqwU7o0ggYlE4=; b=Xj2YyXGIELZ8dZp+/aBl2D4fbfYmRqE7GYT9cr1DRPB1qAYxPR108RNrJc4nTaSd/Q UBSqhLfab0Tdf6AAJilQWRDBx+LJhJLn0+zG5ak/SvfnuRjOdFnK5duM1MNU/adex24r rHoikTkTnM2TkoCGKlWDS+q1tffqU8zTjEy8GRfPQdp5+A4lvgVHao12WIQLBc90zrca AAfoUKBluTR876mBL2aV0UdfbAvb+TXHBLaJwLIrqdX9bidu6AB6bPgtgBzpBO2WrgiV cp1uOXH8NgssXjuIqkr69Lk3dtTYQNqiDb/u9Vn/QoWh5lTpboJqJEffpH/sN80KghLU D8xA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l8-20020a056a0016c800b0058426b3545fsi6501992pfc.113.2023.01.08.01.53.58; Sun, 08 Jan 2023 01:54:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233015AbjAHJup (ORCPT + 99 others); Sun, 8 Jan 2023 04:50:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232880AbjAHJuc (ORCPT ); Sun, 8 Jan 2023 04:50:32 -0500 Received: from mailout-taastrup.gigahost.dk (mailout-taastrup.gigahost.dk [46.183.139.199]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47990186B0; Sun, 8 Jan 2023 01:50:29 -0800 (PST) Received: from mailout.gigahost.dk (mailout.gigahost.dk [89.186.169.112]) by mailout-taastrup.gigahost.dk (Postfix) with ESMTP id 6AE1718839A3; Sun, 8 Jan 2023 09:50:27 +0000 (UTC) Received: from smtp.gigahost.dk (smtp.gigahost.dk [89.186.169.109]) by mailout.gigahost.dk (Postfix) with ESMTP id 616FE250007B; Sun, 8 Jan 2023 09:50:27 +0000 (UTC) Received: by smtp.gigahost.dk (Postfix, from userid 1000) id 5869F9EC000B; Sun, 8 Jan 2023 09:50:27 +0000 (UTC) X-Screener-Id: 413d8c6ce5bf6eab4824d0abaab02863e8e3f662 Received: from fujitsu.vestervang (2-104-116-184-cable.dk.customer.tdc.net [2.104.116.184]) by smtp.gigahost.dk (Postfix) with ESMTPSA id 04C5C91201DF; Sun, 8 Jan 2023 09:50:27 +0000 (UTC) From: "Hans J. Schultz" To: davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, "Hans J. Schultz" , Andrew Lunn , Florian Fainelli , Vladimir Oltean , Eric Dumazet , Paolo Abeni , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v4 net-next 2/3] net: dsa: mv88e6xxx: shorten the locked section in mv88e6xxx_g1_atu_prob_irq_thread_fn() Date: Sun, 8 Jan 2023 10:48:48 +0100 Message-Id: <20230108094849.1789162-3-netdev@kapio-technology.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230108094849.1789162-1-netdev@kapio-technology.com> References: <20230108094849.1789162-1-netdev@kapio-technology.com> MIME-Version: 1.0 Organization: Westermo Network Technologies AB X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754447636713042919?= X-GMAIL-MSGID: =?utf-8?q?1754447636713042919?= As only the hardware access functions up til and including mv88e6xxx_g1_atu_mac_read() called under the interrupt handler need to take the chip lock, we release the chip lock after this call. The follow up code that handles the violations can run without the chip lock held. In further patches, the violation handler function will even be incompatible with having the chip lock held. This due to an AB/BA ordering inversion with rtnl_lock(). Signed-off-by: Hans J. Schultz Reviewed-by: Vladimir Oltean --- drivers/net/dsa/mv88e6xxx/global1_atu.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/dsa/mv88e6xxx/global1_atu.c b/drivers/net/dsa/mv88e6xxx/global1_atu.c index 61ae2d61e25c..0a9fd253c727 100644 --- a/drivers/net/dsa/mv88e6xxx/global1_atu.c +++ b/drivers/net/dsa/mv88e6xxx/global1_atu.c @@ -409,23 +409,25 @@ static irqreturn_t mv88e6xxx_g1_atu_prob_irq_thread_fn(int irq, void *dev_id) err = mv88e6xxx_g1_read_atu_violation(chip); if (err) - goto out; + goto out_unlock; err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_ATU_OP, &val); if (err) - goto out; + goto out_unlock; err = mv88e6xxx_g1_atu_fid_read(chip, &fid); if (err) - goto out; + goto out_unlock; err = mv88e6xxx_g1_atu_data_read(chip, &entry); if (err) - goto out; + goto out_unlock; err = mv88e6xxx_g1_atu_mac_read(chip, &entry); if (err) - goto out; + goto out_unlock; + + mv88e6xxx_reg_unlock(chip); spid = entry.state; @@ -449,13 +451,11 @@ static irqreturn_t mv88e6xxx_g1_atu_prob_irq_thread_fn(int irq, void *dev_id) fid); chip->ports[spid].atu_full_violation++; } - mv88e6xxx_reg_unlock(chip); return IRQ_HANDLED; -out: +out_unlock: mv88e6xxx_reg_unlock(chip); - dev_err(chip->dev, "ATU problem: error %d while handling interrupt\n", err); return IRQ_HANDLED;