Article View: linux.kernel.netdev
Article #17811Re: [PATCH net 3/3] igb: only allow runtime PM if the device can wake up
From: netdev-bot+sashiko
Date: Tue, 17 Nov 2026 11:18
Date: Tue, 17 Nov 2026 11:18
164 lines
13666 bytes
13666 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 ยท High: 0 ยท Medium: 2 ยท Low: 0
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] Probe and remove can disagree about the runtime PM usage
count.
- [Medium] The patch decides whether igb may runtime-suspend from one
pci_dev_run_wake() check in igb_probe().
--
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() is true. Devices that can't
signal a wake-up from D3 therefore no longer runtime suspend.
igb_remove() takes the reference back under the same condition.
> diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
> index f1ce9aa696ab7..145daee832640 100644
> --- a/drivers/net/ethernet/intel/igb/igb_main.c
> +++ b/drivers/net/ethernet/intel/igb/igb_main.c
> @@ -3677,7 +3677,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 one check at probe time enough to close the bug described in the
commit message?
pci_dev_run_wake() depends on pci_target_state(), and that can change
after probe. On ACPI platforms, acpi_pci_choose_state() limits the
target to D3hot only when d3cold_allowed is clear:
drivers/pci/pci-acpi.c:acpi_pci_choose_state() {
...
if (pdev->no_d3cold || !pdev->d3cold_allowed)
d_max = ACPI_STATE_D3_HOT;
else
d_max = ACPI_STATE_D3_COLD;
...
}
Root can change d3cold_allowed through sysfs while igb is bound.
Here is one sequence:
1. igb binds with d3cold_allowed=0. The target is D3hot and PME is
supported from D3hot, so the probe check passes and the reference is
dropped.
2. Root writes d3cold_allowed=1, so the target becomes D3cold.
3. The part doesn't support PME from D3cold.
On the next link-down, igb_runtime_idle() or the watchdog schedules a
suspend. igb_runtime_suspend()->__igb_shutdown() arms the WUFC
link-change filter without any PCI-level check. Then
pci_finish_runtime_suspend() runs:
drivers/pci/pci.c:pci_finish_runtime_suspend() {
...
__pci_enable_wake(dev, target_state, pci_dev_run_wake(dev));
error = pci_set_power_state(dev, target_state);
...
}
pci_dev_run_wake() is now false. Wouldn't the device then go into D3cold
with PME disarmed? The port would stay down after the cable is plugged
back in, until user space resumes it.
Could igb_runtime_idle() or igb_runtime_suspend() return -EBUSY when
pci_dev_run_wake() is false? That would cover this case and also remove
the need for the separate probe and remove accounting below.
> return 0;
>
> err_register:
> @@ -3899,7 +3903,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: Medium]
Can igb_probe() and igb_remove() disagree about the runtime PM usage
count here?
igb_remove() calls pci_dev_run_wake() again instead of reusing the
decision made in igb_probe(). The result comes from
pci_pme_capable(dev, pci_target_state(dev, true)), and the target state
can change while the driver is bound.
One way it can change is a write to d3cold_allowed through
d3cold_allowed_store(). That changes what acpi_pci_choose_state()
returns, as described above.
Another way is surprise removal of a runtime-suspended igb that the
platform does not manage. pci_device_remove() calls
pm_runtime_get_sync() before drv->remove(), and during that resume
pci_power_up() does:
drivers/pci/pci.c:pci_power_up() {
...
if (pci_dev_is_disconnected(dev)) {
dev->current_state = PCI_D3cold;
return -EIO;
}
...
}
pci_target_state() then returns PCI_D3cold when igb_remove() runs. On a
part with PME from D3hot but not from D3cold, pci_dev_run_wake()
changes from true to false.
After that, pci_device_remove() runs the same sequence regardless:
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 the check was false at probe and true at remove, doesn't the usage
count stay one too high for good? The device could then never runtime
suspend again, even after rebinding.
If the check was true at probe and false at remove, doesn't this drop
one reference too many?
With power/control=auto, rpm_drop_usage_count() would warn "Runtime PM
usage count underflow!". With power/control=on, the extra put would
silently cancel the pm_runtime_forbid() reference.
Would it help to save the probe-time decision in struct igb_adapter and
test that flag in igb_remove()?
e1000e and r8169 also re-check pci_dev_run_wake() in their remove paths.
Following them doesn't by itself show that the pattern stays balanced.
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261113105835.3821433-1-antonio%40mandelbit.com
Technical Details
Message-ID:
<179491431428.3136.15501039766024079493@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.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-365195-linux-kernel-netdev=dewy.ruReferences:
<20261113105835.3821433-3-antonio@mandelbit.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.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-365195-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net 3/3] igb: only allow runtime PM if the device can wake up Date: Tue, 17 Nov 2026 11:18:34 +0000 Organization: Usenet Network Message-ID: <179491431428.3136.15501039766024079493@kernel.org> References: <20261113105835.3821433-3-antonio@mandelbit.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2313786"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:tlCIHRJgtM4JzZpW4yuLKU6k4kY= sha256:oeTZyCm1SU8uKVmptdkmS2RLVFVc9Gud9bT1IAd8cxY= sha1:SFiIj4nRq8w3QWrO6OXUq2yMA0g= sha256:uigqTMEnSJsw8OBLvRY1TReCz05VxVo5IsWSLjXuDdY= 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 94664114F1F; Tue, 17 Nov 2026 14:19:09 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 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] 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 0a7VHbJIoOYb; Tue, 17 Nov 2026 14:19:01 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-365195-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id F1B04114F1A; Tue, 17 Nov 2026 14:18:50 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 102E230F84; Tue, 17 Nov 2026 11:18:43 +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=1794914321; b=HfuDYPi++bIeq6XLIgXUXbFNUvWwneYHyijom4w+K6Zgl1nlyuCVi7hcYIvmIAZhxu1/ hCrHwsgloVQNhuatVE06L1KFiSvns9Zukc2SFPtBO7ct9AVlnVqbKDNS3ume1au1km02u Fe2qk61BsgxC65NRdNJcfP6mHam1hR3N1PEJP5O+dCwGLfC2GvMz57VKP0XMmPymG6D9C DRsSMXxjk/6jTVnyC3Xp3uRGIPZAhcIQ4NPWyE5bapSguCfudbayIk8t+5dsPS06e4zXH SCpExD66S/GO3OlLAW9wgldmO6rU2rvHWK8KuWAzT8sNkhAveMaGEdOJx2s6W3KR9bQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794914321; 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=IqLBpYE7h7awA0TG7t8nA0duIGgbrcEUjs5NwXMZs9w=; b=Dhu0jqkgibQjG0CIX9hX91tzVlqQKctnhQsegLN8AEQmN0XoaoM/1KHsXY30WzGaI1RF zbijSkskEU6i72M5SaRz+OPhMDFIS4OO4lDr0iRTjyIRaUuJHfnPDUGLrlbN+3i3Pte22 gl0Az3Qjoxr/9b+5d2vDQP/FujTMxEV7NlGAVE5KQjCBm1yHnHUvJAVJXYS400cRA0WFr h1SQvJR4ZSD0DhEKYpwtcWp1c0y81gShIn3/19auRoR2REzl/ntBoCFNPd2NYtJAx5hlM EGMFfDSqsxhpt8yP2sXzzKyxeAJlfcphsj/vjhNUdytsSZVfqzY3sXTRoKLa+m/ynHg== 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=mCaFIUZH; 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 62EFA606A335; Tue, 17 Nov 2026 11:18:41 +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=mCaFIUZH 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=1794914315; b=v1V5MJvrrCXDg0Z39tSsj5Lr90m2dIub8GLgrBtby0h6ydvcfUaT6Pa0gSVyxCvanMZE Ct1APSsGNI/1LR6sMh4ST3jpCRGuRiiWz4zSKtMnMYlAEY4Av15WiCcA71cvu3qc28KTC 5mSrSr6TWgexePgwmAlSlFltfDm296u9n7WpT4CDOnEid7GC1gli5NXGnK8OawlFD8CYk SHsSip7fviIdYjFQywscJNh/btc6Y8hiQw/qnF2ifrrXGStqzQVEbmdRdQRLLPk0bpHvb SW3rE4V2EBkYVm1RetJgZF4oJyD29xRPcWX8auszmVkJvKwQhfpxAW9lgZGgsczk+mw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794914315; 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=IqLBpYE7h7awA0TG7t8nA0duIGgbrcEUjs5NwXMZs9w=; b=xud7HHSwwToHSw5i+9qhC/rkQOiwdy9qRaE8QASpRahF2DqRFYc/0W//y/uslZkXcaVr LVA2X9R7w2kQKyiUURRylJuViUZnlVh0hjUOpfTWdUieyJ3X2jMhNEwJwozw3NGFMGPhR Ck6SseP7l4ts/Btoed8UsrDHIUlraN0uWkd/94yGcN5f0Wuf02/Us74nohGozHLhWhjQN A0yEDlCIBH7L2BwIB6cIwFRVtKSKaQJNNknHePT47pEaazun106eaKs8tbKzK4pvUtR0x W6CrJ5NxZ4NtP9iIYc1ytE9zfBoPxCS8qqnSKCDYs1ktx+IKxc+DvkSbrsqty0pgO/A== 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=mCaFIUZH; 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 80FFD606A883; Tue, 17 Nov 2026 11:18:35 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB7801F000C8; Tue, 17 Nov 2026 11:18:34 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794914315; bh=IqLBpYE7h7awA0TG7t8nA0duIGgbrcEUjs5NwXMZs9w=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=mCaFIUZHgw8kLUr6stTj4HbPc4TcRO5utbPuxEnmgAh2uyLh1xZi8xwK8jP3U2fmD smuWD0opczWQVBhCsXOtMOQyIebNiRDs+4AnLZMwvi4II0g2YITzYMsEpw7AoLNnNt V78ked96eUSWdEvNqFUAjqjOzse+If31UgybNkxZrn7MVJzDNCRHzo321wLlyzJgZY LSFaVSe4HyqMqI5d/YpqstPM5cx9PgX9n/P+rEzrOmZLvdl1SZkk1+OpBl/nT6X/6d DSTysjKCUqcJ9LGqiYJvmnaqVLAEWWhLnuJkDp14qoFFqRh3x1nc3BOKr5e1JevbB9 6nKQLbxB1TvwQ== 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, zheng.z.yan@intel.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org X-In-Reply-To: <20261113105835.3821433-3-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