From mboxrd@z Thu Jan 1 00:00:00 1970 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=-13.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_2 autolearn=ham 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 86ED3C433DF for ; Fri, 9 Oct 2020 09:59:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F096722269 for ; Fri, 9 Oct 2020 09:59:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=metanate.com header.i=@metanate.com header.b="ivfM1cQJ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387425AbgJIJ7z (ORCPT ); Fri, 9 Oct 2020 05:59:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726357AbgJIJ7z (ORCPT ); Fri, 9 Oct 2020 05:59:55 -0400 Received: from metanate.com (unknown [IPv6:2001:8b0:1628:5005::111]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 338B4C0613D2; Fri, 9 Oct 2020 02:59:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=metanate.com; s=stronger; h=Content-Transfer-Encoding:Content-Type: References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID :Content-Description; bh=lDxXbMg3sqgtLNJ8JfGfAKeSro7IxzBb9f7HzRAxIHc=; b=ivfM 1cQJ4LxPv3ygCYNCSQfpTsmHalnPEbYPC9Q54L16FXH+BSbYYaj7pwTfTnFC/SYgOUeS312lSs74k FdNxGGwujXw9Um2TCdWYT4lggtLuCGU4+GqmuLaH38pENyF0eSWcprJr4CY9OD/vuPzGIwZfhUvkI +aO/GVlaHxALQXIbf8EfJ9GvSEt9Ks/z2okKr3ORJP9LLYo0YaN901JEyUaHNGAX9/ZAWtmrGjALb 92sf1VxCC3cxeQJLi0COpeHCvqlBv/Bb3Koa/lD4uJuEdAc/r7RyyNHrsdTUlwHBhhBRnCJfjfY4w cPGcwg/VRF3maSpEeQhdj5C5qEEUfg==; Received: from [81.174.171.191] (helo=donbot) by email.metanate.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1kQpBj-0006U9-7D; Fri, 09 Oct 2020 10:59:47 +0100 Date: Fri, 9 Oct 2020 10:59:45 +0100 From: John Keeping To: Vladimir Oltean Cc: netdev@vger.kernel.org, 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: Re: [PATCH] net: stmmac: Don't call _irqoff() with hardirqs enabled Message-ID: <20201009105945.432de706.john@metanate.com> In-Reply-To: <20201008234609.x3iy65g445hmmt73@skbuf> References: <20201008162749.860521-1-john@metanate.com> <20201008234609.x3iy65g445hmmt73@skbuf> X-Mailer: Claws Mail 3.17.6 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Authenticated: YES Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 9 Oct 2020 02:46:09 +0300 Vladimir Oltean wrote: > On Thu, Oct 08, 2020 at 05:27:49PM +0100, John Keeping wrote: > > 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 > > --- > > Don't get me wrong, this is so cool that the new lockdep warning is really > helping out finding real bugs, but the patch that adds that warning > (https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=cdabce2e3dff7e4bcef73473987618569d178af3) > isn't in 5.4.69-rt39, is it? No, it's not, although I would have saved several days debugging if it was! I backported the lockdep warning to prove that it caught this issue. The evidence it is possible to see on vanilla 5.4.x is: $ trace-cmd report -l irq/43-e-280 0....2 74.017658: softirq_raise: vec=3 [action=NET_RX] Note the missing "d" where this should be "0d...2" to indicate hardirqs disabled. Regards, John