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

Re: [Xen-devel] [PATCH v2 2/2] libxl: Use QMP cpu-add to hotplug CPU with qemu-xen.



On Mon, 2013-06-17 at 15:20 +0100, Anthony PERARD wrote:
> Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>

I'm not sure but I think we might want to do both the xenstore and the
qmp thing on qemu-xen for the benefit of PVHVM guests. I've added Konrad
to the CC.

> ---
>  tools/libxl/libxl.c | 41 ++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 40 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
> index ee1fa9c..e31b866 100644
> --- a/tools/libxl/libxl.c
> +++ b/tools/libxl/libxl.c
> @@ -4237,7 +4237,8 @@ int libxl_domain_get_nodeaffinity(libxl_ctx *ctx, 
> uint32_t domid,
>      return 0;
>  }
>  
> -int libxl_set_vcpuonline(libxl_ctx *ctx, uint32_t domid, libxl_bitmap 
> *cpumap)
> +static int libxl__set_vcpuonline_xenstore(libxl_ctx *ctx, uint32_t domid,
> +                                         libxl_bitmap *cpumap)

It's a bit tedious but really you ought to make this take a gc not a ctx
when you internalise it. You can start the function with "libxl__ctx*ctx
= libxl__gc_owner(gc)", or s/ctx/CTX/ in the body.

>  {
>      GC_INIT(ctx);
>      libxl_dominfo info;
> @@ -4268,6 +4269,44 @@ out:
>      return rc;
>  }
>  
> +static int libxl__set_vcpuonline_qmp(libxl__gc *gc, uint32_t domid,
> +                                     libxl_bitmap *cpumap)
> +{
> +    libxl_dominfo info;
> +    int i, rc = 0;
> +
> +    if (libxl_domain_info(CTX, &info, domid) < 0) {
> +        LIBXL__LOG_ERRNO(CTX, LIBXL__LOG_ERROR, "getting domain info list");

The LOG() macros is useful here.

> +        rc = ERROR_FAIL;
> +        goto out;
> +    }
> +    for (i = 0; i <= info.vcpu_max_id; i++) {
> +        if (libxl_bitmap_test(cpumap, i)) {
> +            rc = libxl__qmp_cpu_add(gc, domid, i);
> +        }
> +    }
> +out:
> +    return rc;
> +}



_______________________________________________
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®.