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: 11824219 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA850C433DF for ; Thu, 8 Oct 2020 16:46:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 63E4F221FC for ; Thu, 8 Oct 2020 16:46:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=metanate.com header.i=@metanate.com header.b="k1BgalpQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730060AbgJHQqN (ORCPT ); Thu, 8 Oct 2020 12:46:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729965AbgJHQqN (ORCPT ); Thu, 8 Oct 2020 12:46:13 -0400 X-Greylist: delayed 1088 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 08 Oct 2020 09:46:13 PDT Received: from metanate.com (unknown [IPv6:2001:8b0:1628:5005::111]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1321CC061755; Thu, 8 Oct 2020 09:46:13 -0700 (PDT) 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 Cc: John Keeping , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Jakub Kicinski , Maxime Coquelin , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@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 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.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); } }