xenalyze: Raise MAX_CPUS to 256 cpus
PATCH 1/1 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 <[email protected]>
xenalyze.c +9 -1
@@ -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;