mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: [PATCH net v5 6/6] igb: only allow runtime PM if the device can wake up
Date: Wed, 25 Nov 2026 00:57:21 +0100	[thread overview]
Message-ID: <20261124235723.1135808-7-antonio@mandelbit.com> (raw)
In-Reply-To: <20261124235723.1135808-1-antonio@mandelbit.com>

igb lets the device be runtime suspended even if it can't signal a
wake-up from D3. Such a device doesn't notice the link coming back, so
the port stays down until it is resumed from user space.

Only schedule a runtime suspend if pci_dev_run_wake() is true. Devices
that can't wake up no longer runtime suspend, even with power/control
set to auto. Checking it when scheduling the suspend, rather than at
probe and remove as e1000e and r8169 do, keeps the runtime PM usage
count balanced if the result changes while the driver is bound.

Tested with the 82576 emulated by QEMU.

Fixes: 749ab2cd1270 ("igb: add basic runtime PM support")
Cc: stable@vger.kernel.org
Closes: https://bugzilla.ipfire.org/show_bug.cgi?id=13562
Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
---
v5: check pci_dev_run_wake() when scheduling the suspend rather than
at probe and remove, which keeps the usage count balanced (Sashiko)
v4: no changes
v3: no changes
v2: no code changes; mention the tested hardware

Note: igc has the same issue: igc_probe() also allows runtime PM
regardless of pci_dev_run_wake().

 drivers/net/ethernet/intel/igb/igb_main.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 80ae03d..853bdf4 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -5625,6 +5625,15 @@ static void igb_watchdog(struct timer_list *t)
 	schedule_work(&adapter->watchdog_task);
 }
 
+/* A device that can't wake up wouldn't notice the link coming back while
+ * runtime suspended
+ */
+static void igb_schedule_runtime_suspend(struct igb_adapter *adapter)
+{
+	if (pci_dev_run_wake(adapter->pdev))
+		pm_schedule_suspend(&adapter->pdev->dev, MSEC_PER_SEC * 5);
+}
+
 static void igb_watchdog_task(struct work_struct *work)
 {
 	struct igb_adapter *adapter = container_of(work,
@@ -5777,8 +5786,7 @@ no_wait:
 					return;
 				}
 			}
-			pm_schedule_suspend(netdev->dev.parent,
-					    MSEC_PER_SEC * 5);
+			igb_schedule_runtime_suspend(adapter);
 
 		/* also check for alternate media here */
 		} else if (!netif_carrier_ok(netdev) &&
@@ -9741,7 +9749,7 @@ static int igb_runtime_idle(struct device *dev)
 	struct igb_adapter *adapter = netdev_priv(netdev);
 
 	if (!igb_has_link(adapter))
-		pm_schedule_suspend(dev, MSEC_PER_SEC * 5);
+		igb_schedule_runtime_suspend(adapter);
 
 	return -EBUSY;
 }
-- 
2.56.1


      parent reply	other threads:[~2026-11-24 23:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 23:57 [PATCH net v5 0/6] igb: fix runtime PM resume issues Antonio Quartulli
2026-11-24 23:57 ` [PATCH net v5 1/6] igb: don't touch rings that don't exist when disabling an XSK pool Antonio Quartulli
2026-11-24 23:57 ` [PATCH net v5 2/6] igb: fix RTNL assertion when resuming from runtime suspend Antonio Quartulli
2026-11-24 23:57 ` [PATCH net v5 3/6] igb: keep the stack's Rx queues that still have an XSK pool Antonio Quartulli
2026-11-24 23:57 ` [PATCH net v5 4/6] igb: link queues to NAPIs under RTNL after runtime resume Antonio Quartulli
2026-11-24 23:57 ` [PATCH net v5 5/6] igb: resume the device before changing XDP or XSK settings Antonio Quartulli
2026-11-24 23:57 ` Antonio Quartulli [this message]

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=20261124235723.1135808-7-antonio@mandelbit.com \
    --to=antonio@mandelbit.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=janislacis06@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=stable@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®