Red Hat Bugzilla – Bug 1520294
Hot-unplug the second pf cause qemu promote " Failed to remove group $iommu_group_num from KVM VFIO device:"
Last modified: 2018-04-10 20:54:29 EDT
Description of problem: Boot VM with two vfio-pci devices, then hot-unplug the second device, qemu monitor will promote "qemu-kvm: Failed to remove group 42 from KVM VFIO device: No such file or directory". For the first one it is ok. I haven't found the effect yet. Both guest and host work well, the device can be un-pluged successfully when check in guest and in qemu side. Version-Release number of selected component (if applicable): qemu: qemu-kvm-rhev-2.10.0-9.el7.x86_64 kernel: kernel-3.10.0-797.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1.Boot VM with two vfio-pci device: -device vfio-pci,host=04:00.0,id=pf1 \ -device vfio-pci,host=04:00.1,id=pf2 \ 2. Hot-unplug pf2, qemu monitor promote "qemu-kvm: Failed to remove group 42 from KVM VFIO device: No such file or directory", then hot-unplug pf1, it isok. 3. If hot-unplug pf1 first, it is ok too. hot-unplug pf2, meet the same problem. Actual results: qemu monitor promote "qemu-kvm: Failed to remove group 42 from KVM VFIO device: No such file or directory" Expected results: No this message Additional info: 1. This two devices(04:00.0, 04:00.1) are in different iommu group. 2. It is related with the order in which the device is added. Only hot-unplug the second device have this problem. 3. This is not related with guest, both win2016 and rhel7.5 all have this problem. 4. This message are promoted in hmp monitor, no matter execute "device_del" with hmp or qmp. 5. Test with two devices that have different driver, have the same problem. -device vfio-pci,host=04:00.0,id=pf1 \ (XL710 nic - i40e driver) -device vfio-pci,host=83:00.0,id=pf2 \ (BCM57810 nic - bnx2x driver) 6. Test with two BCM57810 nics, it is ok. -device vfio-pci,host=83:00.0,id=pf1 \ -device vfio-pci,host=83:00.1,id=pf2 \ In my host, this two devices are in same iommu group.
This is indeed a qemu-kvm-rhev bug, a regression was introduced in QEMU 2.10 where additional groups attached to the same container do not get registered with the kvm-vfio device, thus when those devices are removed we can't find the original registration. More worrisome is that if the first device gets removed, KVM might revert to instruction emulation that isn't compatible with IOMMUs with non-coherent DMA. KVMGT could also be affected if the vGPU is not the first device registered as the "set KVM" notifier would not be triggered. Posted upstream and will try to get in for QEMU 2.11. Eric, I'd appreciate a timely upstream review given how close we are to 2.11 upstream. Adding regression tag since the result here could be more serious than a spurious warning message. https://lists.gnu.org/archive/html/qemu-devel/2017-12/msg00774.html
Reproduced the issue as well on ARM64 Gigabyte machine with assignment of the 2 X540T2 PFs.
Fix included in qemu-kvm-rhev-2.10.0-13.el7
Test with new version: qemu: qemu-kvm-rhev-2.10.0-13.el7 kernel: kernel-3.10.0-820.el7.x86_64 Same test steps, it is ok. This issue already be fixed.
Move to VERIFIED according to comment 7.
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/RHSA-2018:1104