Re: [PATCH v2 02/10] PCI/LUO: Create requested liveupdate device list

Chris Li
2025-10-03T05:33:32Z

On Mon, Sep 29, 2025 at 10:46 AM Jason Gunthorpe <jgg@ziepe.ca> wrote:
>
> On Tue, Sep 16, 2025 at 12:45:10AM -0700, Chris Li wrote:
> > static int pci_liveupdate_prepare(void *arg, u64 *data)
> > {
> > + LIST_HEAD(requested_devices);
> > +
> > pr_info("prepare data[%llx]\n", *data);
> > +
> > + pci_lock_rescan_remove();
> > + down_write(&pci_bus_sem);
> > +
> > + build_liveupdate_devices(&requested_devices);
> > + cleanup_liveupdate_devices(&requested_devices);
> > +
> > + up_write(&pci_bus_sem);
> > + pci_unlock_rescan_remove();
> > return 0;
> > }
>
> This doesn't seem conceptually right, PCI should not be preserving
> everything. Only devices and their related hierarchy that are opted
> into live update by iommufd should be preserved.

The consideration is that some non vfio device like IDPF is preserved
as well. Does the iommufd encapsulate all the PCI device hierarchy? I
was thinking the PCI layer knows about the PCI device hierarchy,
therefore using pci_dev->dev.lu.flags to indicate the participation of
the PCI liveupdate. Not sure how to drive that from iommufd. Can you
explain a bit more?

Chris