Article View: linux.kernel.netdev
Article #21073Re: [PATCH net v3 4/4] igb: only allow runtime PM if the device can wake up
From: netdev-bot+sashiko
Date: Mon, 23 Nov 2026 14:27
Date: Mon, 23 Nov 2026 14:27
157 lines
13859 bytes
13859 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 ยท High: 0 ยท Medium: 1 ยท Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The fix checks wake capability only once, in igb_probe().
- [Low] Possible runtime PM usage-count imbalance in
drivers/net/ethernet/intel/igb/igb_main.c.
--
igb: only allow runtime PM if the device can wake up
This patch changes igb_probe() so it drops the probe-time runtime PM
usage reference only when pci_dev_run_wake() reports that the device can
signal a wake-up. igb_remove() takes the reference back under the same
condition. The aim is to stop the NIC from runtime suspending into a
state where it cannot notice the link coming back.
Closes: https://bugzilla.ipfire.org/show_bug.cgi?id=13562
> diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
> index 4617aba5759d2..36bd395e36dab 100644
> --- a/drivers/net/ethernet/intel/igb/igb_main.c
> +++ b/drivers/net/ethernet/intel/igb/igb_main.c
> @@ -3654,7 +3654,11 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>
> dev_pm_set_driver_flags(&pdev->dev, DPM_FLAG_NO_DIRECT_COMPLETE);
>
> - pm_runtime_put_noidle(&pdev->dev);
> + /* A device that can't wake up wouldn't notice the link coming back
> + * while runtime suspended
> + */
> + if (pci_dev_run_wake(pdev))
> + pm_runtime_put_noidle(&pdev->dev);
[Severity: Medium]
Is a check done only at probe time enough to keep the device out of a
D-state it can't wake from?
The PCI core recomputes both the target state and the wake enable on
every runtime suspend, after igb_runtime_suspend() has run:
pci_pm_runtime_suspend()
pci_finish_runtime_suspend()
drivers/pci/pci.c:pci_finish_runtime_suspend() {
...
target_state = pci_target_state(dev, device_can_wakeup(&dev->dev));
if (target_state == PCI_POWER_ERROR)
return -EIO;
__pci_enable_wake(dev, target_state, pci_dev_run_wake(dev));
error = pci_set_power_state(dev, target_state);
...
}
If igb probes while d3cold_allowed is 0 or no_d3cold is set,
acpi_pci_choose_state() caps the target at D3hot:
if (pdev->no_d3cold || !pdev->d3cold_allowed)
d_max = ACPI_STATE_D3_HOT;
If the NIC has PME from D3hot, pci_dev_run_wake() is true there, so the
usage reference gets dropped.
Later, root can set d3cold_allowed back to 1 through sysfs, or
pci_d3cold_enable() can clear no_d3cold. The target can then become
D3cold. On a NIC whose PME_Support has no D3cold bit, pci_dev_run_wake()
is now false, and the core would put the device into D3cold with wake
disabled.
Even then, igb_runtime_idle() still schedules a suspend whenever there is
no link:
if (!igb_has_link(adapter))
pm_schedule_suspend(dev, MSEC_PER_SEC * 5);
Could this bring back the behaviour the commit message describes, where
the port stays down until it is resumed from user space? Would it make
sense to also refuse runtime suspend in igb_runtime_idle() or
igb_runtime_suspend() (for example by returning -EBUSY) when
pci_dev_run_wake() is false at that point?
I have only checked the code path here. I have not confirmed that real
82576/i350 parts on D3cold-capable platforms lack PME from D3cold.
> return 0;
>
> err_register:
> @@ -3876,7 +3880,8 @@ static void igb_remove(struct pci_dev *pdev)
> struct igb_adapter *adapter = netdev_priv(netdev);
> struct e1000_hw *hw = &adapter->hw;
>
> - pm_runtime_get_noresume(&pdev->dev);
> + if (pci_dev_run_wake(pdev))
> + pm_runtime_get_noresume(&pdev->dev);
[Severity: Low]
Can this pci_dev_run_wake() call give a different answer than the one in
igb_probe()?
igb_probe() doesn't save its result. pci_dev_run_wake() recomputes it on
every call from pci_pme_capable(dev, pci_target_state(dev, true)).
Several inputs to the target state can change at runtime:
- d3cold_allowed, which root can write through d3cold_allowed_store()
- no_d3cold
- PM_QOS_FLAG_NO_POWER_OFF in acpi_pm_device_sleep_state()
- acpi_target_system_state()
On a NIC with PME from D3hot but not from D3cold, changing
d3cold_allowed between probe and unbind is enough to flip the answer.
pci_device_remove() relies on ->remove() undoing exactly what probe did:
drivers/pci/pci-driver.c:pci_device_remove() {
...
pm_runtime_get_sync(dev);
pm_runtime_barrier(dev);
drv->remove(pci_dev);
pm_runtime_put_noidle(dev);
...
pm_runtime_put_sync(dev);
}
If probe saw false and remove sees true, one usage reference leaks. The
device can then never runtime suspend again, even after rebinding with
power/control set to auto.
If probe saw true and remove sees false, the final pm_runtime_put_sync()
drops one reference too many. With power/control set to auto, the usage
count underflows and the kernel warns. With power/control set to on, the
forbid reference is used up and the user's setting is lost.
Before this patch, the put_noidle/get_noresume pair was unconditional and
couldn't mismatch. e1000e and r8169 re-evaluate pci_dev_run_wake() in the
same way.
Would it be safer to record the decision made in igb_probe(), for example
as a flag in struct igb_adapter, and test that flag in igb_remove()?
> #ifdef CONFIG_IGB_HWMON
> igb_sysfs_exit(adapter);
> #endif
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261119140412.163202-1-antonio%40mandelbit.com
Technical Details
Message-ID:
<179544403775.3135.15481956972342894724@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369472-linux-kernel-netdev=dewy.ruReferences:
<20261119140412.163202-5-antonio@mandelbit.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369472-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v3 4/4] igb: only allow runtime PM if the device can wake up Date: Mon, 23 Nov 2026 14:27:17 +0000 Organization: Usenet Network Message-ID: <179544403775.3135.15481956972342894724@kernel.org> References: <20261119140412.163202-5-antonio@mandelbit.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3900695"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:kc8NfNaxwMSN53cqfpprBQJ/LgM= sha256:4As36gBTl8RhPZKYe4kUFBC4MkqGD1GxX57HimCbetU= sha1:KuZKnWzuXgrxMtcots5A2WhVZ2o= sha256:fn8OLklYXq0SyCuw94imfLjHfN8KQ7ep61bO+IUicF0= 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 0D1C1125DB3; Mon, 23 Nov 2026 17:27:45 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org 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 kT4OQMjkeOz1; Mon, 23 Nov 2026 17:27:39 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-369472-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 7DB1D125DB9; Mon, 23 Nov 2026 17:27:31 +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 8B738316EA; Mon, 23 Nov 2026 14:27:21 +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=1795444040; b=M5urUvMKyWIXLxxNLLmFbnjVroPzjRTd8f1atuaFLBq7AjJl3Vmu9n/0QAhPMeStDQO/ xfwVjlTXWq7Z8LcEdyh+HYFD6h2dGiN4xRN7cYcpFBu1IqXviln29Wf8fM0RqwUciHDaE lz2e4AV3In9c65GpBTkjPorzDUuEpzUJVupe/08LSKBO/5YKvzwnV2mlGnBJXVxZkDfR9 6w7hu03a1iyrN4OhH5+EcxDQhDgQV/ZHaD3qtry+w7NZ9piTzCLZrI4Jmy8im6Kh2CNEY er46foyKpm8LdNDNkrjWL19hnTSePdW2WHwLXLstjBIlx/5YuwpgHZqBATF5oqWn8UQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795444040; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=ROEpEZboGA+0DmWizHDH7PqObf+8q+vCxOx24LOVIhA=; b=HCsYx4uUUpvEP/eomLrdmHJOxp/p/J/HV4m7UDogikysPP1svbfKAhR5kaF9yDgjD2Pb 3nu8AuJkh+cYxQEbd6NfwPypPrQXJbFyoeCzK+EK1C5HgJjq1BINSiAfSLVua76KtO4sy CMMEwhSuFYUibAUmXOVjVZPEX7GqpNJRXb2UFung/umhkelYTTnd+fTs7sEk/ShWLRrgU AIRlO9WWCEaAT5JSJBGXt2samKXVsGFEbp48J6o+tBfXqRiCkL/o2H4u4wLEYop6bZpDw 6k7nLR2be1lXVr9xJpfThiE40HT0wbS6a+9X5zz0mh1kN1PdJtO1TH4KUlnhvYDtU1w== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bV4WYwaq; 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 860F0606A31A; Mon, 23 Nov 2026 14:27:20 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bV4WYwaq X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795444039; b=iN7ZhmEzkCYUyca0W41R16H/PUKct0ovUX0yJtE5SBF2cowBicI+zxbsaKmrLhTbu09G 4/YbidvQIvJKTvX1UX18DtuAug+ng0LMXFnNN3JvZEv4r/Q19aUHdvY8LIsZ7BCNxBMp/ N0qXLkcX4TGw163DIaOhAKei/DgJ5Bj1mjc9qik/NmvRHTj8+qz2XZo3DraZ4gHrrPKtQ guqQJdV7Rbpe6PD0YnU4+JPBHUeG85XTaDt4f0MbpO5gg4VhktrI6u3cqEE5KA8X4hrLC nwKO6zAIeZpBkRwLJe795jYQjYciAyvurZcAckUxGoryEFXwKAjrkDiCC3Ldi6q+2kQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795444039; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=ROEpEZboGA+0DmWizHDH7PqObf+8q+vCxOx24LOVIhA=; b=t4fNinYc2R9QykQI5+6VvnoK+ra9OZfipqcSjO22yENyW8mZaHRQM22eiRevAkzzX4wq TmQGem3ATA66Qr3AK9znAIZxJEMCnpDUIQvkjRh+vcUodK50OjhcQCmJFli5/WmEHjFbb +vgZ1TP3yBBtatMfcX6RnsdDATWqnXojR6Yt5CbmrLrhL9/IuJuZ/LRZo1vrJRi0AmXsz 3VC6udVpYFD1nzXoBnjhp48kvNVk9m40BCdgjhFo96hb8c2U/WxbQbrkU+imfNJupMFhR f9HLHJW22fu/QzIcbceyiD2xsYrDhImw2o+PoNuONNOE3F6b/0EbH2Xlkoo6O5ywVDQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bV4WYwaq; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A71AB606A333; Mon, 23 Nov 2026 14:27:19 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 333491F000EB; Mon, 23 Nov 2026 14:27:18 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795444039; bh=ROEpEZboGA+0DmWizHDH7PqObf+8q+vCxOx24LOVIhA=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=bV4WYwaq2mVrJAwB3kOlIVtuHkCpXiuw3EOn+UuUtkKzPATQjlq/+wnc4XMxq3Hcj LHL4net5Lt93HGpuu7jRgaDEstYgHy/zDDHq19eFD7M/Y7/E/rv984kCV7lVB/BnNg +XIgsfYaIUoJ5o7f3TYrlKoUEHGyUF4LB69PHHKoaKwcxHGMBfV8lYhsGqYSfktMXu EXpPZwfiwWqPcYD+BnolkFfeSVBFhi7Zw9IABmNGijyxbf0LpomFxE23ao8KVdN8Os /9D+1MX//wskqsPQsFrYlwAb1WiFxVD3OaSB9SWRXKPZgXDttR+RdJBWX1I4wdXgnk nAQMnUuVHjVjw== X-Cc: intel-wired-lan@lists.osuosl.org, anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, janislacis06@gmail.com, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, sdf@fomichev.me, sriram.yagnaraman@ericsson.com, kurt@linutronix.de, maciej.fijalkowski@intel.com, hkallweit1@gmail.com, joe@dama.to, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org X-In-Reply-To: <20261119140412.163202-5-antonio@mandelbit.com> X-sashiko-severity: Medium 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