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