From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=195.10.208.46 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796171014; b=qp1Q/WfeNAtGS+gQCrM0s6GpuGtOOazKAg+w4vPR9HbLPApaHt5e6F1x0IHtdhpkBBn1 qxPqT0Z10Sqnwam2Zav9YXNVCp6GV7HL3bXG9SBkVmSDOhKEBGS93mrh80LuNrLYFRPU1 K/chUsacbIjc2Y9nukoL/mzj9CTaQrm7U9ign5uPJq6hWMY8RmTaw1wJ9fRZfBJRU93Cr GxaarOd49zcfqIvEnWVWKoYnrr52UB4Q7bMyPQ60V1qjID0zIAnAZApUSUnBNVbo5OABX oGfLAJzwEGjDXNqWM76+CGHV5ffqNZXDM2oFD74mfx3ec6LW93LVZmQgWcfGQuuYUdw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796171014; 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=YaSHoE8jt/2SITm9q9EVPFQBlwFeXQPys2l2BJ6Apr0=; b=ZiiMOm7Am8GDphtmC9Wx54fPqNIJV6vdqNt9YE5vkGcjVFZnJIchvKuxritFD1UGBeqv Yawz9oCTsXJsbH6IfGUotOqCYmEheHz/GxsAg4OsI1jmmOBLMQam8eEMrWoLOwiOFLEt9 mQ1+XgwoAIjsdaNLos/fLiQQsKdORQZRk3CdqGLtJI9Pw5azm73xIjhQZGOvUOaHiuRRW i64QXXUTSvyqjNkn7+N0yFKgAPI3kdV3wZ8xx08pY6QSGKxfgwZUo7DoXGL6VNTadcRO3 eRgb6Fd1bn8zonCk9xko62+UJngYOIr4PnsCuoyCdvDZuP8SGCVWfqTF16u+FATPg/w== 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=D8bjBYDY; arc=none smtp.remote-ip=195.10.208.46 Received: from mout-b-106.mailbox.org (mout-b-106.mailbox.org [195.10.208.46]) (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 A0DA7606A6B9; Wed, 2 Dec 2026 00:23:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A0DA7606A6B9 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mandelbit.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mandelbit.com 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=D8bjBYDY Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519MLKEM768 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-b-106.mailbox.org (Postfix) with ESMTPS id 4jfJQ95BRhzNkH6; Wed, 02 Dec 2026 01:23:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com; s=MBO0001; t=1796171009; 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=YaSHoE8jt/2SITm9q9EVPFQBlwFeXQPys2l2BJ6Apr0=; b=D8bjBYDYN5qmZXOIbroBrwMVZRHP+8Qkl8NAjNwySSyoh/FBjQllzVDwl2DSY4tetnZ1Kp oOLw6GesjeEaC9IsKhzwfejZqJF6Fp6kmRdryb0WluJ0h8dBZvEU570iMq9TlZcAmU0vVC voQr+WpVCgyo99Q4mqWxPiQVVRbxsSE2L1FTxWKy0VaWUpHoQF0ijV/wEToadzumtumNlV bHOfpX4neH+IGRXftFFQMjhPx1twT3oJksQ18jyiPtVCzsPhAx8If4dc65uFN8S87FcuUe GK8vhXClrslF/SnRMyNeaoUoxVmjNUmnY3/VMn9r5V6T4F4AXZCuQyIZwKKPBA== Authentication-Results: outgoing_mbo_mout; dkim=none; spf=pass (outgoing_mbo_mout: domain of antonio@mandelbit.com designates 2001:67c:2050:b231:465::1 as permitted sender) smtp.mailfrom=antonio@mandelbit.com From: Antonio Quartulli To: intel-wired-lan@lists.osuosl.org Cc: Antonio Quartulli , Tony Nguyen , Przemek Kitszel , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Janis Edvarts Lacis , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Stanislav Fomichev , Sriram Yagnaraman , Kurt Kanzenbach , Maciej Fijalkowski , Heiner Kallweit , Joe Damato , "Rafael J. Wysocki" , Sven Auhagen , 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 v7 7/7] igb: only allow runtime PM if the device can wake up Date: Wed, 2 Dec 2026 01:23:15 +0100 Message-ID: <20261202002317.3140591-8-antonio@mandelbit.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261202002317.3140591-1-antonio@mandelbit.com> References: <20261202002317.3140591-1-antonio@mandelbit.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4jfJQ95BRhzNkH6 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 Reviewed-by: Janis Edvarts Lacis Signed-off-by: Antonio Quartulli --- v7: mention the wake-up condition in two comments (Sashiko) v6: no changes 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 | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index d7a4b41..6c29152 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -5642,6 +5642,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, @@ -5794,8 +5803,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) && @@ -9594,7 +9602,7 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake, * 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. + * igb_rpm_retry_task() schedules a new suspend if it can still wake up. */ if (!runtime) { rtnl_lock(); @@ -9764,13 +9772,13 @@ 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; } /* Resuming and releasing the device runs igb_runtime_idle(), which schedules - * a new suspend if the link is still down + * a new suspend if the link is still down and the device can wake up */ static void igb_rpm_retry_task(struct work_struct *work) { -- 2.56.1