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