From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH v5 04/22] xen/arm: Set nr_cpu_ids to available number of cpus Date: Tue, 28 Jul 2015 14:21:10 +0100 Message-ID: <55B781C6.5020202@citrix.com> References: <1437995524-19772-1-git-send-email-vijay.kilari@gmail.com> <1437995524-19772-5-git-send-email-vijay.kilari@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1437995524-19772-5-git-send-email-vijay.kilari@gmail.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: vijay.kilari@gmail.com, Ian.Campbell@citrix.com, stefano.stabellini@eu.citrix.com, stefano.stabellini@citrix.com, tim@xen.org, xen-devel@lists.xen.org Cc: Prasun.Kapoor@caviumnetworks.com, manish.jaggi@caviumnetworks.com, Vijaya Kumar K List-Id: xen-devel@lists.xenproject.org Hi Vijay, On 27/07/15 12:11, vijay.kilari@gmail.com wrote: > From: Vijaya Kumar K > > nr_cpu_ids for arm platforms is set to 128 irrespective of NIT: s/128/NR_CPUS/ > number of cpus supported by platform. > > Signed-off-by: Vijaya Kumar K > --- > xen/arch/arm/setup.c | 1 + > xen/arch/arm/smpboot.c | 11 +++++++++++ > xen/include/asm-arm/smp.h | 1 + > 3 files changed, 13 insertions(+) > > diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c > index a46c583..6ca787b 100644 > --- a/xen/arch/arm/setup.c > +++ b/xen/arch/arm/setup.c > @@ -772,6 +772,7 @@ void __init start_xen(unsigned long boot_phys_offset, > > smp_init_cpus(); > cpus = smp_get_max_cpus(); > + set_nr_cpu_ids(cpus); > > init_xen_time(); > > diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c > index a96cda2..233ad95 100644 > --- a/xen/arch/arm/smpboot.c > +++ b/xen/arch/arm/smpboot.c > @@ -243,6 +243,17 @@ void __init smp_init_cpus(void) > } > } > > +void __init set_nr_cpu_ids(unsigned int max_cpus) > +{ > + if ( !max_cpus ) > + max_cpus = 1; > + else if ( max_cpus > NR_CPUS ) > + max_cpus = NR_CPUS; Those check are not useful. smp_get_max_cpus will always return a number between 1 and NR_CPUS. You could even open code the function in setup.c. I.e cpus = smp_get_max_cpus(); printk(XENLOG_INFO "SMP: Allowing %u CPUs\n", cpus); nr_cpus_ids = cpus; > + > + printk(XENLOG_INFO "SMP: Allowing %u CPUs\n", max_cpus); > + nr_cpu_ids = max_cpus; > +} > + Regards, -- Julien Grall