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