All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Joshua Crofts" <crofts@kernel.org>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH] PCI/portdrv: remove redundant pm_runtime_dont_use_autosuspend() calls
Date: Fri, 13 Nov 2026 15:25:40 +0000	[thread overview]
Message-ID: <sashiko-outbox-213087@kernel.org> (raw)
In-Reply-To: <20261113-pci-remove-dont-use-autosuspend-v1-1-413cb01fa0f6@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] PCI/portdrv: autosuspend state leak in pcie_portdrv_remove()
  and shutdown()
--

commit 62458954dcb1cf459473df3e377ccf5bc59b1591
Author: Joshua Crofts <crofts@kernel.org>

PCI/portdrv: remove redundant pm_runtime_dont_use_autosuspend() calls

This commit removes the pm_runtime_dont_use_autosuspend() calls from
pcie_portdrv_remove() and pcie_portdrv_shutdown(), relying on the driver
core to undo pm_runtime_use_autosuspend().

> diff --git a/drivers/pci/pcie/portdrv.c b/drivers/pci/pcie/portdrv.c
> index 32fc623dd4108..3ce960b4ea25e 100644
> --- a/drivers/pci/pcie/portdrv.c
> +++ b/drivers/pci/pcie/portdrv.c
> @@ -728,7 +728,6 @@ static void pcie_portdrv_remove(struct pci_dev *dev)
>  	if (pci_bridge_d3_possible(dev)) {
>  		pm_runtime_forbid(&dev->dev);
>  		pm_runtime_get_noresume(&dev->dev);
> -		pm_runtime_dont_use_autosuspend(&dev->dev);
>  	}
>  
>  	pcie_port_device_remove(dev);
> @@ -741,7 +740,6 @@ static void pcie_portdrv_shutdown(struct pci_dev *dev)
>  	if (pci_bridge_d3_possible(dev)) {
>  		pm_runtime_forbid(&dev->dev);
>  		pm_runtime_get_noresume(&dev->dev);
> -		pm_runtime_dont_use_autosuspend(&dev->dev);
>  	}

[Severity: Medium]
Does removing pm_runtime_dont_use_autosuspend() here leave
dev->dev.power.use_autosuspend enabled after driver unbind and system
shutdown?

pci_bus_add_device() enables runtime PM for the PCI device, and it remains
enabled across driver unbind.  Because pm_runtime_reinit() returns early
when runtime PM is enabled, device_unbind_cleanup() never calls
pm_runtime_dont_use_autosuspend():

drivers/base/power/runtime.c:pm_runtime_reinit() {
	if (pm_runtime_enabled(dev))
		return;

	if (dev->power.runtime_status == RPM_ACTIVE)
		pm_runtime_set_suspended(dev);

	if (dev->power.use_autosuspend)
		pm_runtime_dont_use_autosuspend(dev);
}

As a result, unbinding the driver leaves use_autosuspend set and leaks the
dev->dev.power.usage_count reference acquired by update_autosuspend() if a
negative autosuspend_delay_ms was written via sysfs.  In addition,
device_shutdown() invokes pcie_portdrv_shutdown() directly without calling
pm_runtime_reinit().

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261113-pci-remove-dont-use-autosuspend-v1-1-413cb01fa0f6@kernel.org?part=1

  reply	other threads:[~2026-11-13 15:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 15:14 [PATCH] PCI/portdrv: remove redundant pm_runtime_dont_use_autosuspend() calls Joshua Crofts
2026-11-13 15:25 ` sashiko-bot [this message]
2026-11-13 15:40 ` Joshua Crofts

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=sashiko-outbox-213087@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=crofts@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.