|
|
c480ed |
From e4f000025ac57ed4c731ffb0939f2e02bb84d856 Mon Sep 17 00:00:00 2001
|
|
|
c480ed |
Message-Id: <e4f000025ac57ed4c731ffb0939f2e02bb84d856@dist-git>
|
|
|
c480ed |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
|
c480ed |
Date: Fri, 21 Jun 2019 09:26:11 +0200
|
|
|
c480ed |
Subject: [PATCH] qemu: Forbid MSR features with old QEMU
|
|
|
c480ed |
MIME-Version: 1.0
|
|
|
c480ed |
Content-Type: text/plain; charset=UTF-8
|
|
|
c480ed |
Content-Transfer-Encoding: 8bit
|
|
|
c480ed |
|
|
|
c480ed |
Without "unavailable-features" CPU property we cannot properly detect
|
|
|
c480ed |
whether a specific MSR feature we asked for (either explicitly or
|
|
|
c480ed |
implicitly via a CPU model) was disabled by QEMU for some reason.
|
|
|
c480ed |
Because this could break migration, snapshots, and save/restore
|
|
|
c480ed |
operaions, it's better to just forbid any use of MSR features with QEMU
|
|
|
c480ed |
which lacks "unavailable-features" CPU property.
|
|
|
c480ed |
|
|
|
c480ed |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
c480ed |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
c480ed |
(cherry picked from commit 8eb4a89f5f7973f50aa8b6fa0b1a45b825dda208)
|
|
|
c480ed |
|
|
|
c480ed |
https://bugzilla.redhat.com/show_bug.cgi?id=1697627
|
|
|
c480ed |
|
|
|
c480ed |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
c480ed |
Message-Id: <b077794613a01d8ebd69b27afef1ad2452a4810d.1561068591.git.jdenemar@redhat.com>
|
|
|
c480ed |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
c480ed |
---
|
|
|
c480ed |
src/qemu/qemu_process.c | 30 +++++++++++++++++++++++++++---
|
|
|
c480ed |
1 file changed, 27 insertions(+), 3 deletions(-)
|
|
|
c480ed |
|
|
|
c480ed |
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
|
|
|
c480ed |
index d147e524ee..db14d322f5 100644
|
|
|
c480ed |
--- a/src/qemu/qemu_process.c
|
|
|
c480ed |
+++ b/src/qemu/qemu_process.c
|
|
|
c480ed |
@@ -53,6 +53,7 @@
|
|
|
c480ed |
#include "qemu_extdevice.h"
|
|
|
c480ed |
|
|
|
c480ed |
#include "cpu/cpu.h"
|
|
|
c480ed |
+#include "cpu/cpu_x86.h"
|
|
|
c480ed |
#include "datatypes.h"
|
|
|
c480ed |
#include "virlog.h"
|
|
|
c480ed |
#include "virerror.h"
|
|
|
c480ed |
@@ -5226,9 +5227,32 @@ qemuProcessStartValidate(virQEMUDriverPtr driver,
|
|
|
c480ed |
if (qemuProcessStartValidateShmem(vm) < 0)
|
|
|
c480ed |
return -1;
|
|
|
c480ed |
|
|
|
c480ed |
- if (vm->def->cpu &&
|
|
|
c480ed |
- virCPUValidateFeatures(vm->def->os.arch, vm->def->cpu) < 0)
|
|
|
c480ed |
- return -1;
|
|
|
c480ed |
+ if (vm->def->cpu) {
|
|
|
c480ed |
+ if (virCPUValidateFeatures(vm->def->os.arch, vm->def->cpu) < 0)
|
|
|
c480ed |
+ return -1;
|
|
|
c480ed |
+
|
|
|
c480ed |
+ if (ARCH_IS_X86(vm->def->os.arch) &&
|
|
|
c480ed |
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_CPU_UNAVAILABLE_FEATURES)) {
|
|
|
c480ed |
+ VIR_AUTOSTRINGLIST features = NULL;
|
|
|
c480ed |
+ int n;
|
|
|
c480ed |
+
|
|
|
c480ed |
+ if ((n = virCPUDefCheckFeatures(vm->def->cpu,
|
|
|
c480ed |
+ virCPUx86FeatureFilterSelectMSR,
|
|
|
c480ed |
+ NULL,
|
|
|
c480ed |
+ &features)) < 0)
|
|
|
c480ed |
+ return -1;
|
|
|
c480ed |
+
|
|
|
c480ed |
+ if (n > 0) {
|
|
|
c480ed |
+ VIR_AUTOFREE(char *) str = NULL;
|
|
|
c480ed |
+
|
|
|
c480ed |
+ str = virStringListJoin((const char **)features, ", ");
|
|
|
c480ed |
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
|
c480ed |
+ _("Some features cannot be reliably used "
|
|
|
c480ed |
+ "with this QEMU: %s"), str);
|
|
|
c480ed |
+ return -1;
|
|
|
c480ed |
+ }
|
|
|
c480ed |
+ }
|
|
|
c480ed |
+ }
|
|
|
c480ed |
|
|
|
c480ed |
if (qemuProcessStartValidateDisks(vm, qemuCaps) < 0)
|
|
|
c480ed |
return -1;
|
|
|
c480ed |
--
|
|
|
c480ed |
2.22.0
|
|
|
c480ed |
|