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