>>> On 21.05.15 at 10:41, <chao.p.p...@linux.intel.com> wrote: > --- a/xen/arch/x86/mpparse.c > +++ b/xen/arch/x86/mpparse.c > @@ -87,6 +87,18 @@ void __init set_nr_cpu_ids(unsigned int max_cpus) > #endif > } > > +void __init set_nr_sockets(void) > +{ > + unsigned int cpus = bitmap_weight(phys_cpu_present_map.mask, > + boot_cpu_data.x86_max_cores * > + boot_cpu_data.x86_num_siblings);
How did you come to this expression for the bitmap size? I.e. why not simply physids_weight(phys_cpu_present_map)? > + > + if ( cpus == 0 ) > + cpus = 1; > + > + nr_sockets = DIV_ROUND_UP(num_processors + disabled_cpus, cpus); > +} Is there a reason why this can't just be added to the end of the immediately preceding set_nr_cpu_ids()? > @@ -638,6 +649,8 @@ static int cpu_smpboot_alloc(unsigned int cpu) > unsigned int order, memflags = 0; > nodeid_t node = cpu_to_node(cpu); > struct desc_struct *gdt; > + unsigned int socket = cpu_to_socket(cpu); > + > > if ( node != NUMA_NO_NODE ) Stray blank line being added. > @@ -717,6 +734,12 @@ void __init smp_prepare_cpus(unsigned int max_cpus) > > stack_base[0] = stack_start; > > + socket_cpumask = xzalloc_array(cpumask_var_t, nr_sockets); > + if ( !socket_cpumask ) > + panic("No memory for socket CPU siblings map"); > + if ( !zalloc_cpumask_var(socket_cpumask) ) > + panic("No memory for socket CPU siblings cpumask"); Please combine the two if()s to have just a single panic() invocation. If either fails, it doesn't really matter which one it was. > --- a/xen/include/asm-x86/smp.h > +++ b/xen/include/asm-x86/smp.h > @@ -58,6 +58,15 @@ int hard_smp_processor_id(void); > > void __stop_this_cpu(void); > > +/* > + * The value may be greater than the actual socket number in the system and > + * is considered not to change from the initial startup. > + */ > +extern unsigned int nr_sockets; In the comment, instead of "considered" do you perhaps mean "expected" or even "required"? > +/* Representing HT and core siblings in each socket */ > +extern cpumask_var_t *socket_cpumask; Comment style. Jan _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel