Port-xen archive

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

Re: [PATCH v3 5/7] libxl/libxc: Move libxl_get_cpu_topology()'s hypercall buffer management to libxc



On Mon, 2015-02-09 at 15:04 -0500, Boris Ostrovsky wrote:
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky%oracle.com@localhost>
>
Reviewed-by: Dario Faggioli <dario.faggioli%citrix.com@localhost>

Just one thing:

> --- a/tools/libxl/libxl.c
> +++ b/tools/libxl/libxl.c
> @@ -5072,38 +5072,23 @@ int libxl_get_physinfo(libxl_ctx *ctx, libxl_physinfo *physinfo)
>  libxl_cputopology *libxl_get_cpu_topology(libxl_ctx *ctx, int *nb_cpu_out)
>  {
>      GC_INIT(ctx);
> -    xc_cputopoinfo_t tinfo;
> -    DECLARE_HYPERCALL_BUFFER(xen_sysctl_cputopo_t, cputopo);
> +    xc_cputopo_t *cputopo;
>      libxl_cputopology *ret = NULL;
> -    int i;
> -    int max_cpus;
> +    int i, max_cpus;
>  
>      max_cpus = libxl_get_max_cpus(ctx);
> -    if (max_cpus < 0)
> -    {
> +    if (max_cpus < 0) {
>          LIBXL__LOG(ctx, XTL_ERROR, "Unable to determine number of CPUS");
> -        ret = NULL;
>          goto out;
>      }
>  
> -    cputopo = xc_hypercall_buffer_alloc(ctx->xch, cputopo,
> -                                        sizeof(*cputopo) * max_cpus);
> -    if (cputopo == NULL) {
> -        LIBXL__LOG_ERRNOVAL(ctx, XTL_ERROR, ENOMEM,
> -                            "Unable to allocate hypercall arguments");
> -        goto fail;
> -    }
> +    cputopo = libxl__zalloc(gc, sizeof(*cputopo) * max_cpus);
>  
> -    set_xen_guest_handle(tinfo.cputopo, cputopo);
> -    tinfo.max_cpu_index = max_cpus - 1;
> -    if (xc_cputopoinfo(ctx->xch, &tinfo) != 0) {
> +    if (xc_cputopoinfo(ctx->xch, &max_cpus, cputopo) != 0) {
>          LIBXL__LOG_ERRNO(ctx, XTL_ERROR, "CPU topology info hypercall failed");
>
While at it, you probably can convert this to the new LOGE() error
reporting style.

Regards,
Dario

Attachment: signature.asc
Description: This is a digitally signed message part



Home | Main Index | Thread Index | Old Index