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

Re: [Xen-devel] [PATCH 3/3] libxl: update vcpus bitmap in retrieved guest config



On Tue, Jun 07, 2016 at 03:45:29PM +0100, Anthony PERARD wrote:
> On Tue, Jun 07, 2016 at 12:24:02PM +0100, Wei Liu wrote:
> > ... because the available vcpu bitmap can change during domain life time
> > due to cpu hotplug and unplug.
> > 
> > For QEMU upstream, we interrogate QEMU for the number of vcpus. For
> > others, we look directly into xenstore for information.
> > 
> > Reported-by: Jan Beulich <jbeulich@xxxxxxxx>
> > Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
> > ---
> >  tools/libxl/libxl.c | 91 
> > +++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 91 insertions(+)
> > 
> > diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
> > index 006b83f..4f8b663 100644
> > --- a/tools/libxl/libxl.c
> > +++ b/tools/libxl/libxl.c
> > @@ -7222,6 +7222,57 @@ void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, 
> > libxl_mac *src)
> >          (*dst)[i] = (*src)[i];
> >  }
> >  
> > +static int libxl__update_avail_vcpus_qmp(libxl__gc *gc, uint32_t domid,
> > +                                         unsigned int max_vcpus,
> > +                                         libxl_bitmap *map)
> > +{
> > +    unsigned int count, i;
> > +    int rc;
> > +
> > +    /* For QEMU upstream we always need to return the number
> > +     * of cpus present to QEMU whether they are online or not;
> > +     * otherwise QEMU won't accept the saved state.
> > +     */
> > +    rc = libxl__qmp_query_cpus(gc, domid, &count);
> > +    if (rc) {
> > +        LOG(ERROR, "fail to get number of cpus for domain %d", domid);
> > +        goto out;
> > +    }
> > +
> > +    for (i = 0; i < count; i++)
> > +        libxl_bitmap_set(map, i);
> 
> What if I have cpu 1, 7 and 42 online, but all the other offline?
> 

I have more or less the same question when I wrote this patch. At that
time I thought the avail_vcpus was only used for generating -smp option
to QEMU.

In your example, you will have -smp 3,maxvcpus=$Y. I think the migration
should still succeed. Furthermore, the cpu-add operation doesn't care,
so it probably won't have visible effect.

I agree it would be good to set the exact bits though -- if you can tell
me which field to test. 


-> { "execute": "query-cpus" }
<- {
      "return":[
         {
            "CPU":0,
            "current":true,
            "halted":false,
            "qom_path":"/machine/unattached/device[0]",
            "arch":"x86",
            "pc":3227107138,
            "thread_id":3134
         },
         {
            "CPU":1,
            "current":false,
            "halted":true,
            "qom_path":"/machine/unattached/device[2]",
            "arch":"x86",
            "pc":7108165,
            "thread_id":3135
         }
      ]
   }
EQMP

Wei.

> -- 
> Anthony PERARD

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.