From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: linux-pci@vger.kernel.org, "Bjorn Helgaas" <bhelgaas@google.com>,
"Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>
Cc: linux-kernel@vger.kernel.org,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Subject: [PATCH 00/13] PCI: Serialize bridge window sizing and resource assignment
Date: Mon, 16 Nov 2026 17:23:45 +0200 [thread overview]
Message-ID: <20261116152403.2672-1-ilpo.jarvinen@linux.intel.com> (raw)
Hi all,
Bridge window sizing and resource assignment can be started from
multiple entry points: rescan and hotplug under pci_rescan_remove_lock,
and BAR resize from sysfs or driver probe under device_lock() only. As
the entry points hold pci_bus_sem at most for read, nothing prevents two
sizing and assignment passes from running concurrently on the same
bridge windows and BARs.
Multiple issues due to these races could be reproduced some on a real
host and more in QEMU with a synthetic PCI host bridge (not part of
this series) by looping BAR resize against a rescan through sysfs. The
failures include spurious BAR resize failures, a WARN in
pci_dev_res_restore(), a NULL pointer dereference in
__release_resource(), and a bridge window programmed over RAM. None of
them occurred with this series applied.
The series first adds pci_bus_size_and_assign_resources() so that PCI
core can hold the locks across both phases and converting 1:1 callers
(alpha nautilus retains extra sizing call to avoid complex
refactoring). Secondly, convert setup-bus entrypoints to guard() and
pci_res_setup_lock to serialize the sizing and assignment passes.
Last, convert the remaining pci_bus_assign_resources() users and
remove it.
Drivers that call pci_assign_resource() or pci_release_resource()
directly are not covered by this series.
I've another series coming up which will add struct pci_setup_data that
is to be held across the entire sizing and assignment algorithm, which
is another reason why those actions have to be kept together going
forward. The goal of that upcoming series is to size also assigned
bridge windows properly and we need a place to keep the alignment
because STARTALIGN is lost when a resource gets assigned.
Ilpo Järvinen (13):
PCI: Add pci_bus_size_and_assign_resources()
alpha/PCI: Convert to pci_bus_size_and_assign_resources()
PCI: Use guard(&pci_bus_sem) in pci_do_resource_release_and_resize()
PCI: Hold pci_bus_sem across sizing and assignment entrypoints
PCI: Serialize bridge window sizing and resource assignment
i82875p_edac: Convert to pci_assign_unassigned_bus_resources()
platform/x86: asus-wmi: Convert to
pci_assign_unassigned_bus_resources()
platform/x86: eeepc-laptop: Convert to
pci_assign_unassigned_bus_resources()
parisc/PCI: Convert to pci_assign_unassigned_bus_resources()
PCI: hotplug: octep: Convert to pci_assign_unassigned_bus_resources()
PCI: ftpci100: Convert to pci_assign_unassigned_bus_resources()
PCI: hv: Convert to pci_assign_unassigned_bus_resources()
PCI: Remove pci_bus_assign_resources()
arch/alpha/kernel/sys_nautilus.c | 2 +-
arch/arm/kernel/bios32.c | 5 +-
arch/m68k/coldfire/pci.c | 3 +-
arch/mips/pci/pci-legacy.c | 5 +-
arch/sh/drivers/pci/pci.c | 3 +-
drivers/edac/i82875p_edac.c | 2 +-
drivers/parisc/dino.c | 2 +-
drivers/parisc/lba_pci.c | 7 +--
drivers/pci/controller/pci-ftpci100.c | 2 +-
drivers/pci/controller/pci-hyperv.c | 2 +-
drivers/pci/hotplug/acpiphp_glue.c | 4 +-
drivers/pci/hotplug/octep_hp.c | 2 +-
drivers/pci/pci.h | 1 +
drivers/pci/setup-bus.c | 78 ++++++++++++++++++++++-----
drivers/pci/setup-cardbus.c | 3 ++
drivers/pcmcia/cardbus.c | 3 +-
drivers/platform/x86/asus-wmi.c | 2 +-
drivers/platform/x86/eeepc-laptop.c | 2 +-
include/linux/pci.h | 2 +-
19 files changed, 88 insertions(+), 42 deletions(-)
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
--
2.47.3
next reply other threads:[~2026-11-16 15:24 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 15:23 Ilpo Järvinen [this message]
2026-11-16 15:23 ` [PATCH 01/13] PCI: Add pci_bus_size_and_assign_resources() Ilpo Järvinen
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:23 ` [PATCH 03/13] PCI: Use guard(&pci_bus_sem) in pci_do_resource_release_and_resize() Ilpo Järvinen
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:23 ` [PATCH 05/13] PCI: Serialize bridge window sizing and resource assignment Ilpo Järvinen
2026-11-16 15:23 ` [PATCH 06/13] i82875p_edac: Convert to pci_assign_unassigned_bus_resources() Ilpo Järvinen
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:23 ` [PATCH 08/13] platform/x86: eeepc-laptop: " Ilpo Järvinen
2026-11-16 15:23 ` [PATCH 09/13] parisc/PCI: " Ilpo Järvinen
2026-11-16 15:23 ` [PATCH 10/13] PCI: hotplug: octep: " Ilpo Järvinen
2026-11-16 15:23 ` [PATCH 11/13] PCI: ftpci100: " Ilpo Järvinen
2026-11-16 15:23 ` [PATCH 12/13] PCI: hv: " Ilpo Järvinen
2026-11-16 15:23 ` [PATCH 13/13] PCI: Remove pci_bus_assign_resources() Ilpo Järvinen
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=20261116152403.2672-1-ilpo.jarvinen@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=bhelgaas@google.com \
--cc=kw@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=robh@kernel.org \
/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
all inboxes | Powered by JetHome®