|
|
bba56f |
From 8877885f067aaa87b7ab42de914de5e50f4ef32d Mon Sep 17 00:00:00 2001
|
|
|
bba56f |
Message-Id: <8877885f067aaa87b7ab42de914de5e50f4ef32d@dist-git>
|
|
|
bba56f |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
|
bba56f |
Date: Mon, 4 Mar 2019 16:37:31 +0100
|
|
|
bba56f |
Subject: [PATCH] cpu_x86: Log decoded CPU model and signatures
|
|
|
bba56f |
MIME-Version: 1.0
|
|
|
bba56f |
Content-Type: text/plain; charset=UTF-8
|
|
|
bba56f |
Content-Transfer-Encoding: 8bit
|
|
|
bba56f |
|
|
|
bba56f |
The log message may be useful when debugging why a specific CPU model
|
|
|
bba56f |
was selected for a given set of CPUID data.
|
|
|
bba56f |
|
|
|
bba56f |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
bba56f |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
bba56f |
(cherry picked from commit 5ced12decea42f1d588f2cb28b10ca7a5772098e)
|
|
|
bba56f |
|
|
|
bba56f |
https://bugzilla.redhat.com/show_bug.cgi?id=1558558
|
|
|
bba56f |
https://bugzilla.redhat.com/show_bug.cgi?id=1687515
|
|
|
bba56f |
|
|
|
bba56f |
Conflicts:
|
|
|
bba56f |
src/cpu/cpu_x86.c
|
|
|
bba56f |
- VIR_AUTOFREE is not in RHEL-7.6
|
|
|
bba56f |
|
|
|
bba56f |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
bba56f |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
bba56f |
---
|
|
|
bba56f |
src/cpu/cpu_x86.c | 27 +++++++++++++++++++++++++++
|
|
|
bba56f |
1 file changed, 27 insertions(+)
|
|
|
bba56f |
|
|
|
bba56f |
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
|
|
bba56f |
index 466c79031d..cf3d80eeb5 100644
|
|
|
bba56f |
--- a/src/cpu/cpu_x86.c
|
|
|
bba56f |
+++ b/src/cpu/cpu_x86.c
|
|
|
bba56f |
@@ -1821,6 +1821,26 @@ x86ModelHasSignature(virCPUx86ModelPtr model,
|
|
|
bba56f |
}
|
|
|
bba56f |
|
|
|
bba56f |
|
|
|
bba56f |
+static char *
|
|
|
bba56f |
+x86FormatSignatures(virCPUx86ModelPtr model)
|
|
|
bba56f |
+{
|
|
|
bba56f |
+ virBuffer buf = VIR_BUFFER_INITIALIZER;
|
|
|
bba56f |
+ size_t i;
|
|
|
bba56f |
+
|
|
|
bba56f |
+ for (i = 0; i < model->nsignatures; i++) {
|
|
|
bba56f |
+ virBufferAsprintf(&buf, "%06lx,",
|
|
|
bba56f |
+ (unsigned long)model->signatures[i]);
|
|
|
bba56f |
+ }
|
|
|
bba56f |
+
|
|
|
bba56f |
+ virBufferTrim(&buf, ",", -1);
|
|
|
bba56f |
+
|
|
|
bba56f |
+ if (virBufferCheckError(&buf) < 0)
|
|
|
bba56f |
+ return NULL;
|
|
|
bba56f |
+
|
|
|
bba56f |
+ return virBufferContentAndReset(&buf;;
|
|
|
bba56f |
+}
|
|
|
bba56f |
+
|
|
|
bba56f |
+
|
|
|
bba56f |
/*
|
|
|
bba56f |
* Checks whether a candidate model is a better fit for the CPU data than the
|
|
|
bba56f |
* current model.
|
|
|
bba56f |
@@ -1944,6 +1964,7 @@ x86Decode(virCPUDefPtr cpu,
|
|
|
bba56f |
virCPUx86Data features = VIR_CPU_X86_DATA_INIT;
|
|
|
bba56f |
virCPUx86VendorPtr vendor;
|
|
|
bba56f |
virDomainCapsCPUModelPtr hvModel = NULL;
|
|
|
bba56f |
+ char *sigs = NULL;
|
|
|
bba56f |
uint32_t signature;
|
|
|
bba56f |
ssize_t i;
|
|
|
bba56f |
int rc;
|
|
|
bba56f |
@@ -2036,6 +2057,11 @@ x86Decode(virCPUDefPtr cpu,
|
|
|
bba56f |
if (vendor && VIR_STRDUP(cpu->vendor, vendor->name) < 0)
|
|
|
bba56f |
goto cleanup;
|
|
|
bba56f |
|
|
|
bba56f |
+ sigs = x86FormatSignatures(model);
|
|
|
bba56f |
+
|
|
|
bba56f |
+ VIR_DEBUG("Using CPU model %s (signatures %s) for CPU with signature %06lx",
|
|
|
bba56f |
+ model->name, NULLSTR(sigs), (unsigned long)signature);
|
|
|
bba56f |
+
|
|
|
bba56f |
VIR_STEAL_PTR(cpu->model, cpuModel->model);
|
|
|
bba56f |
VIR_STEAL_PTR(cpu->features, cpuModel->features);
|
|
|
bba56f |
cpu->nfeatures = cpuModel->nfeatures;
|
|
|
bba56f |
@@ -2050,6 +2076,7 @@ x86Decode(virCPUDefPtr cpu,
|
|
|
bba56f |
virCPUx86DataClear(&data);
|
|
|
bba56f |
virCPUx86DataClear(©);
|
|
|
bba56f |
virCPUx86DataClear(&features);
|
|
|
bba56f |
+ VIR_FREE(sigs);
|
|
|
bba56f |
return ret;
|
|
|
bba56f |
}
|
|
|
bba56f |
|
|
|
bba56f |
--
|
|
|
bba56f |
2.21.0
|
|
|
bba56f |
|