render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
b971b8
From 882e0241f82b5bcbe239cf00134950e141de642a Mon Sep 17 00:00:00 2001
b971b8
Message-Id: <882e0241f82b5bcbe239cf00134950e141de642a@dist-git>
b971b8
From: Jiri Denemark <jdenemar@redhat.com>
b971b8
Date: Tue, 26 May 2020 10:58:59 +0200
b971b8
Subject: [PATCH] cpu_x86: Drop noTSX hint for incompatible CPUs
b971b8
MIME-Version: 1.0
b971b8
Content-Type: text/plain; charset=UTF-8
b971b8
Content-Transfer-Encoding: 8bit
b971b8
b971b8
The hint was introduced a long time ago when broken TSX implementation
b971b8
was found in Haswell and Broadwell CPUs. Since then many more CPUs with
b971b8
TSX were introduced and and disabled due to TAA vulnerability.
b971b8
b971b8
Thus the hint is not very useful and I think removing it is a better
b971b8
choice then updating it to cover all current noTSX models.
b971b8
b971b8
This partially reverts:
b971b8
commit 7f127ded657b24e0e55cd5f3539ef5b2dc935908
b971b8
    cpu: Rework cpuCompare* APIs
b971b8
b971b8
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
b971b8
Reviewed-by: Ján Tomko <jtomko@redhat.com>
b971b8
(cherry picked from commit 8452779049ef785b1d2e373b4d42633d4a929a60)
b971b8
b971b8
https://bugzilla.redhat.com/show_bug.cgi?id=1840010
b971b8
b971b8
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
b971b8
Message-Id: <1126fcc8a0e18f0eed38c182013429fd7266c274.1590483392.git.jdenemar@redhat.com>
b971b8
Reviewed-by: Ján Tomko <jtomko@redhat.com>
b971b8
---
b971b8
 src/cpu/cpu_x86.c | 44 ++++++--------------------------------------
b971b8
 1 file changed, 6 insertions(+), 38 deletions(-)
b971b8
b971b8
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
b971b8
index b4d5c795f7..1b388ec1b2 100644
b971b8
--- a/src/cpu/cpu_x86.c
b971b8
+++ b/src/cpu/cpu_x86.c
b971b8
@@ -1937,8 +1937,6 @@ virCPUx86Compare(virCPUDefPtr host,
b971b8
                  bool failIncompatible)
b971b8
 {
b971b8
     virCPUCompareResult ret = VIR_CPU_COMPARE_ERROR;
b971b8
-    virCPUx86MapPtr map;
b971b8
-    virCPUx86ModelPtr model = NULL;
b971b8
     char *message = NULL;
b971b8
 
b971b8
     if (!host || !host->model) {
b971b8
@@ -1954,46 +1952,16 @@ virCPUx86Compare(virCPUDefPtr host,
b971b8
 
b971b8
     ret = x86Compute(host, cpu, NULL, &message);
b971b8
 
b971b8
-    if (ret == VIR_CPU_COMPARE_INCOMPATIBLE) {
b971b8
-        bool noTSX = false;
b971b8
-
b971b8
-        if (STREQ_NULLABLE(cpu->model, "Haswell") ||
b971b8
-            STREQ_NULLABLE(cpu->model, "Broadwell")) {
b971b8
-            if (!(map = virCPUx86GetMap()))
b971b8
-                goto cleanup;
b971b8
-
b971b8
-            if (!(model = x86ModelFromCPU(cpu, map, -1)))
b971b8
-                goto cleanup;
b971b8
-
b971b8
-            noTSX = !x86FeatureInData("hle", &model->data, map) ||
b971b8
-                    !x86FeatureInData("rtm", &model->data, map);
b971b8
-        }
b971b8
-
b971b8
-        if (failIncompatible) {
b971b8
-            ret = VIR_CPU_COMPARE_ERROR;
b971b8
-            if (message) {
b971b8
-                if (noTSX) {
b971b8
-                    virReportError(VIR_ERR_CPU_INCOMPATIBLE,
b971b8
-                                   _("%s; try using '%s-noTSX' CPU model"),
b971b8
-                                   message, cpu->model);
b971b8
-                } else {
b971b8
-                    virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", message);
b971b8
-                }
b971b8
-            } else {
b971b8
-                if (noTSX) {
b971b8
-                    virReportError(VIR_ERR_CPU_INCOMPATIBLE,
b971b8
-                                   _("try using '%s-noTSX' CPU model"),
b971b8
-                                   cpu->model);
b971b8
-                } else {
b971b8
-                    virReportError(VIR_ERR_CPU_INCOMPATIBLE, NULL);
b971b8
-                }
b971b8
-            }
b971b8
-        }
b971b8
+    if (ret == VIR_CPU_COMPARE_INCOMPATIBLE && failIncompatible) {
b971b8
+        ret = VIR_CPU_COMPARE_ERROR;
b971b8
+        if (message)
b971b8
+            virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", message);
b971b8
+        else
b971b8
+            virReportError(VIR_ERR_CPU_INCOMPATIBLE, NULL);
b971b8
     }
b971b8
 
b971b8
  cleanup:
b971b8
     VIR_FREE(message);
b971b8
-    x86ModelFree(model);
b971b8
     return ret;
b971b8
 }
b971b8
 
b971b8
-- 
b971b8
2.26.2
b971b8