Bug 1520294 - Hot-unplug the second pf cause qemu promote " Failed to remove group $iommu_group_num from KVM VFIO device:"
Summary: Hot-unplug the second pf cause qemu promote " Failed to remove group $iommu_g...
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev
Version: 7.5
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: Alex Williamson
QA Contact: Yanan Fu
Depends On:
TreeView+ depends on / blocked
Reported: 2017-12-04 08:25 UTC by Yanan Fu
Modified: 2018-04-11 00:54 UTC (History)
10 users (show)

Fixed In Version: qemu-kvm-rhev-2.10.0-13.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2018-04-11 00:52:14 UTC

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2018:1104 None None None 2018-04-11 00:54:28 UTC

Description Yanan Fu 2017-12-04 08:25:46 UTC
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:

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.

Comment 2 Alex Williamson 2017-12-05 21:17:16 UTC
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.


Comment 4 Eric Auger 2017-12-06 08:16:59 UTC
Reproduced the issue as well on ARM64 Gigabyte machine with assignment of the 2 X540T2 PFs.

Comment 6 Miroslav Rezanina 2017-12-19 16:22:32 UTC
Fix included in qemu-kvm-rhev-2.10.0-13.el7

Comment 7 Yanan Fu 2017-12-20 04:55:28 UTC
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.

Comment 9 Yanan Fu 2018-01-03 02:13:42 UTC
Move to VERIFIED according to comment 7.

Comment 12 errata-xmlrpc 2018-04-11 00:52:14 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.