mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemuBuildMemPathStr: Produce -mem-path more frequently
https://bugzilla.redhat.com/show_bug.cgi?id=1622455 If a domain is configured to use <source type='file'/> under <memoryBacking/> we have to honour that setting and produce -mem-path on the command line. We are not doing so if domain has no guest NUMA nodes nor hugepages. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
4b7b0c2453
commit
65a547aa8e
@ -7531,21 +7531,22 @@ qemuBuildMemPathStr(virQEMUDriverConfigPtr cfg,
|
||||
const long system_page_size = virGetSystemPageSizeKB();
|
||||
char *mem_path = NULL;
|
||||
|
||||
/*
|
||||
* No-op if hugepages were not requested.
|
||||
*/
|
||||
if (!def->mem.nhugepages)
|
||||
/* There are two cases where we want to put -mem-path onto
|
||||
* the command line: First one is when there are no guest
|
||||
* NUMA nodes and hugepages are configured. The second one is
|
||||
* if user requested file allocation. */
|
||||
if (def->mem.nhugepages &&
|
||||
def->mem.hugepages[0].size != system_page_size) {
|
||||
if (qemuGetDomainHupageMemPath(def, cfg,
|
||||
def->mem.hugepages[0].size,
|
||||
&mem_path) < 0)
|
||||
return -1;
|
||||
} else if (def->mem.source == VIR_DOMAIN_MEMORY_SOURCE_FILE) {
|
||||
if (qemuGetMemoryBackingPath(def, cfg, "ram", &mem_path) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
|
||||
/* There is one special case: if user specified "huge"
|
||||
* pages of regular system pages size.
|
||||
* And there is nothing to do in this case.
|
||||
*/
|
||||
if (def->mem.hugepages[0].size == system_page_size)
|
||||
return 0;
|
||||
|
||||
if (qemuGetDomainHupageMemPath(def, cfg, def->mem.hugepages[0].size, &mem_path) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (def->mem.allocation != VIR_DOMAIN_MEMORY_ALLOCATION_IMMEDIATE)
|
||||
virCommandAddArgList(cmd, "-mem-prealloc", NULL);
|
||||
|
@ -10,6 +10,7 @@ QEMU_AUDIO_DRV=none \
|
||||
-machine pc-i440fx-wily,accel=kvm,usb=off,dump-guest-core=off \
|
||||
-m 14336 \
|
||||
-mem-prealloc \
|
||||
-mem-path /var/lib/libvirt/qemu/ram/libvirt/qemu/-1-instance-00000092/ram \
|
||||
-smp 8,sockets=8,cores=1,threads=1 \
|
||||
-uuid 126f2720-6f8e-45ab-a886-ec9277079a67 \
|
||||
-display none \
|
||||
|
Loading…
x
Reference in New Issue
Block a user