Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp2214435pxu; Fri, 9 Oct 2020 10:38:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3CM2wj+OtN2ky2+2/FXV9cJHBJj78K4gwJU9bwaSln6QG2otOeaSeQQ1QsilMgbSYJh7S X-Received: by 2002:a17:906:f29a:: with SMTP id gu26mr14548375ejb.363.1602265127857; Fri, 09 Oct 2020 10:38:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602265127; cv=none; d=google.com; s=arc-20160816; b=Cn3zSGlni1VCGUCGk1DXCcRlVJg+x7MClQTnjSGtbajicM1IAKtgKc2QKNGGLTiXjn AdsmxAKVJTwNbPEP8Qle538H1DC4VnMgHqa2NcdTLfVgQ7NF57cJziLqqqIqXfOMIr1V E2dUWA/B88NqtjBC4aQooeQSl8q7T2IyIHv+m1/OGirHAIwpxWmGIjde0MATwrMpYgJN 2hp9DMaXMQsTEQhKxD0TdnUV24FT+9lpOOb8sb7/o3DyqchviN/XURRT7lp5BvZjAOZz FVkN3RTbjNqERXHdh4nNIx80Hke5wdCHTM1oJGDoUZH3Twx2gcWVntgtuIXUQqOBRLtZ RpLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=lDxXbMg3sqgtLNJ8JfGfAKeSro7IxzBb9f7HzRAxIHc=; b=cCq4gbwtuD7SgajzbjACBnpGsg2SD7CLq8grh2nv6vTpeX4HOBsB+JT0ET+meqoL+2 IwfGY2bvde1iP1as8/8KL4cxA1CYwU+4CDS9sV3PSlLnKdF3QcwAFT5wxDknGEYppb9G SqTgT46CuZKLIRwYazFf59LYHJdVgzRI7y65nXaTjlw213pXxeFkjC5UEANdOfB/BN62 X85d3qXQe9e/2VN2KJU4TOzrRDe1CGusvyzHDyUO2j+fiqnGLHlJ5IXGKsTb6c5ciEXn hGVblhbH9SZiqiibd0jCWzkZD7P3KH+z04k0unSFiSpnCN4ez5ene2OoMfqo+boIwhAF WE8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@metanate.com header.s=stronger header.b=ivfM1cQJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=metanate.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m27si7093141eji.326.2020.10.09.10.38.24; Fri, 09 Oct 2020 10:38:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@metanate.com header.s=stronger header.b=ivfM1cQJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=metanate.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387420AbgJIJ7z (ORCPT + 99 others); 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