From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7DAE2606A31A for ; Wed, 2 Dec 2026 09:06:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=JCD8TOLa; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=SqmP6PPV DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=oJyaIFwqcnDn1teMEv52Hn7S/q+A8YyMmkhfJFG27B8=; b=JCD8TOLaefuLaQ xjIQNsTUES4r8yL9FdQHW2ZKwIKjO8WZpbZR1hTVrjFzjOtx0zEK8XtB4CeRm9g7g3lAAaJPsHEVf obqvsT4er0CuNARx2ko4RQyHWZRBF/q1UeRiME80UAbHVeArlJiyehtd8bLYtsxQVd/9lrUXguZZZ 3OVk+NCjFjLsCFDG9uc7HWKYBJB3wuyfI/u3XAroEOUTrpS2tE5Cs8fBWyvkLhmp4oc5SQxRMADzM DO8s0vwr1lm9WHHrqJDn1GhFjWXnQcKhPSMFaRn4jRuo3Vs5wrPolXcuT2ee6IIO9AWOuoZsjrtZG yIBEn+vTlFtbAe94BGqQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYgGu-0000000AlIL-3LZr; Wed, 02 Dec 2026 09:05:04 +0000 Received: from smtpout-04.galae.net ([185.171.202.116]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYgGq-0000000AlHG-32zA for linux-arm-kernel@lists.infradead.org; Wed, 02 Dec 2026 09:05:03 +0000 Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id E5A85C01332; Wed, 2 Dec 2026 09:05:05 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id DB3B66075F; Wed, 2 Dec 2026 09:04:54 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 8886B11EA2444; Wed, 02 Dec 2026 10:04:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1796202293; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:content-language:in-reply-to:references; bh=oJyaIFwqcnDn1teMEv52Hn7S/q+A8YyMmkhfJFG27B8=; b=SqmP6PPVpg3AZxhNQqg6Q2kGEoSd+wpqhgZp6O5r7KbCr+KnIUrJFM5xJ0AoNkOfgwTH47 MHumuD6C+uLyIUOOwlMBlXir9jeQmDMyGC/nLTXZCpSSghZMoSYTAjkG94YhKCz1OUfUKZ TLfWj5ZkzVpThSSr/amuETaq+3ZJWJZHcMy7O56OxfVV/DWDD/uRGZ5HF0y0/th2lQ4WaK NF8IfzAfDQCuA5yMFLvfZr7z6j2bETMNZtizZttApSvQIXAjqKq0+77lb39QTbzu/y0wjC TJPhSDKQCXGXtEoeJ8/HYMIV3v6HiLDZArSn1gMGDg5QhlZ74OmaWQKafQ/sow== Message-ID: <37f2c70f-d37a-4022-a5d3-b2863db7c940@bootlin.com> Date: Wed, 2 Dec 2026 10:04:43 +0100 X-Archived-By: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net] net: stmmac: remove STMMAC_DOWN To: Zxyan Zhu , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org Cc: Andrew Lunn , Jose Abreu , Maxime Coquelin , Alexandre Torgue , Sebastian Andrzej Siewior , ClarkWilliams , Steven Rostedt , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Stanislav Fomichev , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-rt-devel@lists.linux.dev, bpf@vger.kernel.org References: <20261201091256.3000677-1-zxyan0222@gmail.com> From: Maxime Chevallier Content-Language: en-US In-Reply-To: <20261201091256.3000677-1-zxyan0222@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Last-TLS-Session-Version: TLSv1.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261202_010500_951333_E508E080 X-CRM114-Status: GOOD ( 20.09 ) X-Spam-Score: -2.1 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-12.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Hi, On 12/1/26 10:12, Zxyan Zhu wrote: > STMMAC_DOWN was introduced by commit 34877a15f787 ("net: stmmac: Rework and fix > TX Timeout code") to mark the window where stmmac_reset_subtask() runs > dev_close()/dev_open(). However, the flag is only ever set and cleared > inside stmmac_reset_subtask(), yet most of its call sites treat it as if > it meant "interface is down". That mismatch is not just misleading, it > is the source of an interrupt storm. > > On a PREEMPT_RT system, fault-injecting an uncorrectable dwxgmac2 safety > error (src3 FSM RX parity) while traffic is running makes > stmmac_global_err() schedule stmmac_reset_subtask(), which does > dev_close()/dev_open(). While dev_close() blocks in synchronize_net() > waiting for an RCU grace period, a pending level-triggered DMA interrupt > makes the handlers bail out early: > > /* Check if adapter is up */ > if (test_bit(STMMAC_DOWN, &priv->state)) > return IRQ_HANDLED; > > without clearing any interrupt status. The level IRQ stays asserted, the > interrupt counter storms from ~2.7k to ~14M in about 28 s (~500k irqs/s), > starving the rcuc kthread so the RCU grace period never completes: > > rcu: INFO: rcu_preempt self-detected stall on CPU > rcu: 0-....: (7499 ticks this GP) ... rcuc=7499 jiffies(starved) > > __wait_rcu_gp > synchronize_rcu_normal > synchronize_rcu_expedited > synchronize_net > dev_deactivate_many > __dev_close_many > netif_close_many > netif_close > dev_close > stmmac_service_task > > The board then panics on panic_on_rcu_stall. > > The STMMAC_DOWN early-returns do not actually protect anything: the > concurrent teardown is already serialized by free_irq(), which > synchronizes with in-flight handlers before freeing the DMA descriptors, > so the interrupt handlers can run normally during the reset window. > Remove the flag entirely and let the handlers clear the interrupt status > as they normally do. This matches the direction suggested by the stmmac > maintainer: the flag only causes problems while the call sites already > work without it. > > The remaining uses are covered by existing mechanisms instead of a > dedicated flag: stmmac_service_event_schedule() is already guarded by > STMMAC_SERVICE_SCHED; stmmac_xdp_xmit() and stmmac_xsk_wakeup() now test > STMMAC_RESETING, which stmmac_reset_subtask() sets before dev_close() and > clears after dev_open(), so the whole reset window (including the > ndo_open() half, where netif_running() is already true before the DMA > rings are rebuilt) is rejected; and stmmac_reset_subtask() is guarded by > STMMAC_RESET_REQUESTED plus STMMAC_RESETING. > > With the fix, on a local board (dwxgmac2), injecting the same safety > error while traffic is running completes the reset cleanly and the main > IRQ counter no longer storms. > > Fixes: 34877a15f787 ("net: stmmac: Rework and fix TX Timeout code") > Suggested-by: Maxime Chevallier > Link: https://lore.kernel.org/netdev/20240327110142.159851-1-cathy.cai@unisoc.com/ > Signed-off-by: Zxyan Zhu Thanks for working on this. The commit log is quite verbose and the "why" is drowned in details, if you need to resend when sashiko/clashiko look at this, feel free to reduce a bit the commit message or even better, write it by hand :) Anyway, Reviewed-by: Maxime Chevallier Maxime