Re: [libvirt PATCH 4/5] qemu: probe for "-cpu max" support

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

 



On Tue, Feb 09, 2021 at 05:23:35PM +0100, Pavel Hrdina wrote:
> On Tue, Feb 09, 2021 at 01:59:00PM +0000, Daniel P. Berrangé wrote:
> > This is a special CPU model similar to "-cpu host", so won't use our
> > normal CPU model detection logic.
> > 
> > Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
> > ---
> >  src/qemu/qemu_capabilities.c | 11 +++++++++++
> >  src/qemu/qemu_capabilities.h |  1 +
> >  2 files changed, 12 insertions(+)
> > 
> > diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> > index d0378f94bc..ecfb313d0a 100644
> > --- a/src/qemu/qemu_capabilities.c
> > +++ b/src/qemu/qemu_capabilities.c
> > @@ -614,6 +614,7 @@ VIR_ENUM_IMPL(virQEMUCaps,
> >  
> >                /* 390 */
> >                "vhost-user-blk",
> > +              "cpu-max",
> >      );
> >  
> >  
> > @@ -2984,12 +2985,22 @@ virQEMUCapsProbeQMPCPUDefinitions(virQEMUCapsPtr qemuCaps,
> >                                    virQEMUCapsAccelPtr accel,
> >                                    qemuMonitorPtr mon)
> >  {
> > +    qemuMonitorCPUDefsPtr defs = accel->cpuModels;
> 
> accel->cpuModels is NULL here ... [0]
> 
> > +    size_t i;
> > +
> >      if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_DEFINITIONS))
> >          return 0;
> >  
> >      if (virQEMUCapsFetchCPUDefinitions(mon, qemuCaps->arch, &accel->cpuModels) < 0)
> >          return -1;
> >  
> > +    for (i = 0; i < defs->ncpus; i++) {
> 
> [0] ... so here it will crash.
> 
> > +        if (STREQ_NULLABLE(defs->cpus[i].name, "max")) {
> > +            virQEMUCapsSet(qemuCaps, QEMU_CAPS_CPU_MAX);
> > +            break;
> > +        }
> > +    }
> > +
> 
> Do we trust QEMU that if accel=kvm supports cpu-max that accel=tcg
> supports it as well and is that true on all architectures?

Yes, it would be considered a bug if that wasn't the case, because the
whole point of "max" is that it works for KVM and TCG. 


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




[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