Re: [PATCH 4/5] conf: include x86 microcode version in virsh capabilities

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jan 04, 2018 at 16:25:49 +0100, Peter Krempa wrote:
> On Thu, Jan 04, 2018 at 15:58:11 +0100, Jiri Denemark wrote:
> > From: Paolo Bonzini <pbonzini@xxxxxxxxxx>
> > 
> > A microcode update can cause the CPUID bits to change; an example
> > from the past was the update that disabled TSX on several Haswell and
> > Broadwell machines.
> > 
> > In order to track the x86 microcode version in the QEMU capabilities,
> > we have to fetch it and store it in the host CPU.  This also makes the
> > version visible in "virsh capabilities", which is a nice side effect.
> > 
> > Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
> > Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
> > ---
> >  src/conf/cpu_conf.c | 14 ++++++++++++++
> >  src/conf/cpu_conf.h |  1 +
> >  src/cpu/cpu_x86.c   |  9 +++++++++
> >  3 files changed, 24 insertions(+)
> 
> [...]
> 
> > @@ -382,6 +384,14 @@ virCPUDefParseXML(xmlXPathContextPtr ctxt,
> >              goto cleanup;
> >          }
> >          VIR_FREE(arch);
> > +
> > +        if (virXPathBoolean("boolean(./microcode[1]/@version)", ctxt) > 0 &&
> > +            virXPathUInt("string(./microcode[1]/@version)", ctxt,
> > +                         &def->microcodeVersion) < 0) {
> > +            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> > +                           _("invalid microcode version"));
> > +            goto cleanup;
> > +        }
> >      }
> >  
> >      if (!(def->model = virXPathString("string(./model[1])", ctxt)) &&
> > @@ -720,6 +730,10 @@ virCPUDefFormatBuf(virBufferPtr buf,
> >      if (formatModel && def->vendor)
> >          virBufferEscapeString(buf, "<vendor>%s</vendor>\n", def->vendor);
> >  
> > +    if (def->type == VIR_CPU_TYPE_HOST && def->microcodeVersion)
> 
> Hmm, looks like you should add a comment to virHostCPUGetMicrocodeVersion
> stating that 0 is a special value.

Yeah, I added the comment there.

Jirka

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux