[PATCH 00/10] VFIO fixes for PCI devices

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

 



This series is my attempt at fixing

  https://bugzilla.redhat.com/show_bug.cgi?id=1272300

In its current state, it's missing test cases covering the new
functionality[1] and it's known not to handle properly one
situation[2], but I'd like to get some feedback on my current
work and now that I have something to show for it feels like
a good time.

I'm already working on the missing bits and they will either
be included in the next revision or sent as separate series
later on.

The problem being solved is that, when using VFIO, IOMMU group
ownership can't be shared, eg. two devices that are in the
same IOMMU group can't be assigned to different guests, or to
the host and a guest. If that happens, the host will probably
crash.

The series deals with this issue by making sure safety
conditions are met before detaching devices from the host or
reattaching them to the host. In praticular, when we're asked
to reattach a device to the host but doing so would lead to
sharing IOMMU group ownership, we delay the operation until
we can guarantee this will not cause problems. As a nice side
effect of the changes we check for this when starting a guest
too, instead of assuming it will work and having QEMU error
out immediately afterwards.

Patches are organized as follows:

  1-2: Minor cleanups that make implicit / confusing stuff
       explicit / less confusing
    3: Convert a string field used as an enumeration to a
       proper enumeration
    4: Introduce a simple helper function used later on
  5-6: Rewrite the checks used when detaching devices from
       the host. With this patches applied, the behaviour
       is basically the same as before, except for the nice
       little extra detailed above
  7-9: Implement the delay when reattaching devices to the
       host, thus preventing the crash and fixing the bug
   10: Spit and polish

Cheers.


[1] Luckily, it doesn't break the existing tests either
[2] If you call 'virsh nodedev-reattach' on a device that's
    assigned to a guest, libvirt won't stop you and you will
    end up crashing your system

Andrea Bolognani (10):
  pci: Remove redundant parameter from virPCIDeviceBindToStub()
  pci: Remove 'reprobe' parameter from virPCIDeviceUnbind()
  pci: Introduce virPCIStubDriver enumeration
  pci: Introduce virPCIDeviceIOMMUGroupIterate()
  hostdev: Simplify virHostdevIsPCIDeviceUsed()
  hostdev: Check for safety before detaching VFIO devices
  hostdev: Delay reattach of VFIO devices
  hostdev: Clean up delayed VFIO devices
  hostdev: Devices have already been marked as inactive
  hostdev: Tidy up after changes to VFIO device handling

 src/libvirt_private.syms |   3 +
 src/libxl/libxl_driver.c |   3 +-
 src/qemu/qemu_driver.c   |   6 +-
 src/util/virhostdev.c    | 410 ++++++++++++++++++++++++++++++++++-------------
 src/util/virpci.c        | 125 +++++++++------
 src/util/virpci.h        |  26 ++-
 src/xen/xen_driver.c     |   3 +-
 tests/virhostdevtest.c   |   5 +-
 tests/virpcitest.c       |  35 ++--
 9 files changed, 427 insertions(+), 189 deletions(-)

-- 
2.5.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]