[libvirt] [PATCH v2 15/30] cpu_x86: Log decoded CPU model and signatures

Jiri Denemark jdenemar at redhat.com
Tue Mar 5 13:50:44 UTC 2019


On Tue, Mar 05, 2019 at 12:35:48 +0100, Ján Tomko wrote:
> On Tue, Mar 05, 2019 at 10:40:31AM +0100, Jiri Denemark wrote:
> >The log message may be useful when debugging why a specific CPU model
> >was selected for a given set of CPUID data.
> >
> >Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
> >---
> >
> >Notes:
> >    Version 2:
> >    - separated from 11/26 cpu_x86: Allow multiple signatures for a CPU model
> >    - signature formatting code moved into a dedicated function
> >
> > src/cpu/cpu_x86.c | 27 +++++++++++++++++++++++++++
> > 1 file changed, 27 insertions(+)
> >
> >diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
> >index 08677ef7ff..5a1071de4d 100644
> >--- a/src/cpu/cpu_x86.c
> >+++ b/src/cpu/cpu_x86.c
> >@@ -1773,6 +1773,26 @@ x86ModelHasSignature(virCPUx86ModelPtr model,
> > }
> >
> >
> >+static char *
> >+x86FormatSignatures(virCPUx86ModelPtr model)
> >+{
> >+    virBuffer buf = VIR_BUFFER_INITIALIZER;
> >+    size_t i;
> >+
> >+    for (i = 0; i < model->nsignatures; i++) {
> >+        virBufferAsprintf(&buf, "%06lx,",
> >+                          (unsigned long)model->signatures[i]);
> >+    }
> >+
> >+    virBufferTrim(&buf, ",", -1);
> >+
> >+    if (virBufferCheckError(&buf) < 0)
> >+        return NULL;
> >+
> >+    return virBufferContentAndReset(&buf);
> >+}
> >+
> >+
> > /*
> >  * Checks whether a candidate model is a better fit for the CPU data than the
> >  * current model.
> >@@ -1896,6 +1916,7 @@ x86Decode(virCPUDefPtr cpu,
> >     virCPUx86Data features = VIR_CPU_X86_DATA_INIT;
> >     virCPUx86VendorPtr vendor;
> >     virDomainCapsCPUModelPtr hvModel = NULL;
> >+    char *sigs = NULL;
> 
> VIR_AUTOFREE(char *)

I fixed this and pushed this series. Thanks for the reviews.

Jirka




More information about the libvir-list mailing list