!338 qemu: enable overcommit_memory while start cvm

From: @ikarosyuuki 
Reviewed-by: @mdsc, @lixiaomingg 
Signed-off-by: @mdsc
This commit is contained in:
openeuler-ci-bot 2024-07-10 08:20:23 +00:00 committed by Gitee
commit 4a4f99af37
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 41 additions and 1 deletions

View File

@ -101,7 +101,7 @@
Summary: Library providing a simple virtualization API
Name: libvirt
Version: 6.2.0
Release: 65
Release: 66
License: LGPLv2+
URL: https://libvirt.org/
@ -535,6 +535,7 @@ Patch0422: libvirt-add-get-tmm-memory-info-API-and-libvirtd-RPC.patch
Patch0423: virsh-add-tmm-main-command-word.patch
Patch0424: qemu-avoid-deadlock-in-qemuDomainObjStopWorker.patch
Patch0425: remote-fix-double-free-of-migration-params-on-error.patch
Patch0426: qemu-enable-overcommit_memory-while-start-cvm.patch
Requires: libvirt-daemon = %{version}-%{release}
Requires: libvirt-daemon-config-network = %{version}-%{release}
@ -2271,6 +2272,9 @@ exit 0
%changelog
* Thu July 1 2024 Jiabo Feng <tujipei@huawei.com> - 6.2.0-66
- qemu: enable overcommit_memory while start cvm
* Thu Jun 13 2024 Jiabo Feng <fengjiabo1@huawei.com> - 6.2.0-65
- remote: fix double free of migration params on error
- qemu: avoid deadlock in qemuDomainObjStopWorker We are dropping the only reference here so that the event loop thread is going to be exited synchronously. In order to avoid deadlocks we need to unlock the VM so that any handler being called can finish execution and thus even loop thread be finished too.

View File

@ -0,0 +1,36 @@
From 90b6a01fe7433e7d5ee3fc2e5eac334e2905fed9 Mon Sep 17 00:00:00 2001
From: ikarosYuuki <tujipei@huawei.com>
Date: Tue, 9 Jul 2024 22:03:05 +0800
Subject: [PATCH] qemu: enable overcommit_memory while start cvm In case of
asymmetric memory numa, starting cvm with huge memory might be prevented by
host kernel because of non-secure memory smaller than secure memory in the
same numa. Ensuring the normal launch of cvm, libvirt need to enable
overcommit_memory feature by writing the 1 to overcommit_memory system file.
Signed-off-by: ikarosYuuki <tujipei@huawei.com>
---
src/qemu/qemu_driver.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 1e3f63a39a..823ffbc673 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7424,6 +7424,14 @@ qemuDomainObjStart(virConnectPtr conn,
}
}
+ if (vm->def->cvm) {
+ if (virFileWriteStr("/proc/sys/vm/overcommit_memory", "1", 0)) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Failed to enable overcommit_memory"));
+ return -1;
+ }
+ }
+
ret = qemuProcessStart(conn, driver, vm, NULL, asyncJob,
NULL, -1, NULL, NULL,
VIR_NETDEV_VPORT_PROFILE_OP_CREATE, start_flags);
--
2.31.1.windows.1