George Dunlap
2011-Jul-20 15:10 UTC
[Xen-devel] [PATCH] xenalyze: Raise MAX_CPUS to 256 cpus
Some systems actually have that many now. (And XenServer builds with MAX_PHYS_CPUS set to 256.) Also, check if a CPU is out of range before using, warn and exit, instead of segfaulting. To-do: Make the size dynamically adjustable. Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com> diff -r 405fc96c0ec2 -r e11e13e66c62 xenalyze.c --- a/xenalyze.c Thu Jul 14 12:55:17 2011 +0100 +++ b/xenalyze.c Wed Jul 20 16:10:20 2011 +0100 @@ -1621,7 +1621,7 @@ struct cr3_value_struct { }; #ifndef MAX_CPUS -#define MAX_CPUS 128 +#define MAX_CPUS 256 #endif typedef uint32_t cpu_mask_t; @@ -7968,6 +7968,14 @@ loff_t scan_for_new_pcpu(loff_t offset) } cd = (typeof(cd))rec.u.notsc.data; + + if ( cd->cpu > MAX_CPUS ) + { + fprintf(stderr, "%s: cpu %d exceeds MAX_CPU %d!\n", + __func__, cd->cpu, MAX_CPUS); + /* FIXME: Figure out if we could handle this more gracefully */ + error(ERR_ASSERT, NULL); + } if(cd->cpu > P.max_active_pcpu || !P.pcpu[cd->cpu].active) { struct pcpu_info *p = P.pcpu + cd->cpu; _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel