From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chao Peng Subject: Re: [PATCH v8 01/13] x86: add socket_cpumask Date: Tue, 2 Jun 2015 15:19:55 +0800 Message-ID: <20150602071955.GD3773@pengc-linux.bj.intel.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> <5567284D020000780007E93D@mail.emea.novell.com> <20150529023533.GA18422@pengc-linux.bj.intel.com> <55683911020000780007ED2B@mail.emea.novell.com> <20150529082824.GE18422@pengc-linux.bj.intel.com> <556844D3020000780007EDBE@mail.emea.novell.com> <20150602063545.GC3773@pengc-linux.bj.intel.com> <556D70130200007800080068@mail.emea.novell.com> Reply-To: Chao Peng Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <556D70130200007800080068@mail.emea.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich 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 Tue, Jun 02, 2015 at 07:57:55AM +0100, Jan Beulich wrote: > >>> On 02.06.15 at 08:35, wrote: > > On Fri, May 29, 2015 at 09:52:03AM +0100, Jan Beulich wrote: > >> >>> On 29.05.15 at 10:28, wrote: > >> > On Fri, May 29, 2015 at 09:01:53AM +0100, Jan Beulich wrote: > >> >> >>> On 29.05.15 at 04:35, wrote: > >> >> > On Thu, May 28, 2015 at 01:38:05PM +0100, Jan Beulich wrote: > >> >> >> >>> 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); > >> >> >> > + > >> >> >> > + 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()? > >> >> > > >> >> > You mean the declaration or invocation? If the former I have no special > >> >> > reason for it (e.g. I can change it). > >> >> > >> >> Neither - I just don't see the need for a new function. > >> > > >> > In which case the invocation of set_nr_cpu_ids() should move to the > >> > place where now set_nr_sockets() is invoked, to make sure > >> > boot_cpu_data.x86_max_cores/x86_num_siblings available, which may not be > >> > your expectation. > >> > >> Ah, in which case this _is_ the explanation, albeit only provided the > >> use of the two boot_cpu_data fields has to remain (which I had put > >> under question). And if these have to remain, couldn't this be done > >> in a presmp initcall instead of an explicitly called function? > > > > presmp is too late. nr_sockets will get used in smp_prepare_cpus() > > before calling set_cpu_sibling_map for cpu 0. > > Okay. In which case - why not calculate the value there? Okay, then I just need move the invocation of set_nr_sockets() from __start_xen() to smp_prepare_cpus(). Chao