diff --git a/libvirt-conf-Adjust-hyperv-tlbflush-formatting.patch b/libvirt-conf-Adjust-hyperv-tlbflush-formatting.patch new file mode 100644 index 0000000..e2fc32d --- /dev/null +++ b/libvirt-conf-Adjust-hyperv-tlbflush-formatting.patch @@ -0,0 +1,72 @@ +From e34ac564b018b166a7d6f955f2abe80a9e62f07e Mon Sep 17 00:00:00 2001 +Message-ID: +From: Martin Kletzander +Date: Mon, 6 Jan 2025 16:11:01 +0100 +Subject: [PATCH] conf: Adjust hyperv tlbflush formatting +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Commit 247357cc292a added support for direct and extended modes for +tlbflush, but forgot to do the formatting as well. + +Signed-off-by: Martin Kletzander +Signed-off-by: Ján Tomko +Reviewed-by: Martin Kletzander +(cherry picked from commit 9df14f51735eeb4221a25ccd408a2dccf0a35b59) + +https://issues.redhat.com/browse/RHEL-7122 + +Signed-off-by: Martin Kletzander +--- + src/conf/domain_conf.c | 11 ++++++++++- + tests/qemuxmlconfdata/hyperv.x86_64-latest.xml | 5 ++++- + 2 files changed, 14 insertions(+), 2 deletions(-) + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index c8254d2146..1f0b67ca28 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -27974,7 +27974,6 @@ virDomainDefFormatFeatures(virBuffer *buf, + case VIR_DOMAIN_HYPERV_RESET: + case VIR_DOMAIN_HYPERV_FREQUENCIES: + case VIR_DOMAIN_HYPERV_REENLIGHTENMENT: +- case VIR_DOMAIN_HYPERV_TLBFLUSH: + case VIR_DOMAIN_HYPERV_IPI: + case VIR_DOMAIN_HYPERV_EVMCS: + case VIR_DOMAIN_HYPERV_AVIC: +@@ -28004,6 +28003,16 @@ virDomainDefFormatFeatures(virBuffer *buf, + } + break; + ++ case VIR_DOMAIN_HYPERV_TLBFLUSH: ++ if (def->hyperv_features[j] != VIR_TRISTATE_SWITCH_ON) ++ break; ++ ++ if (def->hyperv_tlbflush_direct == VIR_TRISTATE_SWITCH_ON) ++ virBufferAddLit(&hypervChildBuf, "\n"); ++ if (def->hyperv_tlbflush_extended == VIR_TRISTATE_SWITCH_ON) ++ virBufferAddLit(&hypervChildBuf, "\n"); ++ break; ++ + case VIR_DOMAIN_HYPERV_LAST: + break; + } +diff --git a/tests/qemuxmlconfdata/hyperv.x86_64-latest.xml b/tests/qemuxmlconfdata/hyperv.x86_64-latest.xml +index 36d9161fa8..49537188af 100644 +--- a/tests/qemuxmlconfdata/hyperv.x86_64-latest.xml ++++ b/tests/qemuxmlconfdata/hyperv.x86_64-latest.xml +@@ -22,7 +22,10 @@ + + + +- ++ ++ ++ ++ + + + +-- +2.47.1 diff --git a/libvirt-conf-docs-Add-support-for-direct-and-extended-tlbflush-features.patch b/libvirt-conf-docs-Add-support-for-direct-and-extended-tlbflush-features.patch new file mode 100644 index 0000000..8f2f184 --- /dev/null +++ b/libvirt-conf-docs-Add-support-for-direct-and-extended-tlbflush-features.patch @@ -0,0 +1,213 @@ +From 2acec098dbc64f20d36f2b7592c2867885196141 Mon Sep 17 00:00:00 2001 +Message-ID: <2acec098dbc64f20d36f2b7592c2867885196141.1737030652.git.jdenemar@redhat.com> +From: Martin Kletzander +Date: Fri, 20 Dec 2024 12:27:22 +0100 +Subject: [PATCH] conf, docs: Add support for direct and extended tlbflush + features + +Similarly to stimer-direct these are subelements of in the +domain XML. + +Signed-off-by: Martin Kletzander +Reviewed-by: Michal Privoznik +(cherry picked from commit ac08b362da724f1dd7aa6f05c0a9e7a960a7f024) + +https://issues.redhat.com/browse/RHEL-7122 + +Signed-off-by: Martin Kletzander +--- + docs/formatdomain.rst | 13 ++++++++----- + src/conf/domain_conf.c | 26 +++++++++++++++++++++++++- + src/conf/domain_conf.h | 2 ++ + src/conf/schemas/domaincommon.rng | 21 ++++++++++++++++++++- + src/cpu/cpu_x86.c | 7 +++++++ + src/cpu/cpu_x86_data.h | 2 ++ + 6 files changed, 64 insertions(+), 7 deletions(-) + +diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst +index 60bee8bd4f..8d787ef59a 100644 +--- a/docs/formatdomain.rst ++++ b/docs/formatdomain.rst +@@ -1993,7 +1993,10 @@ Hypervisors may allow certain CPU / machine features to be toggled on/off. + + + +- ++ ++ ++ ++ + + + +@@ -2068,9 +2071,9 @@ are: + Enable various features improving behavior of guests running Microsoft + Windows. + +- =============== ====================================================================== ============================================ ======================================================= ++ =============== ====================================================================== ============================================ ======================================================================== + Feature Description Value Since +- =============== ====================================================================== ============================================ ======================================================= ++ =============== ====================================================================== ============================================ ======================================================================== + relaxed Relax constraints on timers on, off :since:`1.0.0 (QEMU 2.0)` + vapic Enable virtual APIC on, off :since:`1.1.0 (QEMU 2.0)` + spinlocks Enable spinlock support on, off; retries - at least 4095 :since:`1.1.0 (QEMU 2.0)` +@@ -2082,13 +2085,13 @@ are: + vendor_id Set hypervisor vendor id on, off; value - string, up to 12 characters :since:`1.3.3 (QEMU 2.5)` + frequencies Expose frequency MSRs on, off :since:`4.7.0 (QEMU 2.12)` + reenlightenment Enable re-enlightenment notification on migration on, off :since:`4.7.0 (QEMU 3.0)` +- tlbflush Enable PV TLB flush support on, off :since:`4.7.0 (QEMU 3.0)` ++ tlbflush Enable PV TLB flush support on, off; direct - on,off; extended - on,off :since:`4.7.0 (QEMU 3.0), direct and extended modes 11.0.0 (QEMU 7.1.0)` + ipi Enable PV IPI support on, off :since:`4.10.0 (QEMU 3.1)` + evmcs Enable Enlightened VMCS on, off :since:`4.10.0 (QEMU 3.1)` + avic Enable use Hyper-V SynIC with hardware APICv/AVIC on, off :since:`8.10.0 (QEMU 6.2)` + emsr_bitmap Avoid unnecessary updates to L2 MSR Bitmap upon vmexits. on, off :since:`10.7.0 (QEMU 7.1)` + xmm_input Enable XMM Fast Hypercall Input on, off :since:`10.7.0 (QEMU 7.1)` +- =============== ====================================================================== ============================================ ======================================================= ++ =============== ====================================================================== ============================================ ======================================================================== + + :since:`Since 8.0.0`, the hypervisor can be configured further by setting + the ``mode`` attribute to one of the following values: +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 4ad8289b89..c2164f6377 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -16672,7 +16672,6 @@ virDomainFeaturesHyperVDefParse(virDomainDef *def, + case VIR_DOMAIN_HYPERV_RESET: + case VIR_DOMAIN_HYPERV_FREQUENCIES: + case VIR_DOMAIN_HYPERV_REENLIGHTENMENT: +- case VIR_DOMAIN_HYPERV_TLBFLUSH: + case VIR_DOMAIN_HYPERV_IPI: + case VIR_DOMAIN_HYPERV_EVMCS: + case VIR_DOMAIN_HYPERV_AVIC: +@@ -16680,6 +16679,31 @@ virDomainFeaturesHyperVDefParse(virDomainDef *def, + case VIR_DOMAIN_HYPERV_XMM_INPUT: + break; + ++ case VIR_DOMAIN_HYPERV_TLBFLUSH: ++ if (value != VIR_TRISTATE_SWITCH_ON) ++ break; ++ ++ child = xmlFirstElementChild(node); ++ while (child) { ++ if (STREQ((const char *)child->name, "direct")) { ++ if (virXMLPropTristateSwitch(child, "state", VIR_XML_PROP_REQUIRED, ++ &def->hyperv_tlbflush_direct) < 0) ++ return -1; ++ } else if (STREQ((const char *)child->name, "extended")) { ++ if (virXMLPropTristateSwitch(child, "state", VIR_XML_PROP_REQUIRED, ++ &def->hyperv_tlbflush_extended) < 0) ++ return -1; ++ } else { ++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, ++ _("unsupported Hyper-V tlbflush feature: %1$s"), ++ child->name); ++ return -1; ++ } ++ ++ child = xmlNextElementSibling(child); ++ } ++ break; ++ + case VIR_DOMAIN_HYPERV_STIMER: + if (value != VIR_TRISTATE_SWITCH_ON) + break; +diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h +index a187ab4083..9f7c28343f 100644 +--- a/src/conf/domain_conf.h ++++ b/src/conf/domain_conf.h +@@ -3101,6 +3101,8 @@ struct _virDomainDef { + virDomainXenPassthroughMode xen_passthrough_mode; + unsigned int hyperv_spinlocks; + virTristateSwitch hyperv_stimer_direct; ++ virTristateSwitch hyperv_tlbflush_direct; ++ virTristateSwitch hyperv_tlbflush_extended; + virGICVersion gic_version; + virDomainHPTResizing hpt_resizing; + unsigned long long hpt_maxpagesize; /* Stored in KiB */ +diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng +index b3fdbf7ffb..7121519ca3 100644 +--- a/src/conf/schemas/domaincommon.rng ++++ b/src/conf/schemas/domaincommon.rng +@@ -8027,7 +8027,7 @@ + + + +- ++ + + + +@@ -8075,6 +8075,25 @@ + + + ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + + + +diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c +index 13695802da..6d72d446c9 100644 +--- a/src/cpu/cpu_x86.c ++++ b/src/cpu/cpu_x86.c +@@ -99,6 +99,8 @@ KVM_FEATURE_DEF(VIR_CPU_x86_HV_REENLIGHTENMENT, + + KVM_FEATURE_DEF(VIR_CPU_x86_HV_STIMER_DIRECT, + 0x40000003, 0x0, 0x00080000); ++KVM_FEATURE_DEF(VIR_CPU_x86_HV_TLBFLUSH_DIRECT, ++ 0x40000003, 0x0, 0x00004000); + + KVM_FEATURE_DEF(VIR_CPU_x86_HV_TLBFLUSH, + 0x40000004, 0x00000004, 0x0); +@@ -109,6 +111,9 @@ KVM_FEATURE_DEF(VIR_CPU_x86_HV_IPI, + KVM_FEATURE_DEF(VIR_CPU_x86_HV_EVMCS, + 0x40000004, 0x00004000, 0x0); + ++KVM_FEATURE_DEF(VIR_CPU_x86_HV_TLBFLUSH_EXT, ++ 0x40000004, 0x0, 0x00004000); ++ + KVM_FEATURE_DEF(VIR_CPU_x86_HV_EMSR_BITMAP, + 0x4000000A, 0x00080000, 0x0); + static virCPUx86Feature x86_kvm_features[] = +@@ -130,6 +135,8 @@ static virCPUx86Feature x86_kvm_features[] = + KVM_FEATURE(VIR_CPU_x86_HV_EVMCS), + KVM_FEATURE(VIR_CPU_x86_HV_STIMER_DIRECT), + KVM_FEATURE(VIR_CPU_x86_HV_EMSR_BITMAP), ++ KVM_FEATURE(VIR_CPU_x86_HV_TLBFLUSH_DIRECT), ++ KVM_FEATURE(VIR_CPU_x86_HV_TLBFLUSH_EXT), + }; + + typedef struct _virCPUx86Signature virCPUx86Signature; +diff --git a/src/cpu/cpu_x86_data.h b/src/cpu/cpu_x86_data.h +index 43ad2faeb1..448acbbeb2 100644 +--- a/src/cpu/cpu_x86_data.h ++++ b/src/cpu/cpu_x86_data.h +@@ -60,6 +60,8 @@ struct _virCPUx86MSR { + #define VIR_CPU_x86_HV_FREQUENCIES "hv-frequencies" + #define VIR_CPU_x86_HV_REENLIGHTENMENT "hv-reenlightenment" + #define VIR_CPU_x86_HV_TLBFLUSH "hv-tlbflush" ++#define VIR_CPU_x86_HV_TLBFLUSH_EXT "hv-tlbflush-ext" ++#define VIR_CPU_x86_HV_TLBFLUSH_DIRECT "hv-tlbflush-direct" + #define VIR_CPU_x86_HV_IPI "hv-ipi" + #define VIR_CPU_x86_HV_EVMCS "hv-evmcs" + #define VIR_CPU_x86_HV_AVIC "hv-avic" +-- +2.47.1 diff --git a/libvirt-conf-refactor-hyperv-features-formatting.patch b/libvirt-conf-refactor-hyperv-features-formatting.patch new file mode 100644 index 0000000..192ec8f --- /dev/null +++ b/libvirt-conf-refactor-hyperv-features-formatting.patch @@ -0,0 +1,112 @@ +From 6f1673eb80487d090c4abc2feaf6a6821fb09580 Mon Sep 17 00:00:00 2001 +Message-ID: <6f1673eb80487d090c4abc2feaf6a6821fb09580.1737030652.git.jdenemar@redhat.com> +From: =?UTF-8?q?J=C3=A1n=20Tomko?= +Date: Mon, 6 Jan 2025 17:20:57 +0100 +Subject: [PATCH] conf: refactor hyperv features formatting +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add a nested buffer for whatever sub-elements a particular +hyperv feature might have. + +Signed-off-by: Ján Tomko +Reviewed-by: Martin Kletzander +(cherry picked from commit ad6b4d1fef275036b31a2bee435144871ebbcfbb) + +https://issues.redhat.com/browse/RHEL-7122 + +Signed-off-by: Martin Kletzander +--- + src/conf/domain_conf.c | 46 +++++++++++++++++------------------------- + 1 file changed, 19 insertions(+), 27 deletions(-) + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index c2164f6377..c8254d2146 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -27954,13 +27954,15 @@ virDomainDefFormatFeatures(virBuffer *buf, + + virBufferAsprintf(&childBuf, "\n", + virDomainHyperVModeTypeToString(def->features[i])); +- virBufferAdjustIndent(&childBuf, 2); ++ + for (j = 0; j < VIR_DOMAIN_HYPERV_LAST; j++) { ++ g_auto(virBuffer) hypervAttrBuf = VIR_BUFFER_INITIALIZER; ++ g_auto(virBuffer) hypervChildBuf = VIR_BUFFER_INIT_CHILD(&tmpChildBuf); ++ + if (def->hyperv_features[j] == VIR_TRISTATE_SWITCH_ABSENT) + continue; + +- virBufferAsprintf(&childBuf, "<%s state='%s'", +- virDomainHypervTypeToString(j), ++ virBufferAsprintf(&hypervAttrBuf, " state='%s'", + virTristateSwitchTypeToString(def->hyperv_features[j])); + + switch ((virDomainHyperv) j) { +@@ -27978,49 +27980,39 @@ virDomainDefFormatFeatures(virBuffer *buf, + case VIR_DOMAIN_HYPERV_AVIC: + case VIR_DOMAIN_HYPERV_EMSR_BITMAP: + case VIR_DOMAIN_HYPERV_XMM_INPUT: +- virBufferAddLit(&childBuf, "/>\n"); + break; + + case VIR_DOMAIN_HYPERV_SPINLOCKS: +- if (def->hyperv_features[j] != VIR_TRISTATE_SWITCH_ON) { +- virBufferAddLit(&childBuf, "/>\n"); +- break; ++ if (def->hyperv_features[j] == VIR_TRISTATE_SWITCH_ON) { ++ virBufferAsprintf(&hypervAttrBuf, ++ " retries='%d'", def->hyperv_spinlocks); + } +- virBufferAsprintf(&childBuf, " retries='%d'/>\n", +- def->hyperv_spinlocks); + break; + + case VIR_DOMAIN_HYPERV_STIMER: +- if (def->hyperv_features[j] != VIR_TRISTATE_SWITCH_ON) { +- virBufferAddLit(&childBuf, "/>\n"); +- break; +- } +- if (def->hyperv_stimer_direct == VIR_TRISTATE_SWITCH_ON) { +- virBufferAddLit(&childBuf, ">\n"); +- virBufferAdjustIndent(&childBuf, 2); +- virBufferAddLit(&childBuf, "\n"); +- virBufferAdjustIndent(&childBuf, -2); +- virBufferAddLit(&childBuf, "\n"); +- } else { +- virBufferAddLit(&childBuf, "/>\n"); ++ if (def->hyperv_features[j] == VIR_TRISTATE_SWITCH_ON && ++ def->hyperv_stimer_direct == VIR_TRISTATE_SWITCH_ON) { ++ virBufferAddLit(&hypervChildBuf, "\n"); + } + + break; + + case VIR_DOMAIN_HYPERV_VENDOR_ID: +- if (def->hyperv_features[j] != VIR_TRISTATE_SWITCH_ON) { +- virBufferAddLit(&childBuf, "/>\n"); +- break; ++ if (def->hyperv_features[j] == VIR_TRISTATE_SWITCH_ON) { ++ virBufferEscapeString(&hypervAttrBuf, " value='%s'", ++ def->hyperv_vendor_id); + } +- virBufferEscapeString(&childBuf, " value='%s'/>\n", +- def->hyperv_vendor_id); + break; + + case VIR_DOMAIN_HYPERV_LAST: + break; + } ++ ++ virXMLFormatElement(&tmpChildBuf, virDomainHypervTypeToString(j), ++ &hypervAttrBuf, &hypervChildBuf); + } +- virBufferAdjustIndent(&childBuf, -2); ++ ++ virBufferAddBuffer(&childBuf, &tmpChildBuf); + virBufferAddLit(&childBuf, "\n"); + break; + +-- +2.47.1 diff --git a/libvirt-qemu-Add-support-for-direct-and-extended-tlbflush-features.patch b/libvirt-qemu-Add-support-for-direct-and-extended-tlbflush-features.patch new file mode 100644 index 0000000..57049f7 --- /dev/null +++ b/libvirt-qemu-Add-support-for-direct-and-extended-tlbflush-features.patch @@ -0,0 +1,108 @@ +From 64ca9249f100a61cf39e800ad67f0dd520aabb5d Mon Sep 17 00:00:00 2001 +Message-ID: <64ca9249f100a61cf39e800ad67f0dd520aabb5d.1737030652.git.jdenemar@redhat.com> +From: Martin Kletzander +Date: Fri, 20 Dec 2024 12:28:24 +0100 +Subject: [PATCH] qemu: Add support for direct and extended tlbflush features + +They require special handling since they are dependent on the basic +tlbflush feature itself and therefore are not handled automatically as +part of virDomainHyperv enum, just like the stimer-direct feature. + +Resolves: https://issues.redhat.com/browse/RHEL-7122 +Signed-off-by: Martin Kletzander +Reviewed-by: Michal Privoznik +(cherry picked from commit 247357cc292a83c8628592562cbb4fa621cdc5b0) + +https://issues.redhat.com/browse/RHEL-7122 + +Signed-off-by: Martin Kletzander +--- + src/qemu/qemu_command.c | 6 +++++ + src/qemu/qemu_process.c | 24 +++++++++++++++++++ + .../qemuxmlconfdata/hyperv.x86_64-latest.args | 2 +- + tests/qemuxmlconfdata/hyperv.xml | 5 +++- + 4 files changed, 35 insertions(+), 2 deletions(-) + +diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c +index dcb9c4934e..1f28de6194 100644 +--- a/src/qemu/qemu_command.c ++++ b/src/qemu/qemu_command.c +@@ -6350,6 +6350,12 @@ qemuBuildCpuCommandLine(virCommand *cmd, + if ((i == VIR_DOMAIN_HYPERV_STIMER) && + (def->hyperv_stimer_direct == VIR_TRISTATE_SWITCH_ON)) + virBufferAsprintf(&buf, ",%s=on", VIR_CPU_x86_HV_STIMER_DIRECT); ++ if (i == VIR_DOMAIN_HYPERV_TLBFLUSH) { ++ if (def->hyperv_tlbflush_direct == VIR_TRISTATE_SWITCH_ON) ++ virBufferAsprintf(&buf, ",%s=on", VIR_CPU_x86_HV_TLBFLUSH_DIRECT); ++ if (def->hyperv_tlbflush_extended == VIR_TRISTATE_SWITCH_ON) ++ virBufferAsprintf(&buf, ",%s=on", VIR_CPU_x86_HV_TLBFLUSH_EXT); ++ } + break; + + case VIR_DOMAIN_HYPERV_SPINLOCKS: +diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c +index bee7a39e4e..7297263d33 100644 +--- a/src/qemu/qemu_process.c ++++ b/src/qemu/qemu_process.c +@@ -4281,6 +4281,30 @@ qemuProcessVerifyHypervFeatures(virDomainDef *def, + "direct"); + return -1; + } ++ if (i == VIR_DOMAIN_HYPERV_TLBFLUSH) { ++ if (def->hyperv_tlbflush_direct == VIR_TRISTATE_SWITCH_ON) { ++ rc = virCPUDataCheckFeature(cpu, VIR_CPU_x86_HV_TLBFLUSH_DIRECT); ++ if (rc < 0) ++ return -1; ++ if (rc == 0) { ++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, ++ _("host doesn't support hyperv tlbflush '%1$s' feature"), ++ "direct"); ++ return -1; ++ } ++ } ++ if (def->hyperv_tlbflush_extended == VIR_TRISTATE_SWITCH_ON) { ++ rc = virCPUDataCheckFeature(cpu, VIR_CPU_x86_HV_TLBFLUSH_EXT); ++ if (rc < 0) ++ return -1; ++ if (rc == 0) { ++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, ++ _("host doesn't support hyperv tlbflush '%1$s' feature"), ++ "extended"); ++ return -1; ++ } ++ } ++ } + continue; + } + +diff --git a/tests/qemuxmlconfdata/hyperv.x86_64-latest.args b/tests/qemuxmlconfdata/hyperv.x86_64-latest.args +index 2aafafb340..5a32b80e71 100644 +--- a/tests/qemuxmlconfdata/hyperv.x86_64-latest.args ++++ b/tests/qemuxmlconfdata/hyperv.x86_64-latest.args +@@ -12,7 +12,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ + -object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \ + -machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram,acpi=on \ + -accel tcg \ +--cpu 'qemu64,hv-relaxed=on,hv-vapic=on,hv-spinlocks=0x2fff,hv-vpindex=on,hv-runtime=on,hv-synic=on,hv-stimer=on,hv-reset=on,hv-vendor-id=KVM Hv,hv-frequencies=on,hv-reenlightenment=on,hv-tlbflush=on,hv-ipi=on,hv-evmcs=on,hv-avic=on,hv-emsr-bitmap=on,hv-xmm-input=on' \ ++-cpu 'qemu64,hv-relaxed=on,hv-vapic=on,hv-spinlocks=0x2fff,hv-vpindex=on,hv-runtime=on,hv-synic=on,hv-stimer=on,hv-reset=on,hv-vendor-id=KVM Hv,hv-frequencies=on,hv-reenlightenment=on,hv-tlbflush=on,hv-tlbflush-direct=on,hv-tlbflush-ext=on,hv-ipi=on,hv-evmcs=on,hv-avic=on,hv-emsr-bitmap=on,hv-xmm-input=on' \ + -m size=219136k \ + -object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \ + -overcommit mem-lock=off \ +diff --git a/tests/qemuxmlconfdata/hyperv.xml b/tests/qemuxmlconfdata/hyperv.xml +index a1e3cbbdf8..8c323f6578 100644 +--- a/tests/qemuxmlconfdata/hyperv.xml ++++ b/tests/qemuxmlconfdata/hyperv.xml +@@ -22,7 +22,10 @@ + + + +- ++ ++ ++ ++ + + + +-- +2.47.1 diff --git a/libvirt-qemu_migration-Do-not-consider-post-copy-active-in-postcopy-recover.patch b/libvirt-qemu_migration-Do-not-consider-post-copy-active-in-postcopy-recover.patch new file mode 100644 index 0000000..78b764f --- /dev/null +++ b/libvirt-qemu_migration-Do-not-consider-post-copy-active-in-postcopy-recover.patch @@ -0,0 +1,57 @@ +From 50925d10476e7a61d25de6e501a4954bb427c327 Mon Sep 17 00:00:00 2001 +Message-ID: <50925d10476e7a61d25de6e501a4954bb427c327.1737030652.git.jdenemar@redhat.com> +From: Jiri Denemark +Date: Fri, 10 Jan 2025 18:25:20 +0100 +Subject: [PATCH] qemu_migration: Do not consider post-copy active in + postcopy-recover + +The postcopy-recover migration state in QEMU means a connection for the +migration stream was established. Depending on the schedulers on both +hosts a relative timing of the corresponding MIGRATION event on the +source host and the destination host may differ. Specifically it's +possible that the source sees postcopy-recover while the destination is +still in postcopy-paused. + +Currently the Perform phase on the source host ends when we get +postcopy-recover event and the Finish phase on the destination host is +called. If this is fast enough we can still see postcopy-paused state +when the Finish phase starts waiting for migration to complete. This is +interpreted as a failure and reported back to the caller. Even though +the recovery may actually start just a few moments later. + +To avoid this race we now don't consider post-copy migration active in +postcopy-recover state and keep waiting for postcopy-active event (in +the success path). Thus the Finish phase is entered only after the +migration switches to postcopy-active. In this state QEMU guarantees the +destination already switched at least to postcopy-recover and we won't +be confused be seeing an old postcopy-failed state. + +https://issues.redhat.com/browse/RHEL-73085 + +Signed-off-by: Jiri Denemark +Reviewed-by: Michal Privoznik +--- + src/qemu/qemu_migration.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c +index 26a92d8ee2..b2b172a26c 100644 +--- a/src/qemu/qemu_migration.c ++++ b/src/qemu/qemu_migration.c +@@ -1872,11 +1872,11 @@ qemuMigrationUpdateJobType(virDomainJobData *jobData) + + switch ((qemuMonitorMigrationStatus) priv->stats.mig.status) { + case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY: +- case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_RECOVER: + jobData->status = VIR_DOMAIN_JOB_STATUS_POSTCOPY; + break; + + case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP: ++ case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_RECOVER: + jobData->status = VIR_DOMAIN_JOB_STATUS_POSTCOPY_RECOVER; + break; + +-- +2.47.1 diff --git a/libvirt.spec b/libvirt.spec index 7b0c7d3..d471d88 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -289,7 +289,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 10.10.0 -Release: 3%{?dist}%{?extra_release} +Release: 4%{?dist}%{?extra_release} License: GPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND OFL-1.1 URL: https://libvirt.org/ @@ -326,6 +326,11 @@ Patch26: libvirt-cpu_map-Add-Opteron_G4-v1-CPU-model.patch Patch27: libvirt-cpu_map-Add-Opteron_G5-v1-CPU-model.patch Patch28: libvirt-cpu_map-Add-EPYC-Genoa-v1-CPU-model.patch Patch29: libvirt-qemu-Enable-I-O-APIC-even-more-frequently.patch +Patch30: libvirt-conf-docs-Add-support-for-direct-and-extended-tlbflush-features.patch +Patch31: libvirt-qemu-Add-support-for-direct-and-extended-tlbflush-features.patch +Patch32: libvirt-conf-refactor-hyperv-features-formatting.patch +Patch33: libvirt-conf-Adjust-hyperv-tlbflush-formatting.patch +Patch34: libvirt-qemu_migration-Do-not-consider-post-copy-active-in-postcopy-recover.patch Requires: libvirt-daemon = %{version}-%{release} @@ -2651,6 +2656,13 @@ exit 0 %endif %changelog +* Thu Jan 16 2025 Jiri Denemark - 10.10.0-4 +- conf, docs: Add support for direct and extended tlbflush features (RHEL-7122) +- qemu: Add support for direct and extended tlbflush features (RHEL-7122) +- conf: refactor hyperv features formatting (RHEL-7122) +- conf: Adjust hyperv tlbflush formatting (RHEL-7122) +- qemu_migration: Do not consider post-copy active in postcopy-recover (RHEL-73085) + * Fri Dec 20 2024 Jiri Denemark - 10.10.0-3 - qemu: Enable I/O APIC even more frequently (RHEL-65844)