Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp2573928rwl; Fri, 6 Jan 2023 08:11:14 -0800 (PST) X-Google-Smtp-Source: AMrXdXvhLBxT8Elhuy5aDhNFbFTm6UCWlQFdjaen7oxXAxtAeKYq5z9hlcfq/ZYWEcLqTdhxsCVe X-Received: by 2002:a17:906:d047:b0:78d:f454:ba46 with SMTP id bo7-20020a170906d04700b0078df454ba46mr47751203ejb.69.1673021474191; Fri, 06 Jan 2023 08:11:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673021474; cv=none; d=google.com; s=arc-20160816; b=bz0Gn+n8ylAUy6Oa2TIw5svlj2vkk+MK27DaIV5HdteX6x9bICnlIk3ofiwL7Bn/VX B4M4gwdli/2ZepCYkrSsEHEsXkOE8ibs+86HhSfij6CcEBmrmYLF9N8ZWIjG6tp4kAz9 HWveCGAwNibtYfWqlA6W11UsOg5ZcM/4oh3xmYKmOPIjKkKZdqGO9FFZKp/aJGkaM4PH b4PX6sFowYhWkPcxn88V77QT04JwCV7ceu8N8i0C7AmySl0u3MLSVrOcF5mQB2CbpPHK M+OaW/x8Gu7msNbN/QGoY1uQsfyHXPnuzP2JHMYV55AcSeOEJzTdxfgYdClNyLlvwXu3 a1TA== 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=7CryQf9HLIOEeLRqQvlM1zUjpW9BXv0A1TyOI0cP+LY=; b=DSqwDHl47iKzgRHQDz1t1qf9MtwU1960WLuDRsaqIuK1lq1OGi3Fd+L4HiFkf5lywi MFg3qm8rqP9lG3chyfmBSZKboxwMrxeM0DocnfKv6gz60iB2FVw2Xg6fVGUJLbOZEfR2 RrrKrVbbs5HNxjecq4pi91m5kAUVBr5KLfhWv3nY2OSHDvfrhZdNDXYPILpmrwF7D/nL mkfUcmo6qBtSxqEIiajtPdEpsWDvFfnQWAX39w3VI8zmwes/foEmW77cwXobsTZifGSY oMq5cAQuWgPy7DFlej63Pe2d4NBd57PoYMhey3FSIUo5w9XAGYQzedAZTgkOX4Xl34rz SNJQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qb20-20020a1709077e9400b0084d15a1bc6fsi1950199ejc.418.2023.01.06.08.11.00; Fri, 06 Jan 2023 08:11:14 -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 S232411AbjAFQHU (ORCPT + 56 others); Fri, 6 Jan 2023 11:07:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231286AbjAFQHR (ORCPT ); Fri, 6 Jan 2023 11:07:17 -0500 Received: from mailout-taastrup.gigahost.dk (mailout-taastrup.gigahost.dk [46.183.139.199]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45C4739B; Fri, 6 Jan 2023 08:07:14 -0800 (PST) Received: from mailout.gigahost.dk (mailout.gigahost.dk [89.186.169.112]) by mailout-taastrup.gigahost.dk (Postfix) with ESMTP id DFE57188467F; Fri, 6 Jan 2023 16:07:11 +0000 (UTC) Received: from smtp.gigahost.dk (smtp.gigahost.dk [89.186.169.109]) by mailout.gigahost.dk (Postfix) with ESMTP id D5E072503B65; Fri, 6 Jan 2023 16:07:11 +0000 (UTC) Received: by smtp.gigahost.dk (Postfix, from userid 1000) id C54D29EC000D; Fri, 6 Jan 2023 16:07:11 +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 7721691201E3; Fri, 6 Jan 2023 16:07:11 +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 v3 net-next 2/3] net: dsa: mv88e6xxx: shorten the locked section in mv88e6xxx_g1_atu_prob_irq_thread_fn() Date: Fri, 6 Jan 2023 17:05:28 +0100 Message-Id: <20230106160529.1668452-3-netdev@kapio-technology.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230106160529.1668452-1-netdev@kapio-technology.com> References: <20230106160529.1668452-1-netdev@kapio-technology.com> MIME-Version: 1.0 Organization: Westermo Network Technologies AB Content-Transfer-Encoding: 8bit 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 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 --- drivers/net/dsa/mv88e6xxx/global1_atu.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/net/dsa/mv88e6xxx/global1_atu.c b/drivers/net/dsa/mv88e6xxx/global1_atu.c index 61ae2d61e25c..557428cee457 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,13 @@ 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); +out: dev_err(chip->dev, "ATU problem: error %d while handling interrupt\n", err); return IRQ_HANDLED; -- 2.34.1