Article View: linux.kernel.netdev
Article #24792[PATCH net v6 1/7] igb: don't wait for RTNL when runtime suspending
From: Antonio Quartulli
Date: Mon, 30 Nov 2026 21:37
Date: Mon, 30 Nov 2026 21:37
104 lines
13724 bytes
13724 bytes
The PM core marks the device as suspending before calling
igb_runtime_suspend(), which takes RTNL. An RTNL holder that resumes the
device meanwhile, e.g. ethtool, igb_open() or igb_close(), waits for the
suspend to end, and the suspend waits for RTNL: both hang, with RTNL
taken.
The suspend still needs RTNL, as it closes the interface and frees the
queues. When runtime suspending, only try to take it, and return -EBUSY
if it's taken, which keeps the device active. Retry from a work item:
resuming and releasing the device schedules a new suspend if the link
is still down.
Fixes: 9474933caf21 ("igb: close/suspend race in netif_device_detach")
Cc: stable@vger.kernel.org
Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
---
v6: new patch (Sashiko)
drivers/net/ethernet/intel/igb/igb.h | 1 +
drivers/net/ethernet/intel/igb/igb_main.c | 28 ++++++++++++++++++++++-
2 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/igb/igb.h b/drivers/net/ethernet/intel/igb/igb.h
index 8c9b020..4250b4d 100644
--- a/drivers/net/ethernet/intel/igb/igb.h
+++ b/drivers/net/ethernet/intel/igb/igb.h
@@ -586,6 +586,7 @@ struct igb_adapter {
struct work_struct reset_task;
struct work_struct watchdog_task;
+ struct work_struct rpm_retry_task;
bool fc_autoneg;
u8 tx_timeout_factor;
struct timer_list blink_timer;
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index d4a897a..fffcb31 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -119,6 +119,7 @@ static void igb_set_rx_mode(struct net_device *);
static void igb_update_phy_info(struct timer_list *);
static void igb_watchdog(struct timer_list *);
static void igb_watchdog_task(struct work_struct *);
+static void igb_rpm_retry_task(struct work_struct *);
static netdev_tx_t igb_xmit_frame(struct sk_buff *skb, struct net_device *);
static void igb_get_stats64(struct net_device *dev,
struct rtnl_link_stats64 *stats);
@@ -3426,6 +3427,7 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
INIT_WORK(&adapter->reset_task, igb_reset_task);
INIT_WORK(&adapter->watchdog_task, igb_watchdog_task);
+ INIT_WORK(&adapter->rpm_retry_task, igb_rpm_retry_task);
/* Initialize link properties that are user-changeable */
adapter->fc_autoneg = true;
@@ -3889,6 +3891,7 @@ static void igb_remove(struct pci_dev *pdev)
cancel_work_sync(&adapter->reset_task);
cancel_work_sync(&adapter->watchdog_task);
+ cancel_work_sync(&adapter->rpm_retry_task);
#ifdef CONFIG_IGB_DCA
if (adapter->flags & IGB_FLAG_DCA_ENABLED) {
@@ -9501,7 +9504,18 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake,
u32 wufc = runtime ? E1000_WUFC_LNKC : adapter->wol;
bool wake;
- rtnl_lock();
+ /* The PM core marks the device as suspending before a runtime
+ * suspend, and an RTNL holder resuming it meanwhile (e.g. ethtool)
+ * waits for the suspend to end: waiting for RTNL here would deadlock.
+ * Only try to take it: -EBUSY keeps the device active, and
+ * igb_rpm_retry_task() schedules a new suspend.
+ */
+ if (!runtime) {
+ rtnl_lock();
+ } else if (!rtnl_trylock()) {
+ schedule_work(&adapter->rpm_retry_task);
+ return -EBUSY;
+ }
netif_device_detach(netdev);
if (netif_running(netdev))
@@ -9666,6 +9680,18 @@ static int igb_runtime_idle(struct device *dev)
return -EBUSY;
}
+/* Resuming and releasing the device runs igb_runtime_idle(), which schedules
+ * a new suspend if the link is still down
+ */
+static void igb_rpm_retry_task(struct work_struct *work)
+{
+ struct igb_adapter *adapter = container_of(work, struct igb_adapter,
+ rpm_retry_task);
+
+ pm_runtime_get_sync(&adapter->pdev->dev);
+ pm_runtime_put(&adapter->pdev->dev);
+}
+
static int igb_runtime_suspend(struct device *dev)
{
return __igb_shutdown(to_pci_dev(dev), NULL, 1);
--
2.56.1
Technical Details
Message-ID:
<20261130213740.3323814-2-antonio@mandelbit.com>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374468-linux-kernel-netdev=dewy.ruReferences:
<20261130213740.3323814-1-antonio@mandelbit.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374468-linux-kernel-netdev=dewy.ru From: antonio@mandelbit.com (Antonio Quartulli) Newsgroups: linux.kernel.netdev Subject: [PATCH net v6 1/7] igb: don't wait for RTNL when runtime suspending Date: Mon, 30 Nov 2026 22:37:31 +0100 Organization: Usenet Network Message-ID: <20261130213740.3323814-2-antonio@mandelbit.com> References: <20261130213740.3323814-1-antonio@mandelbit.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1543987"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:l9J1X/CaGRCGQI0RQtKtThX2DMo= sha256:tudg9WYLjVqNe428guBteM4zKaoy7KajvCOlbDw+h/w= sha1:E6FptAdtanroTx+U9ptyNqCz9XU= sha256:Oxr3T92yEd5ZfM+CERK2TLzGE7kWlwo8yC2d1ocgG08= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id B4F39126013; Tue, 1 Dec 2026 00:38:34 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.051 X-Spam-Status: No, score=-3.051 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=mandelbit.com X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 12dU8X2csm2T; Tue, 1 Dec 2026 00:38:27 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-374468-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=mandelbit.com X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 3380012600C; Tue, 1 Dec 2026 00:38:19 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 7819730318; Mon, 30 Nov 2026 21:38:03 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796074679; b=GiiKLBBFOF/GnmIhAUzAoMfa4Eu4Hqq78kMgcco/gIVdfBGMH586YierxKKCoOQRjKPa dj+mJXw04XFCSxCwAOVBRzZdGbYw9IhwyIA5FQhUJz7TXMaANgYDtxoBiidz7YPLG039+ o2zbtbi7xArNQkBcsay4FZiCfpFbDWRkLJHb694qR1JzCLgwJA7o+/ot5WapRbHAIiqZP 5kaQHyrhqRFtXeCmZOwFGkyOmvPNJaRzpLD+AHooQPdoyU9+Yiv048m58I7zXRQRNSUxd jHNaKWAaCVnS8a8+p6PR/uMRgRXGi2onh2ifR/bz9Rfut7b7nMVYfS7GjD1eBgNapew== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796074679; h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:From:To: Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version: Content-Transfer-Encoding:X-Rspamd-Queue-Id; bh=jnW/D4uqqVrrPAuwQjLFJ2n1KV6MvoY3sQ37ugxKyvU=; b=PV9ScioPHx3ujfB0wvnMFwBhUseE72UACgtmRmEOZ5o2cjZbi1AVcryf1i5ZxklrKw+8 kCgLFkP0QB2SkoE6F96Hiad+M4RF4OTgcipq/QuMXJgHXi+2rd5kFq1z+HuJx7Z0Ytn/j mfb0Dq/B+JmuGhDnE2oxRCz5ZUyhuwqYD4RmL8pdOxmfCh9WExTyVZhkXas4shUN9n+k8 Ry5IP8G5WWmS2ejec+bAgwhNThl480Jrd6ux5nuMQkoxyrXh8RkxyXO4BdT/u3E1BBvur PdSp/fzSJ8sLexIQ5CHZbi2c8ZlqL7rfdsS2m6ers80G/Z2Ej+irSIgYUsURmKAz3yA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=xpX6ZkeY; dmarc=none header.from=mandelbit.com; spf=pass smtp.mailfrom=mandelbit.com; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3D9B5606A680; Mon, 30 Nov 2026 21:37:59 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=xpX6ZkeY X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=195.10.208.52 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796074673; b=v+2d3qjlYofukZk+onny4e0xMsxJRhoKJuYLQitRdYpBP41HuWLvFLEXr6Qy7B6pFnx6 c8FFKyn2gpNrSRrUAySoFwnoMluOu1LOhnXdMfSNON8PuPewSy57xUVfKH1sSpZY6LIZX A+DShVdCMX1i6v1/3cjdm8b6pGNbjnlk7tsaO6w80DTX7vmksmIR1dtxGke0TxRxGvBIc HdnP24cfPU7L84ko8bfQ5wjoYr8KHAZyfnJB62clpNFv43p7Zifqxc3ThFqsTxBEP6am4 exOTz517uGiarUpQ2D05gwRVR2N/PqgWQUTRmAT4CA9KvBARu//hxM0bTCeFyCJ41LA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796074673; h=DMARC-Filter:Received:DKIM-Signature:From:To:Cc:Subject:Date: Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:X-Rspamd-Queue-Id; bh=jnW/D4uqqVrrPAuwQjLFJ2n1KV6MvoY3sQ37ugxKyvU=; b=Rqw+U0ErRL27ROhSW8eZcy7YFfhIuHHmWZI0W7uRh7MKYCXgxcaYvVYt1VuXEmCKErVb 2NcXOCkv8y4nId/lP8z4CO37t+ZGnXcCXUXrKbJ7w3+PowQykjGuuQgLpwvsIvgSvqrHT +TpP+CkRED+31l9AtByDRVxGO3aQT2F6tE2PlTlUhZoL2KWT9Jrkfgw65VXU1UYjTkEbJ WXLTo/us/oaYKkM2lF7gjyJ73xNSLJYH9H7beIhi3o7wBL12hPvVljm89PV2wMYj6ee1s RoGUntMThqEUKmF5sfRmxW//y5P2aKBv2qsJ6SL1JP2bGKmsHvgc+d6g3WNuV5yEOkA== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=mandelbit.com; spf=pass smtp.mailfrom=mandelbit.com; dkim=pass header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=xpX6ZkeY; arc=none smtp.remote-ip=195.10.208.52 X-Received: from mout-b-203.mailbox.org (mout-b-203.mailbox.org [195.10.208.52]) (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 9C1AC606A320; Mon, 30 Nov 2026 21:37:51 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9C1AC606A320 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mandelbit.com X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mandelbit.com X-Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519MLKEM768 server-signature RSA-PSS (4096 bits) server-digest SHA512) (No client certificate requested) by mout-b-203.mailbox.org (Postfix) with ESMTPS id 4jdcnR6PtRzLlyd; Mon, 30 Nov 2026 22:37:47 +0100 (CET) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com; s=MBO0001; t=1796074667; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jnW/D4uqqVrrPAuwQjLFJ2n1KV6MvoY3sQ37ugxKyvU=; b=xpX6ZkeYwQ0DxE5QGuq5JVs+W62nP7LeEAx/Q92d8s9+nIu2W5nwP01HOOGq48VR122ZVt jVl7dwM6Bcv08vfPAD5JROOUp/g6KJn/C+ozTCJ6O61/Nv1KnywIy1HU3ACHZWQNsRNKg9 VJeoA5YJUHJGhxIoksC0IBI0V+ms0yI1DsbTOIf5DxSW1haPBaCpDKjncmU3yLYeZdKwcw be/zdpTjhkfds+TthJ320LM6FtlvwBf/RKfbXVeAHbSw/dua2h0UnCfQuxVrl5ay9rq6O3 2QMjGP5teadL1G6k1sGGl3cW7ErbmBojXlUcCoJcWFeWVHgIcPhbZ7dWPrTfzA== X-Authentication-Results: outgoing_mbo_mout; dkim=none; spf=pass (outgoing_mbo_mout: domain of antonio@mandelbit.com designates 2001:67c:2050:b231:465::202 as permitted sender) smtp.mailfrom=antonio@mandelbit.com X-Cc: Antonio Quartulli <antonio@mandelbit.com>, Tony Nguyen <anthony.l.nguyen@intel.com>, Przemek Kitszel <przemyslaw.kitszel@intel.com>, Andrew Lunn <andrew+netdev@lunn.ch>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Janis Edvarts Lacis <janislacis06@gmail.com>, Alexei Starovoitov <ast@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, Jesper Dangaard Brouer <hawk@kernel.org>, John Fastabend <john.fastabend@gmail.com>, Stanislav Fomichev <sdf@fomichev.me>, Sriram Yagnaraman <sriram.yagnaraman@ericsson.com>, Kurt Kanzenbach <kurt@linutronix.de>, Maciej Fijalkowski <maciej.fijalkowski@intel.com>, Heiner Kallweit <hkallweit1@gmail.com>, Joe Damato <joe@dama.to>, "Rafael J. Wysocki" <rafael@kernel.org>, Sven Auhagen <sven.auhagen@voleatech.de>, netdev@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, stable@vger.kernel.org X-Mailer: git-send-email 2.56.1 X-In-Reply-To: <20261130213740.3323814-1-antonio@mandelbit.com> X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-Rspamd-Queue-Id: 4jdcnR6PtRzLlyd