|
|
99cbc7 |
From af7f65d5ce4fe129b0844eb031212a3fb397b8da Mon Sep 17 00:00:00 2001
|
|
|
99cbc7 |
Message-Id: <af7f65d5ce4fe129b0844eb031212a3fb397b8da@dist-git>
|
|
|
99cbc7 |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
|
99cbc7 |
Date: Fri, 27 Mar 2015 12:48:40 +0100
|
|
|
99cbc7 |
Subject: [PATCH] RHEL: Hack around changed Broadwell/Haswell CPUs
|
|
|
99cbc7 |
|
|
|
99cbc7 |
RHEL-only
|
|
|
99cbc7 |
|
|
|
99cbc7 |
Upstream tried to solve the change of Broadwell and Haswell CPUs by
|
|
|
99cbc7 |
removing rtm and hle features from the corresponding CPU models for new
|
|
|
99cbc7 |
machine types. Then they reverted this and introduced new *-noTSX models
|
|
|
99cbc7 |
instead. However, the original fix was backported to RHEL.
|
|
|
99cbc7 |
|
|
|
99cbc7 |
This patch makes sure Broadwell and Haswell will always contain rtm and
|
|
|
99cbc7 |
hle features regardless on RHEL version or machine type used.
|
|
|
99cbc7 |
|
|
|
99cbc7 |
https://bugzilla.redhat.com/show_bug.cgi?id=1199446
|
|
|
99cbc7 |
|
|
|
99cbc7 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
99cbc7 |
---
|
|
|
99cbc7 |
src/qemu/qemu_command.c | 29 +++++++++++++++++++
|
|
|
99cbc7 |
tests/qemuxml2argvdata/cpu-Haswell.args | 2 +-
|
|
|
99cbc7 |
.../qemuxml2argvdata/cpu-host-model-cmt.args | 3 +-
|
|
|
99cbc7 |
tests/qemuxml2argvdata/cpu-tsc-frequency.args | 2 +-
|
|
|
99cbc7 |
tests/qemuxml2argvdata/q35-acpi-nouefi.args | 2 +-
|
|
|
99cbc7 |
tests/qemuxml2argvdata/q35-acpi-uefi.args | 2 +-
|
|
|
99cbc7 |
tests/qemuxml2argvdata/q35-noacpi-nouefi.args | 2 +-
|
|
|
99cbc7 |
7 files changed, 36 insertions(+), 6 deletions(-)
|
|
|
99cbc7 |
|
|
|
99cbc7 |
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
|
|
99cbc7 |
index 4fc3176ad3..c1eefca639 100644
|
|
|
99cbc7 |
--- a/src/qemu/qemu_command.c
|
|
|
99cbc7 |
+++ b/src/qemu/qemu_command.c
|
|
|
99cbc7 |
@@ -6677,6 +6677,8 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
|
|
|
99cbc7 |
size_t i;
|
|
|
99cbc7 |
virCapsPtr caps = NULL;
|
|
|
99cbc7 |
virCPUDefPtr cpu = def->cpu;
|
|
|
99cbc7 |
+ bool hle = false;
|
|
|
99cbc7 |
+ bool rtm = false;
|
|
|
99cbc7 |
|
|
|
99cbc7 |
if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
|
|
|
99cbc7 |
goto cleanup;
|
|
|
99cbc7 |
@@ -6734,6 +6736,11 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
|
|
|
99cbc7 |
virBufferAsprintf(buf, ",vendor=%s", cpu->vendor_id);
|
|
|
99cbc7 |
|
|
|
99cbc7 |
for (i = 0; i < cpu->nfeatures; i++) {
|
|
|
99cbc7 |
+ if (STREQ("rtm", cpu->features[i].name))
|
|
|
99cbc7 |
+ rtm = true;
|
|
|
99cbc7 |
+ if (STREQ("hle", cpu->features[i].name))
|
|
|
99cbc7 |
+ hle = true;
|
|
|
99cbc7 |
+
|
|
|
99cbc7 |
switch ((virCPUFeaturePolicy) cpu->features[i].policy) {
|
|
|
99cbc7 |
case VIR_CPU_FEATURE_FORCE:
|
|
|
99cbc7 |
case VIR_CPU_FEATURE_REQUIRE:
|
|
|
99cbc7 |
@@ -6757,6 +6764,28 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
|
|
|
99cbc7 |
}
|
|
|
99cbc7 |
}
|
|
|
99cbc7 |
|
|
|
99cbc7 |
+ /* Some versions of qemu-kvm in RHEL provide Broadwell and Haswell CPU
|
|
|
99cbc7 |
+ * models which lack rtm and hle features when used with some machine
|
|
|
99cbc7 |
+ * types. Let's make sure Broadwell and Haswell will always have these
|
|
|
99cbc7 |
+ * features. But only if the features were not explicitly mentioned in
|
|
|
99cbc7 |
+ * the guest CPU definition.
|
|
|
99cbc7 |
+ */
|
|
|
99cbc7 |
+ if (STREQ_NULLABLE(cpu->model, "Broadwell") ||
|
|
|
99cbc7 |
+ STREQ_NULLABLE(cpu->model, "Haswell")) {
|
|
|
99cbc7 |
+ if (!rtm) {
|
|
|
99cbc7 |
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION))
|
|
|
99cbc7 |
+ virBufferAddLit(buf, ",rtm=on");
|
|
|
99cbc7 |
+ else
|
|
|
99cbc7 |
+ virBufferAddLit(buf, ",+rtm");
|
|
|
99cbc7 |
+ }
|
|
|
99cbc7 |
+ if (!hle) {
|
|
|
99cbc7 |
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION))
|
|
|
99cbc7 |
+ virBufferAddLit(buf, ",hle=on");
|
|
|
99cbc7 |
+ else
|
|
|
99cbc7 |
+ virBufferAddLit(buf, ",+hle");
|
|
|
99cbc7 |
+ }
|
|
|
99cbc7 |
+ }
|
|
|
99cbc7 |
+
|
|
|
99cbc7 |
ret = 0;
|
|
|
99cbc7 |
cleanup:
|
|
|
99cbc7 |
virObjectUnref(caps);
|
|
|
99cbc7 |
diff --git a/tests/qemuxml2argvdata/cpu-Haswell.args b/tests/qemuxml2argvdata/cpu-Haswell.args
|
|
|
99cbc7 |
index c7ce396d05..6f20359524 100644
|
|
|
99cbc7 |
--- a/tests/qemuxml2argvdata/cpu-Haswell.args
|
|
|
99cbc7 |
+++ b/tests/qemuxml2argvdata/cpu-Haswell.args
|
|
|
99cbc7 |
@@ -8,7 +8,7 @@ QEMU_AUDIO_DRV=none \
|
|
|
99cbc7 |
-name QEMUGuest1 \
|
|
|
99cbc7 |
-S \
|
|
|
99cbc7 |
-machine pc,accel=kvm,usb=off,dump-guest-core=off \
|
|
|
99cbc7 |
--cpu Haswell \
|
|
|
99cbc7 |
+-cpu Haswell,+rtm,+hle \
|
|
|
99cbc7 |
-m 214 \
|
|
|
99cbc7 |
-smp 6,sockets=6,cores=1,threads=1 \
|
|
|
99cbc7 |
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
|
|
|
99cbc7 |
diff --git a/tests/qemuxml2argvdata/cpu-host-model-cmt.args b/tests/qemuxml2argvdata/cpu-host-model-cmt.args
|
|
|
99cbc7 |
index 8767278d11..d236aa9e09 100644
|
|
|
99cbc7 |
--- a/tests/qemuxml2argvdata/cpu-host-model-cmt.args
|
|
|
99cbc7 |
+++ b/tests/qemuxml2argvdata/cpu-host-model-cmt.args
|
|
|
99cbc7 |
@@ -9,7 +9,8 @@ QEMU_AUDIO_DRV=none \
|
|
|
99cbc7 |
-S \
|
|
|
99cbc7 |
-machine pc,accel=tcg,usb=off,dump-guest-core=off \
|
|
|
99cbc7 |
-cpu Haswell,+vme,+ds,+acpi,+ss,+ht,+tm,+pbe,+dtes64,+monitor,+ds_cpl,+vmx,\
|
|
|
99cbc7 |
-+smx,+est,+tm2,+xtpr,+pdcm,+osxsave,+f16c,+rdrand,+pdpe1gb,+abm,+lahf_lm \
|
|
|
99cbc7 |
++smx,+est,+tm2,+xtpr,+pdcm,+osxsave,+f16c,+rdrand,+pdpe1gb,+abm,+lahf_lm,+rtm,\
|
|
|
99cbc7 |
++hle \
|
|
|
99cbc7 |
-m 214 \
|
|
|
99cbc7 |
-smp 6,sockets=6,cores=1,threads=1 \
|
|
|
99cbc7 |
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
|
|
|
99cbc7 |
diff --git a/tests/qemuxml2argvdata/cpu-tsc-frequency.args b/tests/qemuxml2argvdata/cpu-tsc-frequency.args
|
|
|
99cbc7 |
index 7824dea96f..216fd43014 100644
|
|
|
99cbc7 |
--- a/tests/qemuxml2argvdata/cpu-tsc-frequency.args
|
|
|
99cbc7 |
+++ b/tests/qemuxml2argvdata/cpu-tsc-frequency.args
|
|
|
99cbc7 |
@@ -10,7 +10,7 @@ QEMU_AUDIO_DRV=none \
|
|
|
99cbc7 |
-machine pc,accel=kvm,usb=off,dump-guest-core=off \
|
|
|
99cbc7 |
-cpu Haswell,+vme,+ds,+acpi,+ss,+ht,+tm,+pbe,+dtes64,+monitor,+ds_cpl,+vmx,\
|
|
|
99cbc7 |
+smx,+est,+tm2,+xtpr,+pdcm,+osxsave,+f16c,+rdrand,+pdpe1gb,+abm,+lahf_lm,\
|
|
|
99cbc7 |
-+invtsc,tsc-frequency=3504000000 \
|
|
|
99cbc7 |
++invtsc,+rtm,+hle,tsc-frequency=3504000000 \
|
|
|
99cbc7 |
-m 214 \
|
|
|
99cbc7 |
-smp 1,sockets=1,cores=1,threads=1 \
|
|
|
99cbc7 |
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
|
|
|
99cbc7 |
diff --git a/tests/qemuxml2argvdata/q35-acpi-nouefi.args b/tests/qemuxml2argvdata/q35-acpi-nouefi.args
|
|
|
99cbc7 |
index caef49ea16..a9375a35db 100644
|
|
|
99cbc7 |
--- a/tests/qemuxml2argvdata/q35-acpi-nouefi.args
|
|
|
99cbc7 |
+++ b/tests/qemuxml2argvdata/q35-acpi-nouefi.args
|
|
|
99cbc7 |
@@ -8,7 +8,7 @@ QEMU_AUDIO_DRV=none \
|
|
|
99cbc7 |
-name guest \
|
|
|
99cbc7 |
-S \
|
|
|
99cbc7 |
-machine q35,accel=tcg,usb=off,dump-guest-core=off \
|
|
|
99cbc7 |
--cpu Haswell \
|
|
|
99cbc7 |
+-cpu Haswell,+rtm,+hle \
|
|
|
99cbc7 |
-m 1024 \
|
|
|
99cbc7 |
-smp 1,sockets=1,cores=1,threads=1 \
|
|
|
99cbc7 |
-uuid 496d7ea8-9739-544b-4ebd-ef08be936e8b \
|
|
|
99cbc7 |
diff --git a/tests/qemuxml2argvdata/q35-acpi-uefi.args b/tests/qemuxml2argvdata/q35-acpi-uefi.args
|
|
|
99cbc7 |
index a3293aeb9d..8e3368b9e9 100644
|
|
|
99cbc7 |
--- a/tests/qemuxml2argvdata/q35-acpi-uefi.args
|
|
|
99cbc7 |
+++ b/tests/qemuxml2argvdata/q35-acpi-uefi.args
|
|
|
99cbc7 |
@@ -8,7 +8,7 @@ QEMU_AUDIO_DRV=none \
|
|
|
99cbc7 |
-name guest \
|
|
|
99cbc7 |
-S \
|
|
|
99cbc7 |
-machine q35,accel=tcg,usb=off,dump-guest-core=off \
|
|
|
99cbc7 |
--cpu Haswell \
|
|
|
99cbc7 |
+-cpu Haswell,+rtm,+hle \
|
|
|
99cbc7 |
-drive file=/usr/share/OVMF/OVMF_CODE.fd,if=pflash,format=raw,unit=0,\
|
|
|
99cbc7 |
readonly=on \
|
|
|
99cbc7 |
-drive file=/var/lib/libvirt/qemu/nvram/guest_VARS.fd,if=pflash,format=raw,\
|
|
|
99cbc7 |
diff --git a/tests/qemuxml2argvdata/q35-noacpi-nouefi.args b/tests/qemuxml2argvdata/q35-noacpi-nouefi.args
|
|
|
99cbc7 |
index fab2a6fcb0..0dd61840ef 100644
|
|
|
99cbc7 |
--- a/tests/qemuxml2argvdata/q35-noacpi-nouefi.args
|
|
|
99cbc7 |
+++ b/tests/qemuxml2argvdata/q35-noacpi-nouefi.args
|
|
|
99cbc7 |
@@ -8,7 +8,7 @@ QEMU_AUDIO_DRV=none \
|
|
|
99cbc7 |
-name guest \
|
|
|
99cbc7 |
-S \
|
|
|
99cbc7 |
-machine q35,accel=tcg,usb=off,dump-guest-core=off \
|
|
|
99cbc7 |
--cpu Haswell \
|
|
|
99cbc7 |
+-cpu Haswell,+rtm,+hle \
|
|
|
99cbc7 |
-m 1024 \
|
|
|
99cbc7 |
-smp 1,sockets=1,cores=1,threads=1 \
|
|
|
99cbc7 |
-uuid 496d7ea8-9739-544b-4ebd-ef08be936e8b \
|
|
|
99cbc7 |
--
|
|
|
99cbc7 |
2.18.0
|
|
|
99cbc7 |
|