From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: Re: [PATCH v8 01/13] x86: add socket_cpumask Date: Thu, 28 May 2015 13:38:05 +0100 Message-ID: <5567284D020000780007E93D@mail.emea.novell.com> References: <1432197704-20816-1-git-send-email-chao.p.peng@linux.intel.com> <1432197704-20816-2-git-send-email-chao.p.peng@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1432197704-20816-2-git-send-email-chao.p.peng@linux.intel.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Chao Peng Cc: wei.liu2@citrix.com, Ian.Campbell@citrix.com, stefano.stabellini@eu.citrix.com, andrew.cooper3@citrix.com, dario.faggioli@citrix.com, Ian.Jackson@eu.citrix.com, xen-devel@lists.xen.org, will.auld@intel.com, keir@xen.org, dgdegra@tycho.nsa.gov List-Id: xen-devel@lists.xenproject.org >>> On 21.05.15 at 10:41, 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