mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-21 19:02:25 +00:00
qemu: Don't use memory-backend-memfd for NVDIMMs
If guest is configured to use memfd then the function that build memory-backend-* part of command line will put memory-backend-memfd, always. Even for NVDIMMs. This is not correct, because NVDIMMs need a backing path (usually to a real host NVDIMM device). Therefore, regardless of memfd being requested, we have to stick with memory-backend-file. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
parent
cda47bac25
commit
c6d7b9a261
@ -3052,7 +3052,8 @@ qemuBuildMemoryBackendProps(virJSONValue **backendProps,
|
||||
|
||||
props = virJSONValueNewObject();
|
||||
|
||||
if (def->mem.source == VIR_DOMAIN_MEMORY_SOURCE_MEMFD) {
|
||||
if (!mem->nvdimmPath &&
|
||||
def->mem.source == VIR_DOMAIN_MEMORY_SOURCE_MEMFD) {
|
||||
backendType = "memory-backend-memfd";
|
||||
|
||||
if (useHugepage) {
|
||||
|
@ -10,13 +10,15 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-instance-00000092/.config \
|
||||
-name guest=instance-00000092,debug-threads=on \
|
||||
-S \
|
||||
-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-instance-00000092/master-key.aes"}' \
|
||||
-machine pc-i440fx-2.3,accel=kvm,usb=off,dump-guest-core=off \
|
||||
-machine pc-i440fx-2.3,accel=kvm,usb=off,dump-guest-core=off,nvdimm=on \
|
||||
-cpu qemu64 \
|
||||
-m 14336 \
|
||||
-m size=14680064k,slots=16,maxmem=1099511627776k \
|
||||
-overcommit mem-lock=off \
|
||||
-smp 8,sockets=1,dies=1,cores=8,threads=1 \
|
||||
-object '{"qom-type":"memory-backend-memfd","id":"ram-node0","hugetlb":true,"hugetlbsize":2097152,"share":true,"prealloc":true,"size":15032385536,"host-nodes":[3],"policy":"preferred"}' \
|
||||
-numa node,nodeid=0,cpus=0-7,memdev=ram-node0 \
|
||||
-object '{"qom-type":"memory-backend-file","id":"memnvdimm0","mem-path":"/tmp/nvdimm","share":true,"prealloc":true,"size":536870912,"host-nodes":[3],"policy":"preferred"}' \
|
||||
-device nvdimm,node=0,memdev=memnvdimm0,id=nvdimm0,slot=0 \
|
||||
-uuid 126f2720-6f8e-45ab-a886-ec9277079a67 \
|
||||
-display none \
|
||||
-no-user-config \
|
||||
|
@ -1,6 +1,7 @@
|
||||
<domain type='kvm'>
|
||||
<name>instance-00000092</name>
|
||||
<uuid>126f2720-6f8e-45ab-a886-ec9277079a67</uuid>
|
||||
<maxMemory slots='16' unit='KiB'>1099511627776</maxMemory>
|
||||
<memory unit='KiB'>14680064</memory>
|
||||
<currentMemory unit='KiB'>14680064</currentMemory>
|
||||
<memoryBacking>
|
||||
@ -41,5 +42,15 @@
|
||||
<memballoon model='virtio'>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
|
||||
</memballoon>
|
||||
<memory model='nvdimm'>
|
||||
<source>
|
||||
<path>/tmp/nvdimm</path>
|
||||
</source>
|
||||
<target>
|
||||
<size unit='KiB'>523264</size>
|
||||
<node>0</node>
|
||||
</target>
|
||||
<address type='dimm' slot='0'/>
|
||||
</memory>
|
||||
</devices>
|
||||
</domain>
|
||||
|
@ -1306,7 +1306,8 @@ mymain(void)
|
||||
DO_TEST("memfd-memory-numa",
|
||||
QEMU_CAPS_OBJECT_MEMORY_MEMFD,
|
||||
QEMU_CAPS_OBJECT_MEMORY_MEMFD_HUGETLB,
|
||||
QEMU_CAPS_OBJECT_MEMORY_FILE);
|
||||
QEMU_CAPS_OBJECT_MEMORY_FILE,
|
||||
QEMU_CAPS_DEVICE_NVDIMM);
|
||||
DO_TEST("memfd-memory-default-hugepage",
|
||||
QEMU_CAPS_OBJECT_MEMORY_MEMFD,
|
||||
QEMU_CAPS_OBJECT_MEMORY_MEMFD_HUGETLB,
|
||||
|
Loading…
x
Reference in New Issue
Block a user