|
|
6ae9ed |
From 1433f648ba50ee55b5c4ee2170fbe9433795d7c8 Mon Sep 17 00:00:00 2001
|
|
|
6ae9ed |
Message-Id: <1433f648ba50ee55b5c4ee2170fbe9433795d7c8@dist-git>
|
|
|
6ae9ed |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
|
6ae9ed |
Date: Wed, 7 Sep 2016 15:16:57 +0200
|
|
|
6ae9ed |
Subject: [PATCH] cpu_x86: Fix minimum match custom CPUs on hosts with CMT
|
|
|
6ae9ed |
|
|
|
6ae9ed |
Since the introduction of CMT features (commit v1.3.5-461-gf294b83)
|
|
|
6ae9ed |
starting a domain with custom CPU and match='minimum' on a host which
|
|
|
6ae9ed |
supports CMT fails because QEMU complains about unknown 'cmt' feature.
|
|
|
6ae9ed |
|
|
|
6ae9ed |
"cpu_x86: Fix host-model CPUs on hosts with CMT" commit fixed similar
|
|
|
6ae9ed |
issue for host-model CPUs.
|
|
|
6ae9ed |
|
|
|
6ae9ed |
This patch is a RHEL-only hack because upstream fixes this by unifying
|
|
|
6ae9ed |
the code for these two types of CPUs, but the upstream solution is
|
|
|
6ae9ed |
invasive and cannot be easily backported.
|
|
|
6ae9ed |
|
|
|
6ae9ed |
https://bugzilla.redhat.com/show_bug.cgi?id=1365500
|
|
|
6ae9ed |
|
|
|
6ae9ed |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
6ae9ed |
---
|
|
|
6ae9ed |
src/cpu/cpu_x86.c | 18 +++++++++++++-----
|
|
|
6ae9ed |
1 file changed, 13 insertions(+), 5 deletions(-)
|
|
|
6ae9ed |
|
|
|
6ae9ed |
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
|
|
6ae9ed |
index 670b02e..d7c58cf 100644
|
|
|
6ae9ed |
--- a/src/cpu/cpu_x86.c
|
|
|
6ae9ed |
+++ b/src/cpu/cpu_x86.c
|
|
|
6ae9ed |
@@ -456,7 +456,8 @@ static int
|
|
|
6ae9ed |
x86DataToCPUFeatures(virCPUDefPtr cpu,
|
|
|
6ae9ed |
int policy,
|
|
|
6ae9ed |
virCPUx86Data *data,
|
|
|
6ae9ed |
- virCPUx86MapPtr map)
|
|
|
6ae9ed |
+ virCPUx86MapPtr map,
|
|
|
6ae9ed |
+ bool filter)
|
|
|
6ae9ed |
{
|
|
|
6ae9ed |
size_t i;
|
|
|
6ae9ed |
|
|
|
6ae9ed |
@@ -464,6 +465,13 @@ x86DataToCPUFeatures(virCPUDefPtr cpu,
|
|
|
6ae9ed |
virCPUx86FeaturePtr feature = map->features[i];
|
|
|
6ae9ed |
if (x86DataIsSubset(data, &feature->data)) {
|
|
|
6ae9ed |
x86DataSubtract(data, &feature->data);
|
|
|
6ae9ed |
+
|
|
|
6ae9ed |
+ if (filter &&
|
|
|
6ae9ed |
+ (STREQ(feature->name, "cmt") ||
|
|
|
6ae9ed |
+ STREQ(feature->name, "mbm_total") ||
|
|
|
6ae9ed |
+ STREQ(feature->name, "mbm_local")))
|
|
|
6ae9ed |
+ continue;
|
|
|
6ae9ed |
+
|
|
|
6ae9ed |
if (virCPUDefAddFeature(cpu, feature->name, policy) < 0)
|
|
|
6ae9ed |
return -1;
|
|
|
6ae9ed |
}
|
|
|
6ae9ed |
@@ -595,8 +603,8 @@ x86DataToCPU(const virCPUx86Data *data,
|
|
|
6ae9ed |
/* because feature policy is ignored for host CPU */
|
|
|
6ae9ed |
cpu->type = VIR_CPU_TYPE_GUEST;
|
|
|
6ae9ed |
|
|
|
6ae9ed |
- if (x86DataToCPUFeatures(cpu, VIR_CPU_FEATURE_REQUIRE, ©, map) ||
|
|
|
6ae9ed |
- x86DataToCPUFeatures(cpu, VIR_CPU_FEATURE_DISABLE, &modelData, map))
|
|
|
6ae9ed |
+ if (x86DataToCPUFeatures(cpu, VIR_CPU_FEATURE_REQUIRE, ©, map, false) ||
|
|
|
6ae9ed |
+ x86DataToCPUFeatures(cpu, VIR_CPU_FEATURE_DISABLE, &modelData, map, false))
|
|
|
6ae9ed |
goto error;
|
|
|
6ae9ed |
|
|
|
6ae9ed |
cleanup:
|
|
|
6ae9ed |
@@ -1835,7 +1843,7 @@ x86Decode(virCPUDefPtr cpu,
|
|
|
6ae9ed |
|
|
|
6ae9ed |
x86DataSubtract(©, &features);
|
|
|
6ae9ed |
if (x86DataToCPUFeatures(cpuModel, VIR_CPU_FEATURE_REQUIRE,
|
|
|
6ae9ed |
- ©, map) < 0)
|
|
|
6ae9ed |
+ ©, map, false) < 0)
|
|
|
6ae9ed |
goto cleanup;
|
|
|
6ae9ed |
}
|
|
|
6ae9ed |
|
|
|
6ae9ed |
@@ -2503,7 +2511,7 @@ x86UpdateCustom(virCPUDefPtr guest,
|
|
|
6ae9ed |
guest->match = VIR_CPU_MATCH_EXACT;
|
|
|
6ae9ed |
if (x86ModelSubtractCPU(host_model, guest, map) ||
|
|
|
6ae9ed |
x86DataToCPUFeatures(guest, VIR_CPU_FEATURE_REQUIRE,
|
|
|
6ae9ed |
- &host_model->data, map))
|
|
|
6ae9ed |
+ &host_model->data, map, true))
|
|
|
6ae9ed |
goto cleanup;
|
|
|
6ae9ed |
}
|
|
|
6ae9ed |
|
|
|
6ae9ed |
--
|
|
|
6ae9ed |
2.10.0
|
|
|
6ae9ed |
|