[PATCH] arm: fix handling of nr_cpus

Mark Salter msalter at redhat.com
Tue Oct 18 09:16:43 EDT 2011


On Thu, 2011-10-13 at 16:10 +0100, Russell King - ARM Linux wrote:
> I still wonder if doing this wouldn't be easier though - it results in
> a consistent message across all platforms, which is important if we're
> going to be checking against a user-passed value.
> 
>  arch/arm/mach-exynos4/platsmp.c  |   10 ++++------
>  arch/arm/mach-omap2/omap-smp.c   |   10 ++++------
>  arch/arm/mach-realview/platsmp.c |   10 ++++------
>  arch/arm/mach-tegra/platsmp.c    |    8 ++++----
>  arch/arm/mach-ux500/platsmp.c    |   10 ++++------
>  5 files changed, 20 insertions(+), 28 deletions(-)
> 
> diff --git a/arch/arm/mach-exynos4/platsmp.c
> b/arch/arm/mach-exynos4/platsmp.c
> index df6ef1b..7381f56 100644
> --- a/arch/arm/mach-exynos4/platsmp.c
> +++ b/arch/arm/mach-exynos4/platsmp.c
> @@ -193,12 +193,10 @@ void __init smp_init_cpus(void)
>         ncores = scu_base ? scu_get_core_count(scu_base) : 1;
>  
>         /* sanity check */
> -       if (ncores > NR_CPUS) {
> -               printk(KERN_WARNING
> -                      "EXYNOS4: no. of cores (%d) greater than configured "
> -                      "maximum of %d - clipping\n",
> -                      ncores, NR_CPUS);
> -               ncores = NR_CPUS;
> +       if (ncores > nr_cpu_ids) {
> +               pr_warn("EXYNOS4: %u cores greater than maximum (%u), clipping\n",
> +                       ncores, nr_cpu_ids);
> +               ncores = nr_cpu_ids;
>         }
>  
>         for (i = 0; i < ncores; i++)

...

That's fine by me. mach-msm, mach-shmobile, and mach-vexpress also need
patching. They currently don't clip against NR_CPUS.

--Mark





More information about the linux-arm-kernel mailing list