xenpm: fix get-cpu-topology
Signed-off-by: Wei Gang <gang.wei@intel.com>
diff -r cd5edc77ab93 tools/misc/xenpm.c
--- a/tools/misc/xenpm.c Fri Jul 09 17:55:39 2010 +0800
+++ b/tools/misc/xenpm.c Mon Jul 12 14:10:16 2010 +0800
@@ -858,7 +858,7 @@ void cpu_topology_func(int argc, char *a
info.max_cpu_index = MAX_NR_CPU-1;
printf("CPU\tcore\tsocket\tnode\n");
- for ( i = 0; i < info.max_cpu_index; i++ )
+ for ( i = 0; i <= info.max_cpu_index; i++ )
{
if ( cpu_to_core[i] == INVALID_TOPOLOGY_ID )
continue;
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Wei, Gang writes ("[Xen-devel] xenpm: fix
get-cpu-topology"):> xenpm: fix get-cpu-topology
>
> Signed-off-by: Wei Gang <gang.wei@intel.com>
>
> diff -r cd5edc77ab93 tools/misc/xenpm.c
> --- a/tools/misc/xenpm.c Fri Jul 09 17:55:39 2010 +0800
> +++ b/tools/misc/xenpm.c Mon Jul 12 14:10:16 2010 +0800
> @@ -858,7 +858,7 @@ void cpu_topology_func(int argc, char *a
> info.max_cpu_index = MAX_NR_CPU-1;
>
> printf("CPU\tcore\tsocket\tnode\n");
> - for ( i = 0; i < info.max_cpu_index; i++ )
> + for ( i = 0; i <= info.max_cpu_index; i++ )
> {
> if ( cpu_to_core[i] == INVALID_TOPOLOGY_ID )
> continue;
The comments in xen/include/public/sysctl.h about the meaning of
max_cpu_index are ambiguous:
/*
* IN: maximum addressable entry in the caller-provided arrays.
* OUT: largest cpu identifier in the system.
* If OUT is greater than IN then the arrays are truncated!
*/
uint32_t max_cpu_index;
...
* The size of this array is specified by the caller in @max_cpu_index.
* If the actual @max_cpu_index is smaller than the array then the trailing
* elements of the array will not be written by the sysctl.
*/
So is it the size of the array or the maximum index ?
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
On 12/07/2010 18:06, "Ian Jackson" <Ian.Jackson@eu.citrix.com> wrote:> * The size of this array is specified by the caller in @max_cpu_index. > * If the actual @max_cpu_index is smaller than the array then the > trailing > * elements of the array will not be written by the sysctl. > */ > > So is it the size of the array or the maximum index ?It''s the maximum index. Pedantically, that is sufficient to specify the size of the array. It is unnecessarily confusing wording though. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel