[libvirt] [PATCH v3 09/28] qemu: Probe "max" CPU model in TCG

Pavel Hrdina phrdina at redhat.com
Fri Feb 24 12:06:33 UTC 2017


On Fri, Feb 24, 2017 at 01:04:35PM +0100, Jiri Denemark wrote:
> On Thu, Feb 23, 2017 at 20:07:00 +0100, Pavel Hrdina wrote:
> > On Thu, Feb 23, 2017 at 03:15:07PM +0100, Jiri Denemark wrote:
> > > Querying "host" CPU model expansion only makes sense for KVM. QEMU 2.9.0
> > > introduces a new "max" CPU model which can be used to ask QEMU what the
> > > best CPU it can provide to a TCG domain is.
> ...
> > >  static int
> > >  virQEMUCapsInitCPUModelS390(virQEMUCapsPtr qemuCaps,
> > > +                            virDomainVirtType type,
> > >                              virCPUDefPtr cpu)
> > >  {
> > > -    qemuMonitorCPUModelInfoPtr modelInfo = qemuCaps->hostCPUModelInfo;
> > > +    qemuMonitorCPUModelInfoPtr modelInfo;
> > >      size_t i;
> > >  
> > > -    if (!modelInfo) {
> > > +    if (type != VIR_DOMAIN_VIRT_KVM)
> > > +        return -1;
> > 
> > It would be nice to have some error message in this case as well.  Before
> > this patch the following error would be used because the "hostCPUModelInfo"
> > would be empty for TCG.
> > 
> > ACK with that fixed
> > 
> > Pavel
> > 
> > > +
> > > +    if (!(modelInfo = qemuCaps->kvmCPUModelInfo)) {
> > >          virReportError(VIR_ERR_INTERNAL_ERROR,
> > >                         _("missing host CPU model info from QEMU capabilities "
> > >                           "for binary %s"),
> 
> Hmm, the code should be a bit different:
> 
>     if (type == VIR_DOMAIN_VIRT_KVM)
>         modelInfo = qemuCaps->kvmCPUModelInfo;
>     else
>         modelInfo = qemuCaps->tcgCPUModelInfo;
> 
>     if (!modelInfo) {
>         virReportError(VIR_ERR_INTERNAL_ERROR,
>                        _("missing host CPU model info from QEMU capabilities "
>                          "for binary %s"),
>                        qemuCaps->binary);
>         return -1;
>     }
> 
> There's no reason to ignore tcgCPUModelInfo in case QEMU implements
> support for "max" CPU model for TCG.

Right, this is even better, ACK with that.

Pavel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170224/619385a7/attachment-0001.sig>


More information about the libvir-list mailing list