From: Antonio Quartulli <antonio@mandelbit.com>
To: intel-wired-lan@lists.osuosl.org
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
Subject: [PATCH net v6 1/7] igb: don't wait for RTNL when runtime suspending
Date: Mon, 30 Nov 2026 22:37:31 +0100 [thread overview]
Message-ID: <20261130213740.3323814-2-antonio@mandelbit.com> (raw)
In-Reply-To: <20261130213740.3323814-1-antonio@mandelbit.com>
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
next prev parent reply other threads:[~2026-11-30 21:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 21:37 [PATCH net v6 0/7] igb: fix runtime PM resume issues Antonio Quartulli
2026-11-30 21:37 ` Antonio Quartulli [this message]
2026-11-30 21:37 ` [PATCH net v6 2/7] igb: don't touch rings that don't exist when disabling an XSK pool Antonio Quartulli
2026-11-30 21:37 ` [PATCH net v6 3/7] igb: fix RTNL assertion when resuming from runtime suspend Antonio Quartulli
2026-11-30 21:37 ` [PATCH net v6 4/7] igb: keep the stack's Rx queues that still have an XSK pool Antonio Quartulli
2026-11-30 21:37 ` [PATCH net v6 5/7] igb: link queues to NAPIs under RTNL after runtime resume Antonio Quartulli
2026-11-30 21:37 ` [PATCH net v6 6/7] igb: resume the device before changing XDP or XSK settings Antonio Quartulli
2026-11-30 21:37 ` [PATCH net v6 7/7] igb: only allow runtime PM if the device can wake up Antonio Quartulli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261130213740.3323814-2-antonio@mandelbit.com \
--to=antonio@mandelbit.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=hawk@kernel.org \
--cc=hkallweit1@gmail.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=janislacis06@gmail.com \
--cc=joe@dama.to \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=kurt@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=maciej.fijalkowski@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=rafael@kernel.org \
--cc=sdf@fomichev.me \
--cc=sriram.yagnaraman@ericsson.com \
--cc=stable@vger.kernel.org \
--cc=sven.auhagen@voleatech.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox