From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=195.10.208.50 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796074684; b=vryPkYHH5rLT1c+vDC8wzH11VMwZ9ZCjj3eJ6N6r0umA2DVeeUY+Ro4HE7ul5TPxRwzl ZFI2VHP988kM7z9cKXe1D9Ti6HLVtPlhgRvs4eCouJbGrwRsiYwXIcuynf7PwTAoGkq0E jqHxv2Hsh6dp76m0gakhsunsQs2Wk2Mk7tgvJd4zFckOBvza4HTkKTDF4ZR6lWNJmgWTe J/X7jri09nXRrN49rFV8YV6NXQziswPZZ6DQMH8gh967iZjzj+7N6rz4TxAfVmaDCcP3q Ud7ViyZAHZHP2tiwIsWNsfXu24Vp/beNpbp3n+uEKV7DCgGpMrSb741sB45SvfK/FJQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796074684; 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=KucF5ZJesoexbrITKCJ8H1GPhn03LwESX7ufK1gNbug=; b=T+SGO0KNEuvYcKwsjkoypYYQ2D4AAonGS7kbWdBsTgMhOFjHrNHZ/Z6LPeMwTxciirz6 ujbtMwJPySihOZwWMMA/pwOAt6hVyR4dzu0Scm76Dk44NDn1jrIAWvyQMNlrP/VvPwRSm 8ujCFH8aFbFo0iyX8CpeoxggmShRqlEPahVjHbmfhD0QohxP8ifJVaIKU1xh+6zl/blrR d+4UYuP8UG7nucKhgDL/n/VNwv4LGxj2NzhilfGyfCVS+Nu01XIgOBoDevVuswhn/xEZw j5TR2NC1vpJsd04lpwcloArs67gSHCgPykJJJPppmBnSsE9NDYQIWXyi41ZI9Dfencg== 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=pE03yqnK; arc=none smtp.remote-ip=195.10.208.50 Received: from mout-b-105.mailbox.org (mout-b-105.mailbox.org [195.10.208.50]) (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 28B2960A2609; Mon, 30 Nov 2026 21:38:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 28B2960A2609 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=pE03yqnK 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 SHA256) (No client certificate requested) by mout-b-105.mailbox.org (Postfix) with ESMTPS id 4jdcnh1PmFz9t2s; Mon, 30 Nov 2026 22:38:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com; s=MBO0001; t=1796074680; 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=KucF5ZJesoexbrITKCJ8H1GPhn03LwESX7ufK1gNbug=; b=pE03yqnKabkv1UkhGgqWRs0TwhxIhOn1qDTvgN8LCWI8m7mrXfuLkFCe4ySzf8lnHNnY5y Kc33bhviZixiiiAw5jwYpnZVvkkgGYpqMIzsWhGywArLZK1wU2MK/CGFHBor6FVIKsICSM joNbCckb3bE3aSs0H/vywoqrjV4H4QGYMbkVDXkEMDJaG087W8KPYcD5feq3It7+oilgpW 6HiK43YZdMEYLGVLgIv8CPoUU3jQs6ThUBQu0qSSvcjEEoE1BGA/0zdBw1eRKmgUr8ImaJ 7S20PunS1S7OFR9n7pDo1QH9tLctga2LZyzSbyUkqMOBZ36Ss4MtLvUSIi1edw== 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 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 v6 7/7] igb: only allow runtime PM if the device can wake up Date: Mon, 30 Nov 2026 22:37:37 +0100 Message-ID: <20261130213740.3323814-8-antonio@mandelbit.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261130213740.3323814-1-antonio@mandelbit.com> References: <20261130213740.3323814-1-antonio@mandelbit.com> X-Mailing-List: linux-pm@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: 4jdcnh1PmFz9t2s 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 --- 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 | 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 e5a2870..d8f8df8 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -5643,6 +5643,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, @@ -5795,8 +5804,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) && @@ -9765,7 +9773,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