-
Bug
-
Resolution: Unresolved
-
Undefined
-
None
-
rhel-10.2
-
None
-
None
-
None
-
rhel-virt-core-libvirt-1
-
None
-
False
-
False
-
-
None
-
None
-
None
-
None
-
Unspecified
-
Unspecified
-
Unspecified
-
-
x86_64
-
None
What were you trying to do that didn't work?
There a 2 pic device in same iommu group. Hotplug one device with manage='yes' and iommufd backend to guest then get a expect error. But when hotplug the other device with manage='yes' and iommufd backend to guest, the virsh attach-device cmd hangs without return.
Please provide the package NVR for which the bug is seen:
# rpm -q libvirt qemu-kvm libvirt-11.10.0-10.el10.x86_64 qemu-kvm-10.1.0-13.el10.x86_64
How reproducible is this bug?:100%
Steps to reproduce
1. There are 2 pci device within same iommu group on host:
# ls -l /sys/bus/pci/devices/0000\:01\:00.1/driver lrwxrwxrwx. 1 root root 0 Mar 9 03:16 /sys/bus/pci/devices/0000:01:00.1/driver -> ../../../../bus/pci/drivers/tg3 # ls -l /sys/bus/pci/devices/0000\:01\:00.0/driver lrwxrwxrwx. 1 root root 0 Mar 9 03:18 /sys/bus/pci/devices/0000:01:00.0/driver -> ../../../../bus/pci/drivers/tg3 # ls -ld /sys/bus/pci/devices/0000:01:00.0/iommu_group lrwxrwxrwx. 1 root root 0 Mar 5 06:51 /sys/bus/pci/devices/0000:01:00.0/iommu_group -> ../../../../kernel/iommu_groups/28 # ls -ld /sys/bus/pci/devices/0000:01:00.1/iommu_group lrwxrwxrwx. 1 root root 0 Mar 5 06:51 /sys/bus/pci/devices/0000:01:00.1/iommu_group -> ../../../../kernel/iommu_groups/28
2. Start a guest
3. Hoplug one pci device to the guest, then get the error:
# cat pci-0.xml <hostdev mode='subsystem' type='pci' managed='yes'> <driver iommufd='yes'/> <source> <address domain='0x0000' bus='0x01' slot='0x00' function='0x0'/> </source> </hostdev> # virsh attach-device vm2 pci-0.xml error: Failed to attach device from pci-0.xml error: internal error: unable to execute QEMU command 'device_add': vfio hostdev0: error bind device fd=108 to iommufd=107: Operation not permitted
4. Check the driver of pci devices:
# ls -l /sys/bus/pci/devices/0000\:01\:00.1/driver lrwxrwxrwx. 1 root root 0 Mar 9 03:16 /sys/bus/pci/devices/0000:01:00.1/driver -> ../../../../bus/pci/drivers/tg3 # ls -l /sys/bus/pci/devices/0000\:01\:00.0/driver lrwxrwxrwx. 1 root root 0 Mar 9 03:26 /sys/bus/pci/devices/0000:01:00.0/driver -> ../../../../bus/pci/drivers/tg3
5. Hoplug the other pci device to the guest, found the virsh cmd hangs there:
# cat pci-1.xml <hostdev mode='subsystem' type='pci' managed='yes'> <driver iommufd='yes'/> <source> <address domain='0x0000' bus='0x01' slot='0x00' function='0x1'/> </source> </hostdev> # virsh attach-device vm2 pci-1.xml
6. Then check the driver of pci devices:
- ls -l /sys/bus/pci/devices/0000\:01\:00.0/driver
lrwxrwxrwx. 1 root root 0 Mar 9 03:26 /sys/bus/pci/devices/0000:01:00.0/driver -> ../../../../bus/pci/drivers/tg3 - ls -l /sys/bus/pci/devices/0000\:01\:00.1/driver
lrwxrwxrwx. 1 root root 0 Mar 9 03:27 /sys/bus/pci/devices/0000:01:00.1/driver -> ../../../../bus/pci/drivers/vfio-pciExpected results
The virsh attach-device cmd should give error as the first time.
Actual results
The virsh attach-device cmd hangs.
Additional info:
The same behavior when exchanging the hotplug sequence of the pci devices.