-
Bug
-
Resolution: Unresolved
-
Undefined
-
None
-
rhel-9.2.0
-
Minor
-
sst_virtualization_networking
-
ssg_virtualization
-
1
-
False
-
-
If docs needed, set a value
-
-
Unspecified
Description of problem:
memlock limit increase even the hotplug is not succeed when there is a vdpa interface
Version-Release number of selected component (if applicable):
libvirt-9.0.0-7.el9.x86_64
How reproducible:
100%
Steps to Reproduce:
1. start vm with 2G memory and a vdpa interface;# virsh dumpxml rhel <memory unit='KiB'>2097152</memory>
<currentMemory unit='KiB'>2097152</currentMemory>
...
<interface type="vdpa">
<mac address="00:11:22:33:44:00"/>
<source dev="/dev/vhost-vdpa-0"/>
<model type="virtio"/>
<alias name="ua-test"/>
<address type="pci" domain="0x0000" bus="0x01" slot="0x00" function="0x0"/>
</interface>
- virsh start rhel
Domain 'rhel' started
2. check the memlock limit, it's 3G, which is as expected:# prlimit -p `pidof qemu-kvm` | grep MEMLOCK
MEMLOCK max locked-in-memory address space 3221225472 3221225472 bytes
3. prepare a hostdev device xml which is not in a separate iommu group: # cat device.xml
<hostdev mode='subsystem' type='pci' managed='yes'>
<source>
<address domain='0x0000' bus='0x04' slot='0x00' function='0x1'/>
</source>
</hostdev>
- virsh nodedev-dumpxml pci_0000_04_00_0 --xpath //iommuGroup
<iommuGroup number="14">
<address domain="0x0000" bus="0x04" slot="0x00" function="0x1"/>
<address domain="0x0000" bus="0x04" slot="0x00" function="0x0"/>
</iommuGroup>
3. try to hotplug the device, then check the memlock limit is updated:# virsh attach-device rhel device.xml
error: Failed to attach device from device.xml
error: internal error: unable to execute QEMU command 'device_add': vfio 0000:04:00.1: group 14 is not viable
- prlimit -p `pidof qemu-kvm` | grep MEMLOCK
MEMLOCK max locked-in-memory address space 5368709120 5368709120 bytes
Actual results:
In step 3, the memlock limit increase even the hotplug is not succeed
Expected results:
In step 3, the memlock limit should not be updated since the hotplug is not succeed
Additional info:
1). If no vdpa interface exists in the vm, the memlock limit will not increase, which is as expected;# virsh attach-device rhel device1.xml
error: Failed to attach device from device1.xml
error: internal error: unable to execute QEMU command 'device_add': vfio 0000:19:00.1: group 29 is not viable
- prlimit -p `pidof qemu-kvm` | grep MEMLOCK
MEMLOCK max locked-in-memory address space 67108864 67108864 bytes
2). No such issue for hotplug with other reasons like:a. the device is occupied by other domain:# virsh attach-interface rhel hostdev --managed 0000:3b:0a.0
error: Failed to attach interface
error: Requested operation is not valid: PCI device 0000:3b:0a.0 is in use by driver QEMU, domain test
- prlimit -p 8662 | grep MEMLOCK
MEMLOCK max locked-in-memory address space 67108864 67108864 bytesb. do not enable iommu:# virsh attach-interface rhel hostdev --managed 0000:3b:0a.0
error: Failed to attach interface
error: unsupported configuration: host doesn't support passthrough of host PCI devices - prlimit -p `pidof qemu-kvm` | grep MEMLOCK
MEMLOCK max locked-in-memory address space 67108864 67108864 bytes
- external trackers