linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [4.7] arm64: Honor nosmp kernel command line option
@ 2016-07-21 10:15 Suzuki K Poulose
  2016-07-21 10:36 ` Mark Rutland
  2016-07-21 15:05 ` Catalin Marinas
  0 siblings, 2 replies; 3+ messages in thread
From: Suzuki K Poulose @ 2016-07-21 10:15 UTC (permalink / raw)
  To: linux-arm-kernel

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: commit 44dbcc93ab67145 ("arm64: Fix behavior of maxcpus=N")
Cc: Will Deacon <will.deacon@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: James Morse <james.morse@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
 arch/arm64/kernel/smp.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
index d242e81..ec08b7a 100644
--- a/arch/arm64/kernel/smp.c
+++ b/arch/arm64/kernel/smp.c
@@ -694,6 +694,13 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
 	smp_store_cpu_info(smp_processor_id());
 
 	/*
+	 * If UP is mandated by "nosmp"(implies maxcpus=0), don't bother about
+	 * secondary CPUs.
+	 */
+	if (max_cpus == 0)
+		return;
+
+	/*
 	 * Initialise the present map (which describes the set of CPUs
 	 * actually populated at the present time) and release the
 	 * secondaries from the bootloader.
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] [4.7] arm64: Honor nosmp kernel command line option
  2016-07-21 10:15 [PATCH] [4.7] arm64: Honor nosmp kernel command line option Suzuki K Poulose
@ 2016-07-21 10:36 ` Mark Rutland
  2016-07-21 15:05 ` Catalin Marinas
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Rutland @ 2016-07-21 10:36 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jul 21, 2016 at 11:15:27AM +0100, Suzuki K Poulose wrote:
> 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: commit 44dbcc93ab67145 ("arm64: Fix behavior of maxcpus=N")
> Cc: Will Deacon <will.deacon@arm.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: James Morse <james.morse@arm.com>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> ---
>  arch/arm64/kernel/smp.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
> index d242e81..ec08b7a 100644
> --- a/arch/arm64/kernel/smp.c
> +++ b/arch/arm64/kernel/smp.c
> @@ -694,6 +694,13 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
>  	smp_store_cpu_info(smp_processor_id());
>  
>  	/*
> +	 * If UP is mandated by "nosmp"(implies maxcpus=0), don't bother about

Nit: missing space between the quote abnd opening bracket. It would also
be nicer to have s/implies/which implies/

Otherwise:

Acked-by: Mark Rutland <mark.rutland@arm.com>

Mark.

> +	 * secondary CPUs.
> +	 */
> +	if (max_cpus == 0)
> +		return;
> +
> +	/*
>  	 * Initialise the present map (which describes the set of CPUs
>  	 * actually populated at the present time) and release the
>  	 * secondaries from the bootloader.
> -- 
> 2.7.4
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] [4.7] arm64: Honor nosmp kernel command line option
  2016-07-21 10:15 [PATCH] [4.7] arm64: Honor nosmp kernel command line option Suzuki K Poulose
  2016-07-21 10:36 ` Mark Rutland
@ 2016-07-21 15:05 ` Catalin Marinas
  1 sibling, 0 replies; 3+ messages in thread
From: Catalin Marinas @ 2016-07-21 15:05 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jul 21, 2016 at 11:15:27AM +0100, Suzuki K. Poulose wrote:
> 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: commit 44dbcc93ab67145 ("arm64: Fix behavior of maxcpus=N")
> Cc: Will Deacon <will.deacon@arm.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: James Morse <james.morse@arm.com>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>

Queued for 4.8, with Mark's comment and a cc stable for 4.7

-- 
Catalin

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-07-21 15:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-21 10:15 [PATCH] [4.7] arm64: Honor nosmp kernel command line option Suzuki K Poulose
2016-07-21 10:36 ` Mark Rutland
2016-07-21 15:05 ` Catalin Marinas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).