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

Re: [Xen-devel] [PATCH] libxl: use xc_topologyinfo to figure out how many CPUs we actually have



On Wed, 2012-05-09 at 13:04 +0100, Ian Campbell wrote: 
> On Wed, 2012-05-09 at 12:03 +0100, Darrio Faggioli wrote:
> > diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
> > --- a/tools/libxl/libxl.c
> > +++ b/tools/libxl/libxl.c
> > @@ -2903,7 +2903,8 @@ libxl_cputopology *libxl_get_cpu_topolog
> >      }
> >  
> >      for (i = 0; i < max_cpus; i++) {
> > -#define V(map, i) (map[i] == INVALID_TOPOLOGY_ID) ? \
> > +#define V(map, i) (i > tinfo.max_cpu_index || \
> > +    map[i] == INVALID_TOPOLOGY_ID) ? \
> 
> This ensures that cpus entries above max_cpu_index are
> INVALID_TOPOLOGY_ID 
>
Yep, thus giving consumers of this call the chance to figure out what
the valid entries are. It looked the most natural way of doing this,
given output_topology (for instance) already check for
LIBXL_CPUTOPOLOGY_INVALID_ENTRY entries and skip them.

Also, the get-cpu-topology command in xenpm, which always worked
properly on my testbox, does exactly that.

> but do you also want to size the return array using
> tinfo.max_cpu_index too? And also return that in *nr instead of?
> 
> (I don't know the answer, either of max-possible- and max-online-cpus is
> a reasonable size for this array)
> 
Well, I really don't know either. This is the minimum impact working
version. For sure, I'd like very much to return that value via *nr, as
it will give me something more sensible to work with... You know what,
I'm sending a patch doing exactly that, as I think what you're
suggesting is actually better.

Thanks,
Dario

-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://retis.sssup.it/people/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
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®.