Re: [PATCH v2] vfio-pci: Accept a non-zero open_count on reset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 02, 2022 at 03:45:27PM -0600, Alex Williamson wrote:
> > open_count was from before we changed the core code to call
> > open_device only once. If we are only a call chain from
> > open_device/close_device then we know that the open_count must be 1.
> 
> That accounts for the first test, we don't need to test open_count on
> the calling device in this path, but the idea here is that we want to
> test whether we're the last close_device among the set.  Not sure how
> we'd do that w/o some visibility to open_count.  Maybe we need a
> vfio_device_set_open_count() that when 1 we know we're the first open
> or last close?  Thanks,

Right, we are checking the open count on all the devices in the set,
so I think that just this hunk is fine:

> > > > -		if (cur->vdev.open_count)
> > > > +		if (cur != vdev && cur->vdev.open_count)
> > > >  			return false;  

Because vfio_pci_dev_set_needs_reset() is always called from
open/close (which is how it picks up the devset lock), so we never
need to consider the current device by definition, it is always "just
being closed"

A little comment to explain this and that should be it?

Jason



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux