From dfed5f54d6fd0bbed6aa716dda2944ecdd63f236 Mon Sep 17 00:00:00 2001 From: ikarosYuuki Date: Wed, 10 Jul 2024 15:20:57 +0800 Subject: [PATCH 1/2] qemu: enable overcommit_memory while start cvm - qemu: enable overcommit_memory while start cvm Signed-off-by: ikarosYuuki (cherry picked from commit 8e920e9de2c12be1b438cef31828997b17f63eda) --- libvirt.spec | 6 +++- ...le-overcommit_memory-while-start-cvm.patch | 36 +++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 qemu-enable-overcommit_memory-while-start-cvm.patch diff --git a/libvirt.spec b/libvirt.spec index 214e57b..b07be50 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -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 ikarosYuuki - 6.2.0-66 +- qemu: enable overcommit_memory while start cvm + * Thu Jun 13 2024 Jiabo Feng - 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. diff --git a/qemu-enable-overcommit_memory-while-start-cvm.patch b/qemu-enable-overcommit_memory-while-start-cvm.patch new file mode 100644 index 0000000..2c32a0a --- /dev/null +++ b/qemu-enable-overcommit_memory-while-start-cvm.patch @@ -0,0 +1,36 @@ +From 90b6a01fe7433e7d5ee3fc2e5eac334e2905fed9 Mon Sep 17 00:00:00 2001 +From: ikarosYuuki +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 +--- + 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 + -- Gitee From 3794a89ceba197868b20efcf8764a4d3bb76346e Mon Sep 17 00:00:00 2001 From: Jiabo Feng Date: Thu, 22 Aug 2024 15:43:01 +0800 Subject: [PATCH 2/2] libvirt update to version 6.2.0-67: - virt-host-validate: Fix IOMMU output on aarch64 - cpu: revert: Modify virCPUarmCompare to perform compare actions - cpu: Modify virCPUarmCompare to perform compare actions - add phytium s5000c support on arm architecture for capability Signed-off-by: Jiabo Feng (cherry picked from commit 44c38ffc1edcbe107228e1bfb254fbccee15d88c) --- ...0c-support-on-arm-architecture-for-c.patch | 55 ++++++++++ ...UarmCompare-to-perform-compare-actio.patch | 46 ++++++++ ...y-virCPUarmCompare-to-perform-compar.patch | 33 ++++++ libvirt.spec | 12 ++- ...validate-Fix-IOMMU-output-on-aarch64.patch | 102 ++++++++++++++++++ 5 files changed, 247 insertions(+), 1 deletion(-) create mode 100644 add-phytium-s5000c-support-on-arm-architecture-for-c.patch create mode 100644 cpu-Modify-virCPUarmCompare-to-perform-compare-actio.patch create mode 100644 cpu-revert-Modify-virCPUarmCompare-to-perform-compar.patch create mode 100644 virt-host-validate-Fix-IOMMU-output-on-aarch64.patch diff --git a/add-phytium-s5000c-support-on-arm-architecture-for-c.patch b/add-phytium-s5000c-support-on-arm-architecture-for-c.patch new file mode 100644 index 0000000..8d8009e --- /dev/null +++ b/add-phytium-s5000c-support-on-arm-architecture-for-c.patch @@ -0,0 +1,55 @@ +From 942ec21751ab2af7d74ee1f3aa01f60b77cb8e5f Mon Sep 17 00:00:00 2001 +From: pengmengguang +Date: Wed, 3 Jul 2024 09:44:36 +0800 +Subject: [PATCH] add phytium s5000c support on arm architecture for capability + +Add information of phytium s5000c in relative files. + +Signed-off-by: pengmengguang +Signed-off-by: Jiakun Shuai +--- + src/cpu_map/Makefile.inc.am | 1 + + src/cpu_map/arm_Tengyun-S5000C.xml | 6 ++++++ + src/cpu_map/index.xml | 1 + + 3 files changed, 8 insertions(+) + create mode 100644 src/cpu_map/arm_Tengyun-S5000C.xml + +diff --git a/src/cpu_map/Makefile.inc.am b/src/cpu_map/Makefile.inc.am +index 3c674dea40..203d1feb6b 100644 +--- a/src/cpu_map/Makefile.inc.am ++++ b/src/cpu_map/Makefile.inc.am +@@ -77,6 +77,7 @@ cpumap_DATA = \ + cpu_map/arm_Kunpeng-920.xml \ + cpu_map/arm_FT-2000plus.xml \ + cpu_map/arm_Tengyun-S2500.xml \ ++ cpu_map/arm_Tengyun-S5000C.xml \ + $(NULL) + + EXTRA_DIST += $(cpumap_DATA) +diff --git a/src/cpu_map/arm_Tengyun-S5000C.xml b/src/cpu_map/arm_Tengyun-S5000C.xml +new file mode 100644 +index 0000000000..f8fa593c19 +--- /dev/null ++++ b/src/cpu_map/arm_Tengyun-S5000C.xml +@@ -0,0 +1,6 @@ ++ ++ ++ ++ ++ ++ +diff --git a/src/cpu_map/index.xml b/src/cpu_map/index.xml +index 1c05dd814d..1b7f50d76a 100644 +--- a/src/cpu_map/index.xml ++++ b/src/cpu_map/index.xml +@@ -100,6 +100,7 @@ + + + ++ + + + +-- +2.41.0.windows.1 + diff --git a/cpu-Modify-virCPUarmCompare-to-perform-compare-actio.patch b/cpu-Modify-virCPUarmCompare-to-perform-compare-actio.patch new file mode 100644 index 0000000..d3611db --- /dev/null +++ b/cpu-Modify-virCPUarmCompare-to-perform-compare-actio.patch @@ -0,0 +1,46 @@ +From 0acd85e553d371b86b5c387f23301947329fdcf3 Mon Sep 17 00:00:00 2001 +From: Zhenyu Zheng +Date: Thu, 24 Sep 2020 22:12:21 +0800 +Subject: [PATCH] cpu: Modify virCPUarmCompare to perform compare actions + +Modify virCPUarmCompare in cpu_arm.c to perform compare action. +This patch only adds host to host CPU compare, the rest cases +remains the same. This is useful for source and destination host +compare during migrations to avoid migration between different +CPU models that have different CPU freatures. + +------------------------------------------------------------- + +This patch only adds host to host CPU compare, the rest cases +remains the same. + +Signed-off-by: Zhenyu Zheng +Signed-off-by: Michal Privoznik +Reviewed-by: Daniel Henrique Barboza +Reviewed-by: Michal Privoznik +Signed-off-by: pengmengguang +Conflicts: + [pengmengguang: adjust content] +Signed-off-by: Jiakun Shuai +--- + src/cpu/cpu_arm.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c +index a0c0befaa0..b2b2d90a40 100644 +--- a/src/cpu/cpu_arm.c ++++ b/src/cpu/cpu_arm.c +@@ -979,6 +979,10 @@ virCPUarmCompare(virCPUDefPtr host, + virCPUCompareResult ret = VIR_CPU_COMPARE_ERROR; + g_autofree char *message = NULL; + ++ /* Only support host to host CPU compare for ARM */ ++ if (cpu->type != VIR_CPU_TYPE_HOST) ++ return VIR_CPU_COMPARE_IDENTICAL; ++ + if (!host || !host->model) { + if (failMessages) { + virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", +-- +2.41.0.windows.1 + diff --git a/cpu-revert-Modify-virCPUarmCompare-to-perform-compar.patch b/cpu-revert-Modify-virCPUarmCompare-to-perform-compar.patch new file mode 100644 index 0000000..d3554d7 --- /dev/null +++ b/cpu-revert-Modify-virCPUarmCompare-to-perform-compar.patch @@ -0,0 +1,33 @@ +From e980606145f5a3d8e1e669982f2e8d10bc10a77b Mon Sep 17 00:00:00 2001 +From: Jiakun Shuai +Date: Mon, 29 Jul 2024 18:29:40 +0800 +Subject: [PATCH] cpu: revert: Modify virCPUarmCompare to perform compare + actions + +There is something wrong with the previous commit: +cpu: Modify virCPUarmCompare to perform compare actions (0acd85e553d3) +Let's revert it and push the correct version later. + +Signed-off-by: Jiakun Shuai +--- + src/cpu/cpu_arm.c | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c +index b2b2d90a40..a0c0befaa0 100644 +--- a/src/cpu/cpu_arm.c ++++ b/src/cpu/cpu_arm.c +@@ -979,10 +979,6 @@ virCPUarmCompare(virCPUDefPtr host, + virCPUCompareResult ret = VIR_CPU_COMPARE_ERROR; + g_autofree char *message = NULL; + +- /* Only support host to host CPU compare for ARM */ +- if (cpu->type != VIR_CPU_TYPE_HOST) +- return VIR_CPU_COMPARE_IDENTICAL; +- + if (!host || !host->model) { + if (failMessages) { + virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", +-- +2.41.0.windows.1 + diff --git a/libvirt.spec b/libvirt.spec index b07be50..b4d8d29 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -101,7 +101,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 6.2.0 -Release: 66 +Release: 67 License: LGPLv2+ URL: https://libvirt.org/ @@ -536,6 +536,10 @@ 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 +Patch0427: add-phytium-s5000c-support-on-arm-architecture-for-c.patch +Patch0428: cpu-Modify-virCPUarmCompare-to-perform-compare-actio.patch +Patch0429: cpu-revert-Modify-virCPUarmCompare-to-perform-compar.patch +Patch0430: virt-host-validate-Fix-IOMMU-output-on-aarch64.patch Requires: libvirt-daemon = %{version}-%{release} Requires: libvirt-daemon-config-network = %{version}-%{release} @@ -2272,6 +2276,12 @@ exit 0 %changelog +* Thu Aug 22 2024 Jiabo Feng - 6.2.0-67 +- virt-host-validate: Fix IOMMU output on aarch64 +- cpu: revert: Modify virCPUarmCompare to perform compare actions +- cpu: Modify virCPUarmCompare to perform compare actions +- add phytium s5000c support on arm architecture for capability + * Thu July 1 2024 ikarosYuuki - 6.2.0-66 - qemu: enable overcommit_memory while start cvm diff --git a/virt-host-validate-Fix-IOMMU-output-on-aarch64.patch b/virt-host-validate-Fix-IOMMU-output-on-aarch64.patch new file mode 100644 index 0000000..f37d651 --- /dev/null +++ b/virt-host-validate-Fix-IOMMU-output-on-aarch64.patch @@ -0,0 +1,102 @@ +From b8f4d98289a0746675edb036978bd02ab5f59c21 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= +Date: Tue, 8 Jun 2021 22:16:42 +0200 +Subject: [PATCH] virt-host-validate: Fix IOMMU output on aarch64 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +virt-host-validate should print "Checking for device assignment IOMMU +support" for all architectures, not only for Intel / AMD. + +This is the output without the patch: +``` +[fidencio@dentola libvirt]$ virt-host-validate + QEMU: comprobando if device /dev/kvm exists : PASA + QEMU: comprobando if device /dev/kvm is accessible : PASA + QEMU: comprobando if device /dev/vhost-net exists : PASA + QEMU: comprobando if device /dev/net/tun exists : PASA + QEMU: comprobando for cgroup 'cpu' controller support : PASA + QEMU: comprobando for cgroup 'cpuacct' controller support : PASA + QEMU: comprobando for cgroup 'cpuset' controller support : PASA + QEMU: comprobando for cgroup 'memory' controller support : PASA + QEMU: comprobando for cgroup 'devices' controller support : ADVERTENCIA (Enable 'devices' in kernel Kconfig file or mount/enable cgroup controller in your system) + QEMU: comprobando for cgroup 'blkio' controller support : PASA +ADVERTENCIA (Unknown if this platform has IOMMU support) + QEMU: comprobando for secure guest support : ADVERTENCIA (Unknown if this platform has Secure Guest support) + +``` + +This is the output with the patch: +``` +[fidencio@dentola libvirt]$ ./build/tools/virt-host-validate + QEMU: Checking if device /dev/kvm exists : PASS + QEMU: Checking if device /dev/kvm is accessible : PASS + QEMU: Checking if device /dev/vhost-net exists : PASS + QEMU: Checking if device /dev/net/tun exists : PASS + QEMU: Checking for cgroup 'cpu' controller support : PASS + QEMU: Checking for cgroup 'cpuacct' controller support : PASS + QEMU: Checking for cgroup 'cpuset' controller support : PASS + QEMU: Checking for cgroup 'memory' controller support : PASS + QEMU: Checking for cgroup 'devices' controller support : WARN (Enable 'devices' in kernel Kconfig file or mount/enable cgroup controller in your system) + QEMU: Checking for cgroup 'blkio' controller support : PASS + QEMU: Checking for device assignment IOMMU support : WARN (Unknown if this platform has IOMMU support) + QEMU: Checking for secure guest support : WARN (Unknown if this platform has Secure Guest support) +``` + +Signed-off-by: Fabiano FidĂȘncio +Signed-off-by: Michal Privoznik +Reviewed-by: Michal Privoznik +--- + tools/virt-host-validate-common.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/tools/virt-host-validate-common.c b/tools/virt-host-validate-common.c +index fbefbada96..a78903fb38 100644 +--- a/tools/virt-host-validate-common.c ++++ b/tools/virt-host-validate-common.c +@@ -339,6 +339,8 @@ int virHostValidateIOMMU(const char *hvname, + DIR *dir; + int rc; + ++ virHostMsgCheck(hvname, "%s", _("for device assignment IOMMU support")); ++ + flags = virHostValidateGetCPUFlags(); + + if (flags && virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_VMX)) +@@ -349,7 +351,6 @@ int virHostValidateIOMMU(const char *hvname, + virBitmapFree(flags); + + if (isIntel) { +- virHostMsgCheck(hvname, "%s", _("for device assignment IOMMU support")); + if (access("/sys/firmware/acpi/tables/DMAR", F_OK) == 0) { + virHostMsgPass(); + bootarg = "intel_iommu=on"; +@@ -361,7 +362,6 @@ int virHostValidateIOMMU(const char *hvname, + return -1; + } + } else if (isAMD) { +- virHostMsgCheck(hvname, "%s", _("for device assignment IOMMU support")); + if (access("/sys/firmware/acpi/tables/IVRS", F_OK) == 0) { + virHostMsgPass(); + bootarg = "iommu=pt iommu=1"; +@@ -373,7 +373,7 @@ int virHostValidateIOMMU(const char *hvname, + return -1; + } + } else if (ARCH_IS_PPC64(arch)) { +- /* Empty Block */ ++ virHostMsgPass(); + } else if (ARCH_IS_S390(arch)) { + /* On s390x, we skip the IOMMU check if there are no PCI + * devices (which is quite usual on s390x). If there are +@@ -385,6 +385,7 @@ int virHostValidateIOMMU(const char *hvname, + VIR_DIR_CLOSE(dir); + if (rc <= 0) + return 0; ++ virHostMsgPass(); + } else { + virHostMsgFail(level, + "Unknown if this platform has IOMMU support"); +-- +2.41.0.windows.1 + -- Gitee