From: sashiko-bot@kernel.org
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
linux-pci@vger.kernel.org
Subject: Re: [PATCH 05/13] PCI: Serialize bridge window sizing and resource assignment
Date: Mon, 16 Nov 2026 16:00:04 +0000 [thread overview]
Message-ID: <sashiko-outbox-217333@kernel.org> (raw)
In-Reply-To: <20261116152403.2672-6-ilpo.jarvinen@linux.intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] PCI: acpiphp: enable_slot() holds pci_res_setup_lock across
pci_scan_bridge()
--
commit 25d4f4c5afed80a01b7847608ddc4982cc9fd58d
Author: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
PCI: Serialize bridge window sizing and resource assignment
This commit introduces pci_res_setup_lock to serialize bridge window sizing
and resource assignment across rescan, hotplug, and BAR resize paths.
> diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
> index 632344f34caed..d3987be044e33 100644
> --- a/drivers/pci/hotplug/acpiphp_glue.c
> +++ b/drivers/pci/hotplug/acpiphp_glue.c
> @@ -502,6 +502,7 @@ static void enable_slot(struct acpiphp_slot *slot, bool bridge)
>
> acpiphp_rescan_slot(slot);
> max = acpiphp_max_busnr(bus);
> + guard(mutex)(&pci_res_setup_lock);
> for (pass = 0; pass < 2; pass++) {
> for_each_pci_bridge(dev, bus) {
> if (PCI_SLOT(dev->devfn) != slot->device)
[Severity: Medium]
Does taking pci_res_setup_lock before the pci_scan_bridge() loop invert the
lock hierarchy with device_lock()?
pci_res_setup_lock is documented as nesting inside device_lock() because
__resource_resize_store() and driver probe hold device_lock(dev) when
calling pci_do_resource_release_and_resize(). However, pci_scan_bridge()
discovers child devices and calls pci_device_add() -> device_add(), which
exposes the resourceN_resize sysfs attributes in bus_add_device() before
acquiring device_lock(dev) for dev_set_ready_to_probe() and
bus_probe_device():
CPU0 CPU1
---- ----
enable_slot()
lock(&pci_res_setup_lock)
pci_scan_bridge()
...
device_add()
bus_add_device()
__resource_resize_store()
device_lock(dev)
...
lock(&pci_res_setup_lock)
device_lock(dev)
*** DEADLOCK ***
Could pci_res_setup_lock be taken only around the __pci_bus_size_bridges()
and __pci_bus_assign_resources() calls after pci_scan_bridge() has
completed?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261116152403.2672-1-ilpo.jarvinen@linux.intel.com?part=5
next prev parent reply other threads:[~2026-11-16 16:00 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 15:23 [PATCH 00/13] PCI: Serialize bridge window sizing and resource assignment Ilpo Järvinen
2026-11-16 15:23 ` [PATCH 01/13] PCI: Add pci_bus_size_and_assign_resources() Ilpo Järvinen
2026-11-16 15:35 ` sashiko-bot
2026-11-16 15:23 ` [PATCH 02/13] alpha/PCI: Convert to pci_bus_size_and_assign_resources() Ilpo Järvinen
2026-11-16 15:37 ` sashiko-bot
2026-11-16 15:23 ` [PATCH 03/13] PCI: Use guard(&pci_bus_sem) in pci_do_resource_release_and_resize() Ilpo Järvinen
2026-11-16 15:32 ` sashiko-bot
2026-11-16 15:23 ` [PATCH 04/13] PCI: Hold pci_bus_sem across sizing and assignment entrypoints Ilpo Järvinen
2026-11-16 15:36 ` sashiko-bot
2026-11-16 15:23 ` [PATCH 05/13] PCI: Serialize bridge window sizing and resource assignment Ilpo Järvinen
2026-11-16 16:00 ` sashiko-bot [this message]
2026-11-16 15:23 ` [PATCH 06/13] i82875p_edac: Convert to pci_assign_unassigned_bus_resources() Ilpo Järvinen
2026-11-16 15:36 ` sashiko-bot
2026-11-16 15:40 ` Borislav Petkov
2026-11-16 15:23 ` [PATCH 07/13] platform/x86: asus-wmi: " Ilpo Järvinen
2026-11-16 15:30 ` sashiko-bot
2026-11-16 15:23 ` [PATCH 08/13] platform/x86: eeepc-laptop: " Ilpo Järvinen
2026-11-16 15:29 ` sashiko-bot
2026-11-16 15:23 ` [PATCH 09/13] parisc/PCI: " Ilpo Järvinen
2026-11-16 15:45 ` sashiko-bot
2026-11-16 15:23 ` [PATCH 10/13] PCI: hotplug: octep: " Ilpo Järvinen
2026-11-16 15:38 ` sashiko-bot
2026-11-16 15:23 ` [PATCH 11/13] PCI: ftpci100: " Ilpo Järvinen
2026-11-16 15:34 ` sashiko-bot
2026-11-16 15:23 ` [PATCH 12/13] PCI: hv: " Ilpo Järvinen
2026-11-16 15:35 ` sashiko-bot
2026-11-16 15:23 ` [PATCH 13/13] PCI: Remove pci_bus_assign_resources() Ilpo Järvinen
2026-11-16 15:36 ` 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=sashiko-outbox-217333@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox