|
|
c480ed |
From 3335b5e0db21375053c5005be9f820f7ba945010 Mon Sep 17 00:00:00 2001
|
|
|
c480ed |
Message-Id: <3335b5e0db21375053c5005be9f820f7ba945010@dist-git>
|
|
|
c480ed |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
|
c480ed |
Date: Fri, 21 Jun 2019 09:25:02 +0200
|
|
|
c480ed |
Subject: [PATCH] cpu_x86: Log decoded CPU model and signatures
|
|
|
c480ed |
MIME-Version: 1.0
|
|
|
c480ed |
Content-Type: text/plain; charset=UTF-8
|
|
|
c480ed |
Content-Transfer-Encoding: 8bit
|
|
|
c480ed |
|
|
|
c480ed |
The log message may be useful when debugging why a specific CPU model
|
|
|
c480ed |
was selected for a given set of CPUID data.
|
|
|
c480ed |
|
|
|
c480ed |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
c480ed |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
c480ed |
(cherry picked from commit 5ced12decea42f1d588f2cb28b10ca7a5772098e)
|
|
|
c480ed |
|
|
|
c480ed |
https://bugzilla.redhat.com/show_bug.cgi?id=1686895
|
|
|
c480ed |
|
|
|
c480ed |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
c480ed |
Message-Id: <cae19825427465e352de05433920c96dc44552ff.1561068591.git.jdenemar@redhat.com>
|
|
|
c480ed |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
c480ed |
---
|
|
|
c480ed |
src/cpu/cpu_x86.c | 26 ++++++++++++++++++++++++++
|
|
|
c480ed |
1 file changed, 26 insertions(+)
|
|
|
c480ed |
|
|
|
c480ed |
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
|
|
c480ed |
index 7bd8119c23..ba14a6097d 100644
|
|
|
c480ed |
--- a/src/cpu/cpu_x86.c
|
|
|
c480ed |
+++ b/src/cpu/cpu_x86.c
|
|
|
c480ed |
@@ -1769,6 +1769,26 @@ x86ModelHasSignature(virCPUx86ModelPtr model,
|
|
|
c480ed |
}
|
|
|
c480ed |
|
|
|
c480ed |
|
|
|
c480ed |
+static char *
|
|
|
c480ed |
+x86FormatSignatures(virCPUx86ModelPtr model)
|
|
|
c480ed |
+{
|
|
|
c480ed |
+ virBuffer buf = VIR_BUFFER_INITIALIZER;
|
|
|
c480ed |
+ size_t i;
|
|
|
c480ed |
+
|
|
|
c480ed |
+ for (i = 0; i < model->nsignatures; i++) {
|
|
|
c480ed |
+ virBufferAsprintf(&buf, "%06lx,",
|
|
|
c480ed |
+ (unsigned long)model->signatures[i]);
|
|
|
c480ed |
+ }
|
|
|
c480ed |
+
|
|
|
c480ed |
+ virBufferTrim(&buf, ",", -1);
|
|
|
c480ed |
+
|
|
|
c480ed |
+ if (virBufferCheckError(&buf) < 0)
|
|
|
c480ed |
+ return NULL;
|
|
|
c480ed |
+
|
|
|
c480ed |
+ return virBufferContentAndReset(&buf;;
|
|
|
c480ed |
+}
|
|
|
c480ed |
+
|
|
|
c480ed |
+
|
|
|
c480ed |
/*
|
|
|
c480ed |
* Checks whether a candidate model is a better fit for the CPU data than the
|
|
|
c480ed |
* current model.
|
|
|
c480ed |
@@ -1892,6 +1912,7 @@ x86Decode(virCPUDefPtr cpu,
|
|
|
c480ed |
virCPUx86Data features = VIR_CPU_X86_DATA_INIT;
|
|
|
c480ed |
virCPUx86VendorPtr vendor;
|
|
|
c480ed |
virDomainCapsCPUModelPtr hvModel = NULL;
|
|
|
c480ed |
+ VIR_AUTOFREE(char *) sigs = NULL;
|
|
|
c480ed |
uint32_t signature;
|
|
|
c480ed |
ssize_t i;
|
|
|
c480ed |
int rc;
|
|
|
c480ed |
@@ -1984,6 +2005,11 @@ x86Decode(virCPUDefPtr cpu,
|
|
|
c480ed |
if (vendor && VIR_STRDUP(cpu->vendor, vendor->name) < 0)
|
|
|
c480ed |
goto cleanup;
|
|
|
c480ed |
|
|
|
c480ed |
+ sigs = x86FormatSignatures(model);
|
|
|
c480ed |
+
|
|
|
c480ed |
+ VIR_DEBUG("Using CPU model %s (signatures %s) for CPU with signature %06lx",
|
|
|
c480ed |
+ model->name, NULLSTR(sigs), (unsigned long)signature);
|
|
|
c480ed |
+
|
|
|
c480ed |
VIR_STEAL_PTR(cpu->model, cpuModel->model);
|
|
|
c480ed |
VIR_STEAL_PTR(cpu->features, cpuModel->features);
|
|
|
c480ed |
cpu->nfeatures = cpuModel->nfeatures;
|
|
|
c480ed |
--
|
|
|
c480ed |
2.22.0
|
|
|
c480ed |
|