]> git.baikalelectronics.ru Git - kernel.git/commit
vfio: Add device tracking during unbind
authorAlex Williamson <alex.williamson@redhat.com>
Fri, 6 Feb 2015 22:05:06 +0000 (15:05 -0700)
committerAlex Williamson <alex.williamson@redhat.com>
Fri, 6 Feb 2015 22:05:06 +0000 (15:05 -0700)
commitde25faa05134f407e08a4674f22f43bc915a7917
treed6adf501a76c7ba94c2fef6465082a49c23885f2
parent81068f0ec5afb6c3668ea81253fa84e3e5900713
vfio: Add device tracking during unbind

There's a small window between the vfio bus driver calling
vfio_del_group_dev() and the device being completely unbound where
the vfio group appears to be non-viable.  This creates a race for
users like QEMU/KVM where the kvm-vfio module tries to get an
external reference to the group in order to match and release an
existing reference, while the device is potentially being removed
from the vfio bus driver.  If the group is momentarily non-viable,
kvm-vfio may not be able to release the group reference until VM
shutdown, making the group unusable until that point.

Bridge the gap between device removal from the group and completion
of the driver unbind by tracking it in a list.  The device is added
to the list before the bus driver reference is released and removed
using the existing unbind notifier.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/vfio.c