|
|
d76c62 |
From 0dd015e1aff1a56a4584824d1a97c9eacabf7f03 Mon Sep 17 00:00:00 2001
|
|
|
d76c62 |
Message-Id: <0dd015e1aff1a56a4584824d1a97c9eacabf7f03@dist-git>
|
|
|
d76c62 |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
|
d76c62 |
Date: Fri, 27 Mar 2015 12:48:40 +0100
|
|
|
d76c62 |
Subject: [PATCH] RHEL: Hack around changed Broadwell/Haswell CPUs
|
|
|
d76c62 |
|
|
|
d76c62 |
RHEL-only
|
|
|
d76c62 |
|
|
|
d76c62 |
Upstream tried to solve the change of Broadwell and Haswell CPUs by
|
|
|
d76c62 |
removing rtm and hle features from the corresponding CPU models for new
|
|
|
d76c62 |
machine types. Then they reverted this and introduced new *-noTSX models
|
|
|
d76c62 |
instead. However, the original fix was backported to RHEL.
|
|
|
d76c62 |
|
|
|
d76c62 |
This patch makes sure Broadwell and Haswell will always contain rtm and
|
|
|
d76c62 |
hle features regardless on RHEL version or machine type used.
|
|
|
d76c62 |
|
|
|
d76c62 |
https://bugzilla.redhat.com/show_bug.cgi?id=1199446
|
|
|
d76c62 |
|
|
|
d76c62 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
d76c62 |
---
|
|
|
d76c62 |
src/qemu/qemu_command.c | 21 +++++++++++++++++++
|
|
|
d76c62 |
tests/qemuxml2argvdata/cpu-Haswell.args | 2 +-
|
|
|
d76c62 |
.../qemuxml2argvdata/cpu-host-model-cmt.args | 2 +-
|
|
|
d76c62 |
.../cpu-translation.x86_64-4.0.0.args | 4 ++--
|
|
|
d76c62 |
.../cpu-translation.x86_64-latest.args | 4 ++--
|
|
|
d76c62 |
tests/qemuxml2argvdata/cpu-tsc-frequency.args | 4 ++--
|
|
|
d76c62 |
tests/qemuxml2argvdata/q35-acpi-nouefi.args | 2 +-
|
|
|
d76c62 |
tests/qemuxml2argvdata/q35-acpi-uefi.args | 2 +-
|
|
|
d76c62 |
tests/qemuxml2argvdata/q35-noacpi-nouefi.args | 2 +-
|
|
|
d76c62 |
9 files changed, 32 insertions(+), 11 deletions(-)
|
|
|
d76c62 |
|
|
|
d76c62 |
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
|
|
d76c62 |
index 904d2beab5..e10cc7fc74 100644
|
|
|
d76c62 |
--- a/src/qemu/qemu_command.c
|
|
|
d76c62 |
+++ b/src/qemu/qemu_command.c
|
|
|
d76c62 |
@@ -6469,6 +6469,8 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
|
|
|
d76c62 |
{
|
|
|
d76c62 |
size_t i;
|
|
|
d76c62 |
virCPUDefPtr cpu = def->cpu;
|
|
|
d76c62 |
+ bool hle = false;
|
|
|
d76c62 |
+ bool rtm = false;
|
|
|
d76c62 |
|
|
|
d76c62 |
switch ((virCPUMode) cpu->mode) {
|
|
|
d76c62 |
case VIR_CPU_MODE_HOST_PASSTHROUGH:
|
|
|
d76c62 |
@@ -6524,6 +6526,11 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
|
|
|
d76c62 |
virBufferAsprintf(buf, ",vendor=%s", cpu->vendor_id);
|
|
|
d76c62 |
|
|
|
d76c62 |
for (i = 0; i < cpu->nfeatures; i++) {
|
|
|
d76c62 |
+ if (STREQ("rtm", cpu->features[i].name))
|
|
|
d76c62 |
+ rtm = true;
|
|
|
d76c62 |
+ if (STREQ("hle", cpu->features[i].name))
|
|
|
d76c62 |
+ hle = true;
|
|
|
d76c62 |
+
|
|
|
d76c62 |
switch ((virCPUFeaturePolicy) cpu->features[i].policy) {
|
|
|
d76c62 |
case VIR_CPU_FEATURE_FORCE:
|
|
|
d76c62 |
case VIR_CPU_FEATURE_REQUIRE:
|
|
|
d76c62 |
@@ -6541,6 +6548,20 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
|
|
|
d76c62 |
}
|
|
|
d76c62 |
}
|
|
|
d76c62 |
|
|
|
d76c62 |
+ /* Some versions of qemu-kvm in RHEL provide Broadwell and Haswell CPU
|
|
|
d76c62 |
+ * models which lack rtm and hle features when used with some machine
|
|
|
d76c62 |
+ * types. Let's make sure Broadwell and Haswell will always have these
|
|
|
d76c62 |
+ * features. But only if the features were not explicitly mentioned in
|
|
|
d76c62 |
+ * the guest CPU definition.
|
|
|
d76c62 |
+ */
|
|
|
d76c62 |
+ if (STREQ_NULLABLE(cpu->model, "Broadwell") ||
|
|
|
d76c62 |
+ STREQ_NULLABLE(cpu->model, "Haswell")) {
|
|
|
d76c62 |
+ if (!rtm)
|
|
|
d76c62 |
+ qemuBuildCpuFeature(qemuCaps, buf, "rtm", true);
|
|
|
d76c62 |
+ if (!hle)
|
|
|
d76c62 |
+ qemuBuildCpuFeature(qemuCaps, buf, "hle", true);
|
|
|
d76c62 |
+ }
|
|
|
d76c62 |
+
|
|
|
d76c62 |
return 0;
|
|
|
d76c62 |
}
|
|
|
d76c62 |
|
|
|
d76c62 |
diff --git a/tests/qemuxml2argvdata/cpu-Haswell.args b/tests/qemuxml2argvdata/cpu-Haswell.args
|
|
|
d76c62 |
index a33b16f7ce..d35de5ea58 100644
|
|
|
d76c62 |
--- a/tests/qemuxml2argvdata/cpu-Haswell.args
|
|
|
d76c62 |
+++ b/tests/qemuxml2argvdata/cpu-Haswell.args
|
|
|
d76c62 |
@@ -11,7 +11,7 @@ QEMU_AUDIO_DRV=none \
|
|
|
d76c62 |
-name QEMUGuest1 \
|
|
|
d76c62 |
-S \
|
|
|
d76c62 |
-machine pc,accel=kvm,usb=off,dump-guest-core=off \
|
|
|
d76c62 |
--cpu Haswell \
|
|
|
d76c62 |
+-cpu Haswell,+rtm,+hle \
|
|
|
d76c62 |
-m 214 \
|
|
|
d76c62 |
-realtime mlock=off \
|
|
|
d76c62 |
-smp 6,sockets=6,cores=1,threads=1 \
|
|
|
d76c62 |
diff --git a/tests/qemuxml2argvdata/cpu-host-model-cmt.args b/tests/qemuxml2argvdata/cpu-host-model-cmt.args
|
|
|
d76c62 |
index 42f969fd62..c8795acb3e 100644
|
|
|
d76c62 |
--- a/tests/qemuxml2argvdata/cpu-host-model-cmt.args
|
|
|
d76c62 |
+++ b/tests/qemuxml2argvdata/cpu-host-model-cmt.args
|
|
|
d76c62 |
@@ -12,7 +12,7 @@ QEMU_AUDIO_DRV=none \
|
|
|
d76c62 |
-S \
|
|
|
d76c62 |
-machine pc,accel=tcg,usb=off,dump-guest-core=off \
|
|
|
d76c62 |
-cpu Haswell,+vme,+ds,+acpi,+ss,+ht,+tm,+pbe,+dtes64,+monitor,+ds_cpl,+vmx,\
|
|
|
d76c62 |
-+smx,+est,+tm2,+xtpr,+pdcm,+f16c,+rdrand,+pdpe1gb,+abm,+lahf_lm \
|
|
|
d76c62 |
++smx,+est,+tm2,+xtpr,+pdcm,+f16c,+rdrand,+pdpe1gb,+abm,+lahf_lm,+rtm,+hle \
|
|
|
d76c62 |
-m 214 \
|
|
|
d76c62 |
-realtime mlock=off \
|
|
|
d76c62 |
-smp 6,sockets=6,cores=1,threads=1 \
|
|
|
d76c62 |
diff --git a/tests/qemuxml2argvdata/cpu-translation.x86_64-4.0.0.args b/tests/qemuxml2argvdata/cpu-translation.x86_64-4.0.0.args
|
|
|
d76c62 |
index f8e19fca24..08c672fd2c 100644
|
|
|
d76c62 |
--- a/tests/qemuxml2argvdata/cpu-translation.x86_64-4.0.0.args
|
|
|
d76c62 |
+++ b/tests/qemuxml2argvdata/cpu-translation.x86_64-4.0.0.args
|
|
|
d76c62 |
@@ -14,8 +14,8 @@ QEMU_AUDIO_DRV=none \
|
|
|
d76c62 |
file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
|
|
|
d76c62 |
-machine pc-i440fx-4.0,accel=tcg,usb=off,dump-guest-core=off \
|
|
|
d76c62 |
-cpu Haswell,pclmuldq=on,ds_cpl=on,tsc_adjust=on,fxsr_opt=on,lahf_lm=on,\
|
|
|
d76c62 |
-cmp_legacy=on,nodeid_msr=on,perfctr_core=on,perfctr_nb=on,kvm_pv_eoi=on,\
|
|
|
d76c62 |
-kvm_pv_unhalt=on \
|
|
|
d76c62 |
+cmp_legacy=on,nodeid_msr=on,perfctr_core=on,perfctr_nb=on,rtm=on,hle=on,\
|
|
|
d76c62 |
+kvm_pv_eoi=on,kvm_pv_unhalt=on \
|
|
|
d76c62 |
-m 214 \
|
|
|
d76c62 |
-overcommit mem-lock=off \
|
|
|
d76c62 |
-smp 1,sockets=1,cores=1,threads=1 \
|
|
|
d76c62 |
diff --git a/tests/qemuxml2argvdata/cpu-translation.x86_64-latest.args b/tests/qemuxml2argvdata/cpu-translation.x86_64-latest.args
|
|
|
d76c62 |
index 9322b826f4..1dbfc9553b 100644
|
|
|
d76c62 |
--- a/tests/qemuxml2argvdata/cpu-translation.x86_64-latest.args
|
|
|
d76c62 |
+++ b/tests/qemuxml2argvdata/cpu-translation.x86_64-latest.args
|
|
|
d76c62 |
@@ -14,8 +14,8 @@ QEMU_AUDIO_DRV=none \
|
|
|
d76c62 |
file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
|
|
|
d76c62 |
-machine pc,accel=tcg,usb=off,dump-guest-core=off \
|
|
|
d76c62 |
-cpu Haswell,pclmulqdq=on,ds-cpl=on,tsc-adjust=on,fxsr-opt=on,lahf-lm=on,\
|
|
|
d76c62 |
-cmp-legacy=on,nodeid-msr=on,perfctr-core=on,perfctr-nb=on,kvm-pv-eoi=on,\
|
|
|
d76c62 |
-kvm-pv-unhalt=on \
|
|
|
d76c62 |
+cmp-legacy=on,nodeid-msr=on,perfctr-core=on,perfctr-nb=on,rtm=on,hle=on,\
|
|
|
d76c62 |
+kvm-pv-eoi=on,kvm-pv-unhalt=on \
|
|
|
d76c62 |
-m 214 \
|
|
|
d76c62 |
-overcommit mem-lock=off \
|
|
|
d76c62 |
-smp 1,sockets=1,cores=1,threads=1 \
|
|
|
d76c62 |
diff --git a/tests/qemuxml2argvdata/cpu-tsc-frequency.args b/tests/qemuxml2argvdata/cpu-tsc-frequency.args
|
|
|
d76c62 |
index 55b72b4404..45a777d468 100644
|
|
|
d76c62 |
--- a/tests/qemuxml2argvdata/cpu-tsc-frequency.args
|
|
|
d76c62 |
+++ b/tests/qemuxml2argvdata/cpu-tsc-frequency.args
|
|
|
d76c62 |
@@ -12,8 +12,8 @@ QEMU_AUDIO_DRV=none \
|
|
|
d76c62 |
-S \
|
|
|
d76c62 |
-machine pc,accel=kvm,usb=off,dump-guest-core=off \
|
|
|
d76c62 |
-cpu Haswell,+vme,+ds,+acpi,+ss,+ht,+tm,+pbe,+dtes64,+monitor,+ds_cpl,+vmx,\
|
|
|
d76c62 |
-+smx,+est,+tm2,+xtpr,+pdcm,+f16c,+rdrand,+pdpe1gb,+abm,+lahf_lm,+invtsc,\
|
|
|
d76c62 |
-tsc-frequency=3504000000 \
|
|
|
d76c62 |
++smx,+est,+tm2,+xtpr,+pdcm,+f16c,+rdrand,+pdpe1gb,+abm,+lahf_lm,+invtsc,+rtm,\
|
|
|
d76c62 |
++hle,tsc-frequency=3504000000 \
|
|
|
d76c62 |
-m 214 \
|
|
|
d76c62 |
-realtime mlock=off \
|
|
|
d76c62 |
-smp 1,sockets=1,cores=1,threads=1 \
|
|
|
d76c62 |
diff --git a/tests/qemuxml2argvdata/q35-acpi-nouefi.args b/tests/qemuxml2argvdata/q35-acpi-nouefi.args
|
|
|
d76c62 |
index 09e06c96ea..aed56fb1fc 100644
|
|
|
d76c62 |
--- a/tests/qemuxml2argvdata/q35-acpi-nouefi.args
|
|
|
d76c62 |
+++ b/tests/qemuxml2argvdata/q35-acpi-nouefi.args
|
|
|
d76c62 |
@@ -11,7 +11,7 @@ QEMU_AUDIO_DRV=none \
|
|
|
d76c62 |
-name guest \
|
|
|
d76c62 |
-S \
|
|
|
d76c62 |
-machine q35,accel=tcg,usb=off,dump-guest-core=off \
|
|
|
d76c62 |
--cpu Haswell \
|
|
|
d76c62 |
+-cpu Haswell,+rtm,+hle \
|
|
|
d76c62 |
-m 1024 \
|
|
|
d76c62 |
-realtime mlock=off \
|
|
|
d76c62 |
-smp 1,sockets=1,cores=1,threads=1 \
|
|
|
d76c62 |
diff --git a/tests/qemuxml2argvdata/q35-acpi-uefi.args b/tests/qemuxml2argvdata/q35-acpi-uefi.args
|
|
|
d76c62 |
index d00fe5bc1d..1f4bfe7f87 100644
|
|
|
d76c62 |
--- a/tests/qemuxml2argvdata/q35-acpi-uefi.args
|
|
|
d76c62 |
+++ b/tests/qemuxml2argvdata/q35-acpi-uefi.args
|
|
|
d76c62 |
@@ -11,7 +11,7 @@ QEMU_AUDIO_DRV=none \
|
|
|
d76c62 |
-name guest \
|
|
|
d76c62 |
-S \
|
|
|
d76c62 |
-machine q35,accel=tcg,usb=off,dump-guest-core=off \
|
|
|
d76c62 |
--cpu Haswell \
|
|
|
d76c62 |
+-cpu Haswell,+rtm,+hle \
|
|
|
d76c62 |
-drive file=/usr/share/OVMF/OVMF_CODE.fd,if=pflash,format=raw,unit=0,\
|
|
|
d76c62 |
readonly=on \
|
|
|
d76c62 |
-drive file=/var/lib/libvirt/qemu/nvram/guest_VARS.fd,if=pflash,format=raw,\
|
|
|
d76c62 |
diff --git a/tests/qemuxml2argvdata/q35-noacpi-nouefi.args b/tests/qemuxml2argvdata/q35-noacpi-nouefi.args
|
|
|
d76c62 |
index de34dff1cf..ccea7f91f9 100644
|
|
|
d76c62 |
--- a/tests/qemuxml2argvdata/q35-noacpi-nouefi.args
|
|
|
d76c62 |
+++ b/tests/qemuxml2argvdata/q35-noacpi-nouefi.args
|
|
|
d76c62 |
@@ -11,7 +11,7 @@ QEMU_AUDIO_DRV=none \
|
|
|
d76c62 |
-name guest \
|
|
|
d76c62 |
-S \
|
|
|
d76c62 |
-machine q35,accel=tcg,usb=off,dump-guest-core=off \
|
|
|
d76c62 |
--cpu Haswell \
|
|
|
d76c62 |
+-cpu Haswell,+rtm,+hle \
|
|
|
d76c62 |
-m 1024 \
|
|
|
d76c62 |
-realtime mlock=off \
|
|
|
d76c62 |
-smp 1,sockets=1,cores=1,threads=1 \
|
|
|
d76c62 |
--
|
|
|
d76c62 |
2.25.0
|
|
|
d76c62 |
|