From: sashiko-bot@kernel.org
To: "Sasha Levin" <sashal@kernel.org>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH AUTOSEL 6.18] PCI: cadence: Protect root bus removal with rescan lock
Date: Mon, 31 Aug 2026 16:15:19 +0000 [thread overview]
Message-ID: <20260831161520.5BF811F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260831133314.4125787-408-sashal@kernel.org>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [Medium] Missing cleanup of host init and link setup on pci_host_probe failure.
- [Medium] Double pm_runtime_disable() due to mixing devm_pm_runtime_enable() and manual pm_runtime_disable().
--
commit 9d7375f353a2f9bf3cd5f3ff9c612cd84f44e32f
Author: Hans Zhang <18255117159@163.com>
PCI: cadence: Protect root bus removal with rescan lock
Hold the pci_rescan_remove_lock lock while stopping and removing a root bus
to avoid racing with concurrent rescan or hotplug operations triggered via
sysfs.
Link: https://patch.msgid.link/20260521161822.132996-2-18255117159@163.com
> diff --git a/drivers/pci/controller/cadence/pcie-cadence-host.c b/drivers/pci/controller/cadence/pcie-cadence-host.c
> index fffd63d6665e8..c8daa5847c0f3 100644
> --- a/drivers/pci/controller/cadence/pcie-cadence-host.c
> +++ b/drivers/pci/controller/cadence/pcie-cadence-host.c
> @@ -620,8 +620,10 @@ void cdns_pcie_host_disable(struct cdns_pcie_rc *rc)
> struct pci_host_bridge *bridge;
>
> bridge = pci_host_bridge_from_priv(rc);
> + pci_lock_rescan_remove();
> pci_stop_root_bus(bridge->bus);
> pci_remove_root_bus(bridge->bus);
> + pci_unlock_rescan_remove();
>
> cdns_pcie_host_deinit(rc);
> cdns_pcie_host_link_disable(rc);
[Severity: Medium]
This isn't a bug introduced by this patch, but does cdns_pcie_host_setup() leak
hardware resources if a failure occurs during the probe phase?
If probe fails in cdns_pcie_host_init() due to a resource conflict:
drivers/pci/controller/cadence/pcie-cadence-host.c:cdns_pcie_host_setup() {
...
ret = cdns_pcie_host_init(rc);
if (ret)
return ret;
Can this return without calling cdns_pcie_host_link_disable() to undo the prior
link setup?
Similarly, if the failure happens later in the same function:
return pci_host_probe(bridge);
}
Will this return the error code without undoing the setup performed by both
cdns_pcie_host_link_setup() and cdns_pcie_host_init()?
This could leave the PCIe link started and root port BARs configured,
potentially preventing a clean re-initialization on subsequent probe attempts.
[Severity: Medium]
This is also a pre-existing issue, but could the driver reload path in
pcie-sg2042.c leave runtime PM permanently disabled?
When sg2042_pcie_probe() initializes power management:
drivers/pci/controller/cadence/pcie-sg2042.c:sg2042_pcie_probe() {
...
pm_runtime_no_callbacks(dev);
devm_pm_runtime_enable(dev);
This automatically registers a devres cleanup function to call
pm_runtime_disable() on driver unbind.
However, the remove function manually disables it again:
drivers/pci/controller/cadence/pcie-sg2042.c:sg2042_pcie_remove() {
...
pm_runtime_disable(dev);
}
If an administrator unbinds and rebinds the driver, does this manual call
increment the disable_depth counter a second time alongside the devres cleanup?
On subsequent driver reprobe, devm_pm_runtime_enable() would only decrement
it by one, leaving disable_depth at 1. Would this prevent the device from
entering low-power states after a driver reload?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260831133314.4125787-408-sashal@kernel.org?part=1
next prev parent reply other threads:[~2026-08-31 16:15 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260831133314.4125787-1-sashal@kernel.org>
2026-08-31 13:20 ` [PATCH AUTOSEL 6.18-6.12] PCI: plda: Protect root bus removal with rescan lock Sasha Levin
2026-08-31 13:43 ` sashiko-bot
2026-08-31 13:20 ` [PATCH AUTOSEL 6.18-6.12] PCI: Avoid FLR for MediaTek MT7925 WiFi Sasha Levin
2026-08-31 13:45 ` sashiko-bot
2026-08-31 13:21 ` [PATCH AUTOSEL 6.18-5.10] PCI: altera: Protect root bus removal with rescan lock Sasha Levin
2026-08-31 14:05 ` sashiko-bot
2026-08-31 13:21 ` [PATCH AUTOSEL 6.18-6.1] PCI: intel-gw: Enable clock before PHY init Sasha Levin
2026-08-31 14:12 ` sashiko-bot
2026-08-31 13:22 ` [PATCH AUTOSEL 6.18-6.1] PCI/proc: Fix race between pci_proc_init() and pci_bus_add_device() Sasha Levin
2026-08-31 14:27 ` sashiko-bot
2026-08-31 13:22 ` [PATCH AUTOSEL 6.18-5.10] PCI: rockchip: Protect root bus removal with rescan lock Sasha Levin
2026-08-31 14:30 ` sashiko-bot
2026-08-31 13:23 ` [PATCH AUTOSEL 6.18-5.10] PCI: Avoid SBR for Qualcomm WCN6855/WCN7850 WiFi, SDX62/SDX65 modems Sasha Levin
2026-08-31 14:50 ` sashiko-bot
2026-08-31 13:24 ` [PATCH AUTOSEL 6.18] misc: pci_endpoint_test: Validate BAR index in doorbell test Sasha Levin
2026-08-31 15:07 ` sashiko-bot
2026-08-31 13:25 ` [PATCH AUTOSEL 6.18-6.1] PCI: Wait for device readiness after D3hot -> D0uninitialized transition Sasha Levin
2026-08-31 15:30 ` sashiko-bot
2026-08-31 13:26 ` [PATCH AUTOSEL 6.18-6.1] PCI: switchtec: Add Gen6 Device IDs Sasha Levin
2026-08-31 15:43 ` sashiko-bot
2026-08-31 13:26 ` [PATCH AUTOSEL 6.18-5.10] PCI: mediatek: Protect root bus removal with rescan lock Sasha Levin
2026-08-31 15:44 ` sashiko-bot
2026-08-31 13:27 ` [PATCH AUTOSEL 6.18] PCI: cadence: " Sasha Levin
2026-08-31 16:15 ` sashiko-bot [this message]
2026-08-31 13:28 ` [PATCH AUTOSEL 6.18-5.15] ACPI: PCI: Clear _DEP dependencies after PCI root bridge attach Sasha Levin
2026-08-31 16:33 ` sashiko-bot
2026-08-31 13:28 ` [PATCH AUTOSEL 6.18-6.12] PCI/sysfs: Add CAP_SYS_ADMIN check to __resource_resize_store() Sasha Levin
2026-08-31 13:29 ` [PATCH AUTOSEL 6.18-5.10] PCI/sysfs: Use kstrtobool() to parse the ROM attribute input Sasha Levin
2026-08-31 17:00 ` sashiko-bot
2026-08-31 13:29 ` [PATCH AUTOSEL 6.18] PCI: dwc: Protect root bus removal with rescan lock Sasha Levin
2026-08-31 17:09 ` sashiko-bot
2026-08-31 13:31 ` [PATCH AUTOSEL 6.18-5.10] PCI: Stop setting cached power state to 'unknown' on unbind Sasha Levin
2026-08-31 17:28 ` sashiko-bot
2026-08-31 13:31 ` [PATCH AUTOSEL 6.18-5.10] PCI: iproc: Protect root bus removal with rescan lock Sasha Levin
2026-08-31 17:43 ` sashiko-bot
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=20260831161520.5BF811F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=sashal@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox