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

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



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.

Jirka


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