Bug 1441291
| Summary: | USB device passthrough can't be used due to bogus VFIO check | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Daniel Berrangé <berrange> |
| Component: | libvirt | Assignee: | Erik Skultety <eskultet> |
| Status: | CLOSED ERRATA | QA Contact: | Pei Zhang <pzhang> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 7.4 | CC: | dgilbert, dyuan, eskultet, jiyan, lmen, rbalakri, xuzhang |
| Target Milestone: | rc | Keywords: | Regression |
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-3.2.0-3.el7 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2017-08-02 00:05:54 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
Patch proposed upstream: https://www.redhat.com/archives/libvir-list/2017-April/msg00594.html Fixed upstream by:
commit b4c2ac8d56124428d9329643a68625465094c5a7
Author: Erik Skultety <eskultet>
AuthorDate: Wed Apr 12 10:46:35 2017 +0200
Commit: Erik Skultety <eskultet>
CommitDate: Wed Apr 12 12:57:39 2017 +0200
qemu: Fix mdev checking for VFIO support
Commit a4a39d90 added a check that checks for VFIO support with mediated
devices. The problem is that the hostdev preparing functions behave like
a fallthrough if device of that specific type doesn't exist. However,
the check for VFIO support was independent of the existence of a mdev
device which caused the guest to fail to start with any device to be
directly assigned if VFIO was disabled/unavailable in the kernel.
The proposed change first ensures that it makes sense to check for VFIO
support in the first place, and only then performs the VFIO support check
itself.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1441291
v3.2.0-124-gb4c2ac8d5
*** Bug 1446086 has been marked as a duplicate of this bug. *** I can reproduce it and verify it as following :
versions:
libvirt-3.2.0-4.el7.x86_64
qemu-kvm-rhev-2.9.0-3.el7.x86_64
steps:
1. Define a VM with an USB hostdev as folowing:
# virsh dumpxml r74 | grep hostdev -A 5
<hostdev mode='subsystem' type='usb' managed='no'>
<source startupPolicy='optional'>
<vendor id='0x0951'/>
<product id='0x1666'/>
</source>
<address type='usb' bus='0' port='5'/>
</hostdev>
# virsh start r74
Domain r74 started
Guest can start successfully.
2. Start a VM, hotplug an USB hostdev.
# virsh list
Id Name State
----------------------------------------------------
10 r74 running
# cat hostdev1.xml
<hostdev mode='subsystem' type='usb'>
<source startupPolicy='optional'>
<vendor id='0x0951'/>
<product id='0x1666'/>
</source>
</hostdev>
# virsh attach-device r74 hostdev1.xml
Device attached successfully
3. Start guest with mdev hostdev when no VFIO support.
It should report an error.
# virsh attach-device r74 mdev.xml --config
Device attached successfully
# virsh destroy r74; virsh start r74
Domain r74 destroyed
error: Failed to start domain r74
error: unsupported configuration: Mediated host device assignment requires VFIO support
As comment 8, move this bug to verified. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHEA-2017:1846 Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHEA-2017:1846 |
Description of problem: On a system which lacks support for either the vfio kernel module, or lacks IOMMU hardware, it is no longer possible to use host USB device assignment eg create a simple guest which contains a single USB hostdev: <hostdev mode='subsystem' type='usb' managed='no'> <source startupPolicy='optional'> <vendor id='0x1050'/> <product id='0x0010'/> </source> <address type='usb' bus='0' port='4'/> </hostdev> and then try to start it, and you get a bogus error message about PCI VFIO support: # virsh start f25x86_64 error: Failed to start domain f25x86_64 error: unsupported configuration: host doesn't support VFIO PCI interface This is regression caused by: commit a4a39d90ab4930750bcbcfccffdf6bb6d310b5d5 Author: Erik Skultety <eskultet> Date: Fri Feb 3 14:04:59 2017 +0100 hostdev: Maintain a driver list of active mediated devices Keep track of the assigned mediated devices the same way we do it for the rest of hostdevs. Methods like 'Prepare', 'Update', and 'ReAttach' are introduced by this patch. which introduced this check + if (!qemuHostdevHostSupportsPassthroughVFIO()) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("host doesn't support VFIO PCI interface")); + return -1; + } + that is run regardless of whether mediated devices are actually present or not. Deleting the USB hostdev lets the guest start Version-Release number of selected component (if applicable): 3.2.0-1.el7 How reproducible: Always Steps to Reproduce: 1. Create a guest with a single host USB device attached 2. Try start the geust 3.