Tested the patch with libvirt v7.2.0-381-g3c3c55be66 & qemu-kvm-5.2.0-0.7.rc2.fc34.x86_64
S1: Start domain with virtio-mem device
# virsh start pc_test
# virsh dumpxml pc_test
<domain type='kvm' id='11'>
<name>pc_test</name>
<uuid>927da985-2937-4dfe-ac13-be723293e0d9</uuid>
<maxMemory slots='16' unit='KiB'>6291456</maxMemory>
<memory unit='KiB'>1179648</memory>
<currentMemory unit='KiB'>1179648</currentMemory>
...
<memory model='virtio-mem'>
<source>
<nodemask>0</nodemask>
<pagesize unit='KiB'>2048</pagesize>
</source>
<target>
<size unit='KiB'>131072</size>
<node>0</node>
<block unit='KiB'>2048</block>
<requested unit='KiB'>131072</requested>
<actual unit='KiB'>131072</actual>
</target>
<alias name='virtiomem0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
</memory>
..
2. Hot plug a virtio-mem device, the values of memory & currentMemory are updated accordingly.
# cat mem.xml
<memory model='virtio-mem'>
<source>
<nodemask>0</nodemask>
<pagesize unit='KiB'>2048</pagesize>
</source>
<target>
<size unit='KiB'>131072</size>
<node>0</node>
<block unit='KiB'>2048</block>
<requested unit='KiB'>131072</requested>
<actual unit='KiB'>131072</actual>
</target>
</memory>
#virsh attach-device pc_test mem.xml
Device attached successfully
# virsh dumpxml pc_test
<memory unit='KiB'>1310720</memory>
<currentMemory unit='KiB'>1310720</currentMemory>
...
<memory model='virtio-mem'>
<source>
<nodemask>0</nodemask>
<pagesize unit='KiB'>2048</pagesize>
</source>
<target>
<size unit='KiB'>131072</size>
<node>0</node>
<block unit='KiB'>2048</block>
<requested unit='KiB'>131072</requested>
<actual unit='KiB'>131072</actual>
</target>
<alias name='virtiomem0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
</memory>
<memory model='virtio-mem'>
<source>
<nodemask>0</nodemask>
<pagesize unit='KiB'>2048</pagesize>
</source>
<target>
<size unit='KiB'>131072</size>
<node>0</node>
<block unit='KiB'>2048</block>
<requested unit='KiB'>131072</requested>
<actual unit='KiB'>131072</actual>
</target>
<alias name='virtiomem1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
</memory>
3. Updated the requested size, it's changed as expected.
# virsh update-memory-device pc_test --alias virtiomem1 --requested-size 100MiB
# virsh dumpxml pc_test
<memory unit='KiB'>1310720</memory>
<currentMemory unit='KiB'>1282048</currentMemory>
...
<memory model='virtio-mem'>
<source>
<nodemask>0</nodemask>
<pagesize unit='KiB'>2048</pagesize>
</source>
<target>
<size unit='KiB'>131072</size>
<node>0</node>
<block unit='KiB'>2048</block>
<requested unit='KiB'>102400</requested>
<actual unit='KiB'>102400</actual>
</target>
<alias name='virtiomem1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
</memory>
S2: From the docs, "virtio-pmem" works also.
# cat pmem.xml
<memory model='virtio-pmem' access='shared'>
<source>
<path>/tmp/nvdimm</path>
</source>
<target>
<size unit='KiB'>131072</size>
<label>
<size unit='KiB'>128</size>
</label>
</target>
</memory>
# virsh attach-device pc_test pmem.xml
Device attached successfully
#virsh dumpxml pc_test
<memory unit='KiB'>1441792</memory>
<currentMemory unit='KiB'>1282048</currentMemory>
Question:
But seems it don't support <node> element , and if add <node> element, below errors are prompted -
error: Failed to attach device from pmem
error: unsupported configuration: virtio-pmem does not support NUMA nodes
Since the <node> element is supported by nvdimm & virtio-mem, can you help to confirm if it's as expected?
@Michal Privoznik
Thanks,
Jing Qi