From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=185.171.202.116 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796202300; b=TGKyCkBOwoZAl7Jc3vUYUb+WxPWxutXB4LbYgTUk+o1gF6reV0nK1thfjOVYQDXLdGRy 6XCuUyw6m9gfaWFUr55InkCKrOCk0l4zXmZcACg1Nx+Qa3+3j0JmkYpIsW9z2BXmul3qL Q0QMZJYygINGtee0CAkhoqtzsz9+Ww6a4u5XpJ4McWupvuOPM8Z+8b/uAypHNgmzpZIR4 qc0W4hu0Apb6Ixgbq8s3EJPEAYVFalSKdkZEKdBpOGGWw719gD6M9DTIUKYBkBHpFteD1 U6Fh+iJDPzt64P6LTRKmHA1fjSnO2qmpmlWJBgBwp4iFsb/3tWSqP35RdsnOaLQ1cGw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796202300; h=DMARC-Filter:Received:Received:Received:DKIM-Signature:Message-ID: Date:MIME-Version:User-Agent:Subject:To:Cc:References:From: Content-Language:In-Reply-To:Content-Type:Content-Transfer-Encoding: X-Last-TLS-Session-Version; bh=oJyaIFwqcnDn1teMEv52Hn7S/q+A8YyMmkhfJFG27B8=; b=eBgJwBOPKwZc3yXGB/7lpaEaUtb/YmnAH5T+XK4O8FKExyaAb8Li4x5+YOPvdcpvspS6 UU9ktWaRyR7Yac1f6iTsrNUgv87/MXLkR1GOQ+HolCLWdEPkomX1Cn7PPU0qZXQIq1NUp 9923PsasFcBhhc3sD1h4YMyaRt46Cjyf+80iAR7SCC9/K4FivKbTKAHrHqmLfsgnitmEh 4/BIOu+OWkQhVFa1D4F1yn6kF0m1H6oSmuI2Rr1HgnQkCaJWPxakHYdagfPQSOLc/kv0O wR0i6jvRKYdxpVqhNMMB64TOwun1oUdCzOXq+TmwwvHgg0R6fTrNyN6pw4ATKxo6dNw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=SqmP6PPV; arc=none smtp.remote-ip=185.171.202.116 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (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 812A2606A33B for ; Wed, 2 Dec 2026 09:04:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 812A2606A33B Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=SqmP6PPV 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-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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 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