All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/15] PCI: Resource release fixes and improvements
@ 2026-12-01 15:58 Ilpo Järvinen
  2026-12-01 15:58 ` [PATCH 01/15] PCI: Release all resources before restoring them in BAR resize rollback Ilpo Järvinen
                   ` (18 more replies)
  0 siblings, 19 replies; 21+ messages in thread
From: Ilpo Järvinen @ 2026-12-01 15:58 UTC (permalink / raw)
  To: Bjorn Helgaas, Lorenzo Pieralisi, Rob Herring,
	Krzysztof Wilczyński, Alex Deucher, Christian König,
	Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
	Matthew Brost, Thomas Hellström, Michał Winiarski,
	Ville Syrjälä, David Airlie, Simona Vetter, dri-devel,
	amd-gfx, intel-gfx, intel-xe
  Cc: linux-kernel, Ilpo Järvinen

Hi all,

Releasing a PCI resource does not care what resides underneath it. A
released bridge window takes its children along, including regions
requested by drivers, which can corrupt the resource tree once the
window and its resources are assigned elsewhere.

This series makes pci_release_resource() refuse resources with children
and adds pci_release_resource_tree() that releases only PCI resources.
The check and the release are done under resource_lock, which the
resource core now exposes. Exposing resource_lock is probably the most
debatable part; an alternative to this would be to pass check and
release callbacks to a new resource core function.

The first 5 patches are related fixes.

The most immediate effect of these changes is for driver initiated BAR
resize which could fail if there are any extra resources underneath
the one to be resized. My impression is that this is not the case with
any of the GPU drivers using BAR resize but it would be good still that
GPU people take a look and test as needed.

The series is a prerequisite for sizing already assigned bridge windows.


The resource fitting and assignment algorithm self-race conditions due
to insufficient locking are out-of-scope. They are fixed by this series:

https://lore.kernel.org/linux-pci/20261125230925.2441-1-ilpo.jarvinen@linux.intel.com/

... and another (unsubmitted) series on top of that to bring
pci_assign_resource() and pci_bus_alloc_resource() under the same lock.


Ilpo Järvinen (15):
  PCI: Release all resources before restoring them in BAR resize
    rollback
  PCI: Set new BAR Size only after releasing the BARs for BAR resize
  PCI: Abort BAR resize only if saving the resized BAR fails
  PCI: Consistently use Header Type to detect bridge headers
  resource: Check that the resource is in the tree when releasing it
  resource: Add KUnit test for releasing a resource not in the tree
  resource: Add release_leaf_resource()
  resource: Add KUnit test for release_leaf_resource()
  PCI: Do not release resources with children in pci_release_resource()
  resource: Rename next_resource() and for_each_resource()
  resource: Make resource_lock and resource tree traversal available
  resource: Add release_resource_locked()
  PCI: Split pci_resource_post_release() out of pci_release_resource()
  PCI: Add iterators for devices and resources in bus windows
  PCI: Release only PCI resources when releasing a resource tree

 drivers/pci/bus.c       |  33 +++++++++++
 drivers/pci/pci.h       |  23 ++++++++
 drivers/pci/setup-bus.c |  66 ++++++++++++++-------
 drivers/pci/setup-res.c | 124 +++++++++++++++++++++++++++++++++++++---
 include/linux/ioport.h  |  23 ++++++++
 kernel/resource.c       |  75 +++++++++++++++++-------
 kernel/resource_kunit.c |  44 ++++++++++++++
 7 files changed, 339 insertions(+), 49 deletions(-)


base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
-- 
2.47.3


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2026-12-02  0:23 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 15:58 [PATCH 00/15] PCI: Resource release fixes and improvements Ilpo Järvinen
2026-12-01 15:58 ` [PATCH 01/15] PCI: Release all resources before restoring them in BAR resize rollback Ilpo Järvinen
2026-12-01 15:58 ` [PATCH 02/15] PCI: Set new BAR Size only after releasing the BARs for BAR resize Ilpo Järvinen
2026-12-01 15:58 ` [PATCH 03/15] PCI: Abort BAR resize only if saving the resized BAR fails Ilpo Järvinen
2026-12-01 15:58 ` [PATCH 04/15] PCI: Consistently use Header Type to detect bridge headers Ilpo Järvinen
2026-12-01 15:58 ` [PATCH 05/15] resource: Check that the resource is in the tree when releasing it Ilpo Järvinen
2026-12-01 15:58 ` [PATCH 06/15] resource: Add KUnit test for releasing a resource not in the tree Ilpo Järvinen
2026-12-01 15:58 ` [PATCH 07/15] resource: Add release_leaf_resource() Ilpo Järvinen
2026-12-01 15:58 ` [PATCH 08/15] resource: Add KUnit test for release_leaf_resource() Ilpo Järvinen
2026-12-01 15:58 ` [PATCH 09/15] PCI: Do not release resources with children in pci_release_resource() Ilpo Järvinen
2026-12-01 15:58 ` [PATCH 10/15] resource: Rename next_resource() and for_each_resource() Ilpo Järvinen
2026-12-01 15:58 ` [PATCH 11/15] resource: Make resource_lock and resource tree traversal available Ilpo Järvinen
2026-12-01 15:58 ` [PATCH 12/15] resource: Add release_resource_locked() Ilpo Järvinen
2026-12-01 15:58 ` [PATCH 13/15] PCI: Split pci_resource_post_release() out of pci_release_resource() Ilpo Järvinen
2026-12-01 15:58 ` [PATCH 14/15] PCI: Add iterators for devices and resources in bus windows Ilpo Järvinen
2026-12-01 15:58 ` [PATCH 15/15] PCI: Release only PCI resources when releasing a resource tree Ilpo Järvinen
2026-12-02  0:22   ` Ilpo Järvinen
2026-12-01 16:09 ` ✗ CI.checkpatch: warning for PCI: Resource release fixes and improvements Patchwork
2026-12-01 16:11 ` ✓ CI.KUnit: success " Patchwork
2026-12-01 16:47 ` ✓ Xe.CI.BAT: " Patchwork
2026-12-01 16:56 ` ✓ i915.CI.BAT: " Patchwork

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.