From 3ff107d00519e66ee350f34fcad7739df32411a5 Mon Sep 17 00:00:00 2001 Message-Id: <3ff107d00519e66ee350f34fcad7739df32411a5@dist-git> From: Jiri Denemark Date: Thu, 23 Apr 2020 20:59:53 +0200 Subject: [PATCH] =?UTF-8?q?RHEL:=20Fix=20migration=20on=20AMD=C2=A0hosts?= =?UTF-8?q?=20with=20old=20QEMU?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix for a RHEL-only hack for qemu-kvm-1.5.3-* Downstream commit 6244ce5a6f started adding virt-ssbd feature to all host-model CPUs before starting a domain to make sure it is enabled if possible (qemu-kvm-1.5.3-* is too old for probing whether virt-ssbd may be enabled, we just have to try). However, we add this feature to the CPU definition before the definition is copied to priv->origCPU and the definition stored there is used with QEMU older than 2.10 to start the domain after it's been saved or during migration. And because the CPU definition contains virt-ssbd which is not provided by the host CPU, starting or migrating fails with the CPU is incompatible with host CPU: Host CPU does not provide required features: virt-ssbd We need to copy the original CPU definition to priv->origCPU before adding virt-ssbd there (normally priv->origCPU is set in qemuProcessUpdateLiveGuestCPU when QEMU is already running). https://bugzilla.redhat.com/show_bug.cgi?id=1815572 Signed-off-by: Jiri Denemark Message-Id: Reviewed-by: Ján Tomko --- src/qemu/qemu_process.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 7a7fc8f205..ea55ccf7ec 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -5776,10 +5776,11 @@ qemuProcessSetupHotpluggableVcpus(virQEMUDriverPtr driver, static int qemuProcessUpdateGuestCPU(virDomainDefPtr def, - virQEMUCapsPtr qemuCaps, + qemuDomainObjPrivatePtr priv, virCapsPtr caps, unsigned int flags) { + virQEMUCapsPtr qemuCaps = priv->qemuCaps; int ret = -1; bool host_model = false; @@ -5846,8 +5847,12 @@ qemuProcessUpdateGuestCPU(virDomainDefPtr def, virCPUDefPtr hostCPU; hostCPU = virQEMUCapsGetHostModel(qemuCaps, def->virtType, VIR_QEMU_CAPS_HOST_CPU_REPORTED); - if (hostCPU->fallback == VIR_CPU_FALLBACK_ALLOW) + if (hostCPU->fallback == VIR_CPU_FALLBACK_ALLOW) { + if (!priv->origCPU && !(priv->origCPU = virCPUDefCopy(def->cpu))) + goto cleanup; + virCPUDefUpdateFeature(def->cpu, "virt-ssbd", VIR_CPU_FEATURE_REQUIRE); + } } def->cpu->fallback = VIR_CPU_FALLBACK_FORBID; @@ -6069,7 +6074,7 @@ qemuProcessPrepareDomain(virQEMUDriverPtr driver, priv->runningReason = VIR_DOMAIN_RUNNING_UNKNOWN; VIR_DEBUG("Updating guest CPU definition"); - if (qemuProcessUpdateGuestCPU(vm->def, priv->qemuCaps, caps, flags) < 0) + if (qemuProcessUpdateGuestCPU(vm->def, priv, caps, flags) < 0) goto cleanup; for (i = 0; i < vm->def->nshmems; i++) { -- 2.26.0