From: Ilpo Järvinen <[email protected]> Sent: Friday, November 20, 2026 4:55 AM > > On Wed, 18 Nov 2026, Michael Kelley wrote: > > > From: Ilpo Järvinen <[email protected]> Sent: Monday, November > > 16, 2026 7:24 AM > > > > > > The pci-hyperv driver scans the bus and assigns resources using > > > pci_bus_assign_resources(). That function makes bridge window sizing > > > disjoint from the assignment phase and is going to be removed. > > > > > > Convert pci_bus_assign_resources() to > > > pci_assign_unassigned_bus_resources(). If no other bridges are involved, > > > the extra sizing should be no-op. > > > > I tested this series on an x86 VM in the Azure public cloud that has > > 5 NVMe devices and a Mellanox VF NIC. All 6 devices are PCI pass-thru > > devices in the VM that are initially set up using the pci-hyperv.c driver, > > so each device has its own root bus and bridge. No issues were seen in > > a basic smoke test. > > > > I added some debug code to pci_assign_unassigned_bus_resources(), > > and indeed the "for_each_pci_bridge()" loop found nothing as each > > device was setup. So __pci_bus_assign_resources() was called with an > > empty add_list, and as expected, the new execution path is equivalent > > to the old pci_bus_assign_resources() call. > > > > Question: Your cover letter says drivers that call pci_assign_resources() > > directly are not covered by this series. pci-hyperv.c *does* call > > pci_assign_resources() directly in hv_pci_allocate_bridge_windows(). > > Is that a problem? I don't understand all the details of the PCI resource > > assignment well enough to judge for myself. :-( > > There's a small name mixup here.
Indeed! My bad .... > > pci_assign_resources() is to graft a device's resource (or a window) into > resource tree, whereas that calls pci_add_resource() adding windows to the > root bus and that seems to occur before there is anything underneath. At > this point, there's nothing to do for the resource fitting and assignment > algorithm (it iterates the devices underneath). > > ...So I don't see a race here related to pci_assign_resources(). > > Most entrypoints of the fitting and assignment algorith input bus, and I > don't think anything in kernel would as to assign resources underneath > that root bus. Only pci_assign_unassigned_resources() looks for all root > buses, and that is only called from arch init code so I don't think vfio > setting up it host bridges matters with that call. > > There seems to be, in general (not just hyperv), some races that are > unrelated to resource setup in host bridge setup and scanning. I'll see > what I can do but it'll be in a separate series and those seems to fall > under can-shoot-oneself's-own-foot category. > > Thanks for taking a look. Thank you! Michael
