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

Re: [Xen-devel] [PATCH for-4.5 v3] Xen and tools: Fix listing of vcpus when domains lacking any vcpus exist

On Tue, 2014-10-21 at 17:46 +0100, Andrew Cooper wrote:

> As part of this change, remove the pointless call to libxl_get_max_cpus(),
> whose returned value is unconditionally clobbered in the for() loop.
Is it? You mind pointing me at where?

> diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
> index f27b581..ee127d8 100644
> --- a/tools/libxl/libxl.c
> +++ b/tools/libxl/libxl.c
> @@ -5246,7 +5246,12 @@ libxl_vcpuinfo *libxl_list_vcpu(libxl_ctx *ctx, 
> uint32_t domid,
>          GC_FREE;
>          return NULL;
>      }
> -    *nr_cpus_out = libxl_get_max_cpus(ctx);
I may be wrong, but the only other occurrence of nr_cpus_out, which is
where the result from libxl_get_max_cpus() is stored, seems to be in the
parameter list of the function.

About the for, here's how it looks like here:

    for (*nr_vcpus_out = 0;
         *nr_vcpus_out <= domaininfo.max_vcpu_id;
         ++*nr_vcpus_out, ++ptr) {

I.e., it uses nr_vcpus_out. Note: _v_cpus, different from _p_cpus.

Without such call, callers that expect to see the parameter filled with
the maximum possible number of _P_CPUs, will break!


<<This happens because I choose it to happen!>> (Raistlin Majere)
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

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

Xen-devel mailing list



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