arm64: Honor nosmp kernel command line option
authorSuzuki K Poulose <[email protected]>
Thu, 21 Jul 2016 10:15:27 +0000 (11:15 +0100)
committerCatalin Marinas <[email protected]>
Thu, 21 Jul 2016 15:48:37 +0000 (16:48 +0100)
Passing "nosmp" should boot the kernel with a single processor, without
provision to enable secondary CPUs even if they are present. "nosmp" is
implemented by setting maxcpus=0. At the moment we still mark the secondary
CPUs present even with nosmp, which allows the userspace to bring them
up. This patch corrects the smp_prepare_cpus() to honor the maxcpus == 0.

Commit 44dbcc93ab67145 ("arm64: Fix behavior of maxcpus=N") fixed the
behavior for maxcpus >= 1, but broke maxcpus = 0.

Fixes: 44dbcc93ab67 ("arm64: Fix behavior of maxcpus=N")
Cc: <[email protected]> # 4.7+
Cc: Will Deacon <[email protected]>
Cc: James Morse <[email protected]>
Signed-off-by: Suzuki K Poulose <[email protected]>
Acked-by: Mark Rutland <[email protected]>
[[email protected]: updated code comment]
Signed-off-by: Catalin Marinas <[email protected]>
arch/arm64/kernel/smp.c

index 298dd745651eb125deeecbf0e763571c98940ff5..490db85dec23bdfd1226dad8194b65535b9b79e8 100644 (file)
@@ -692,6 +692,13 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
 
        smp_store_cpu_info(smp_processor_id());
 
+       /*
+        * If UP is mandated by "nosmp" (which implies "maxcpus=0"), don't set
+        * secondary CPUs present.
+        */
+       if (max_cpus == 0)
+               return;
+
        /*
         * Initialise the present map (which describes the set of CPUs
         * actually populated at the present time) and release the