From patchwork Thu Oct 8 16:27:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Keeping X-Patchwork-Id: 11824193 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B7B76139F for ; Thu, 8 Oct 2020 16:28:43 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 422DE21D7D for ; Thu, 8 Oct 2020 16:28:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="MnJDoWe4"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=metanate.com header.i=@metanate.com header.b="k1BgalpQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 422DE21D7D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=metanate.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=8zNBhyZJfmo4i7VFRByzEpYFxtmdnO9rO9olMiV/iuU=; b=MnJDoWe4P9tG3U74o3duMb3ub9 QI2tM8iuWomlfUxCh4sXvmLVai4I7tz4ew7kxvcEvqg3JB5VbY7M0SoBnny9taXS8Q855vftXPvLu vrdkjobk5YZnra4+aDq67j9fkCHd/SaWG9D8WIdiSsLFnv8ADYgcJbEznZHApWHtu2u6EP4ecYau2 YxrohH2gQXnH4TNMi7ePTeXKR8CWzo44bcXglxv3mJYT4TLn6fvs3ilevx+KUg0dlNd2ySUIPNNSx uhWdlv2hhw0e2O1lzhK+ThufsrmMsPsRew9zZgVfwj1mS3iBcF7lTjk0usWls24QgX8GfS7iB4f+f F74d8R9A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kQYmD-0002Ln-Bv; Thu, 08 Oct 2020 16:28:21 +0000 Received: from [2001:8b0:1628:5005::111] (helo=metanate.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kQYmA-0002LS-Jv for linux-arm-kernel@lists.infradead.org; Thu, 08 Oct 2020 16:28:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=metanate.com; s=stronger; h=Content-Transfer-Encoding:Message-Id:Date: Subject:Cc:To:From:Content-Type:Reply-To:Content-ID:Content-Description: In-Reply-To:References; bh=baQALmr0nd/6aVpSHT4Rjxf/ucSA0n2jSwRjgVzHBf0=; b=k1 BgalpQSPZMjJBQPbOZFal6K15jRA5YqSN2OBpL7b7XxGECTsSPacSFBthLoXYZe5spWaLEyNEacJ0 CijgNih5NLesEmBGPBZtuToOdfvssMeA735j4GBiT5a1zphUNz0NGL1d/EkZj8X3U+xD/euBuP4H/ OG9ZeRHTsSQQ++YsNLjjLjZCXq0Kh0uMOrzM2Paap0jOK6IaxpPv7dRK4EMTkaFW0x88WTCSu0017 up266Co2VpVIoQKSkic2imHkb4qyXVAk2XryTidv9UkePZWVx2p2gb9EwZlzce47cUieif6IyqVbu dY8vC6O1MuUJS7FSzYeroolEZYpWtZkQ==; Received: from [81.174.171.191] (helo=donbot.metanate.com) by email.metanate.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1kQYlr-0004HE-FZ; Thu, 08 Oct 2020 17:27:59 +0100 From: John Keeping To: netdev@vger.kernel.org Subject: [PATCH] net: stmmac: Don't call _irqoff() with hardirqs enabled Date: Thu, 8 Oct 2020 17:27:49 +0100 Message-Id: <20201008162749.860521-1-john@metanate.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-Authenticated: YES X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201008_122818_754921_C92269A6 X-CRM114-Status: GOOD ( 13.39 ) X-Spam-Score: 1.1 (+) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (1.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Torgue , linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, Jose Abreu , John Keeping , Maxime Coquelin , Jakub Kicinski , Giuseppe Cavallaro , "David S. Miller" , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org With threadirqs, stmmac_interrupt() is called on a thread with hardirqs enabled so we cannot call __napi_schedule_irqoff(). Under lockdep it leads to: ------------[ cut here ]------------ WARNING: CPU: 0 PID: 285 at kernel/softirq.c:598 __raise_softirq_irqoff+0x6c/0x1c8 IRQs not disabled as expected Modules linked in: brcmfmac hci_uart btbcm cfg80211 brcmutil CPU: 0 PID: 285 Comm: irq/41-eth0 Not tainted 5.4.69-rt39 #1 Hardware name: Rockchip (Device Tree) [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [] (show_stack) from [] (dump_stack+0xa8/0xe0) [] (dump_stack) from [] (__warn+0xe0/0xfc) [] (__warn) from [] (warn_slowpath_fmt+0x7c/0xa4) [] (warn_slowpath_fmt) from [] (__raise_softirq_irqoff+0x6c/0x1c8) [] (__raise_softirq_irqoff) from [] (stmmac_interrupt+0x388/0x4e0) [] (stmmac_interrupt) from [] (irq_forced_thread_fn+0x28/0x64) [] (irq_forced_thread_fn) from [] (irq_thread+0x124/0x260) [] (irq_thread) from [] (kthread+0x154/0x164) [] (kthread) from [] (ret_from_fork+0x14/0x38) Exception stack(0xeb7b5fb0 to 0xeb7b5ff8) 5fa0: 00000000 00000000 00000000 00000000 5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 5fe0: 00000000 00000000 00000000 00000000 00000013 00000000 irq event stamp: 48 hardirqs last enabled at (50): [] prb_unlock+0x7c/0x8c hardirqs last disabled at (51): [] prb_lock+0x58/0x100 softirqs last enabled at (0): [] copy_process+0x550/0x1654 softirqs last disabled at (25): [] irq_forced_thread_fn+0x0/0x64 ---[ end trace 0000000000000002 ]--- Use __napi_schedule() instead which will save & restore the interrupt state. Fixes: 4ccb45857c2c ("net: stmmac: Fix NAPI poll in TX path when in multi-queue") Signed-off-by: John Keeping --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 220626a8d499..c331b829f60a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -2145,7 +2145,7 @@ static int stmmac_napi_check(struct stmmac_priv *priv, u32 chan) spin_lock_irqsave(&ch->lock, flags); stmmac_disable_dma_irq(priv, priv->ioaddr, chan, 1, 0); spin_unlock_irqrestore(&ch->lock, flags); - __napi_schedule_irqoff(&ch->rx_napi); + __napi_schedule(&ch->rx_napi); } } @@ -2154,7 +2154,7 @@ static int stmmac_napi_check(struct stmmac_priv *priv, u32 chan) spin_lock_irqsave(&ch->lock, flags); stmmac_disable_dma_irq(priv, priv->ioaddr, chan, 0, 1); spin_unlock_irqrestore(&ch->lock, flags); - __napi_schedule_irqoff(&ch->tx_napi); + __napi_schedule(&ch->tx_napi); } }