Re: [Intel-gfx] [PATCH v2 10/14] vfio/pci: Reorganize VFIO_DEVICE_PCI_HOT_RESET to use the device set

Jason Gunthorpe
2021-07-23T13:31:25Z

On Fri, Jul 23, 2021 at 10:12:08AM +0200, Christoph Hellwig wrote:
> On Tue, Jul 20, 2021 at 02:42:56PM -0300, Jason Gunthorpe wrote:
> > Like vfio_pci_try_bus_reset() this code wants to reset all of the devices
> > in the "reset group" which is the same membership as the device set.
> >
> > Instead of trying to reconstruct the device set from the PCI list go
> > directly from the device set's device list to execute the reset.
> >
> > The same basic structure as vfio_pci_try_bus_reset() is used. The
> > 'vfio_devices' struct is replaced with the device set linked list and we
> > simply sweep it multiple times under the lock.
> >
> > This eliminates a memory allocation and get/put traffic and another
> > improperly locked test of pci_dev_driver().
>
> Looks fine. But oh gad is that locking scheme awful..

I hope that the address space patches Alex has been working on will
help this.

And as I wrote it I was wondering if we can swap the dev_set lock for
all these other locks and just delete the whole thing..

Thanks,
Jason