linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64: move smp_send_stop() cpu mask off stack
@ 2025-06-20 11:10 Arnd Bergmann
  2025-06-20 11:24 ` Catalin Marinas
  2025-07-04 17:44 ` Will Deacon
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2025-06-20 11:10 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon
  Cc: Arnd Bergmann, Jonathan Cameron, Gavin Shan,
	Jean-Philippe Brucker, James Morse, Douglas Anderson,
	linux-arm-kernel, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

For really large values of CONFIG_NR_CPUS, a CPU mask value should
not be put on the stack:

arch/arm64/kernel/smp.c:1188:1: error: the frame size of 8544 bytes is larger than 1536 bytes [-Werror=frame-larger-than=]

This could be achieved using alloc_cpumask_var(), which makes it
depend on CONFIG_CPUMASK_OFFSTACK, but as this function is already
serialized and can only run on one CPU, making the variable 'static'
is easier.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm64/kernel/smp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
index 15987100c0cf..5c605dc7f5be 100644
--- a/arch/arm64/kernel/smp.c
+++ b/arch/arm64/kernel/smp.c
@@ -1107,7 +1107,7 @@ static inline unsigned int num_other_online_cpus(void)
 void smp_send_stop(void)
 {
 	static unsigned long stop_in_progress;
-	cpumask_t mask;
+	static cpumask_t mask;
 	unsigned long timeout;
 
 	/*
-- 
2.39.5



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

* Re: [PATCH] arm64: move smp_send_stop() cpu mask off stack
  2025-06-20 11:10 [PATCH] arm64: move smp_send_stop() cpu mask off stack Arnd Bergmann
@ 2025-06-20 11:24 ` Catalin Marinas
  2025-07-04 17:44 ` Will Deacon
  1 sibling, 0 replies; 3+ messages in thread
From: Catalin Marinas @ 2025-06-20 11:24 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Will Deacon, Arnd Bergmann, Jonathan Cameron, Gavin Shan,
	Jean-Philippe Brucker, James Morse, Douglas Anderson,
	linux-arm-kernel, linux-kernel

On Fri, Jun 20, 2025 at 01:10:41PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> For really large values of CONFIG_NR_CPUS, a CPU mask value should
> not be put on the stack:
> 
> arch/arm64/kernel/smp.c:1188:1: error: the frame size of 8544 bytes is larger than 1536 bytes [-Werror=frame-larger-than=]
> 
> This could be achieved using alloc_cpumask_var(), which makes it
> depend on CONFIG_CPUMASK_OFFSTACK, but as this function is already
> serialized and can only run on one CPU, making the variable 'static'
> is easier.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  arch/arm64/kernel/smp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
> index 15987100c0cf..5c605dc7f5be 100644
> --- a/arch/arm64/kernel/smp.c
> +++ b/arch/arm64/kernel/smp.c
> @@ -1107,7 +1107,7 @@ static inline unsigned int num_other_online_cpus(void)
>  void smp_send_stop(void)
>  {
>  	static unsigned long stop_in_progress;
> -	cpumask_t mask;
> +	static cpumask_t mask;
>  	unsigned long timeout;

This would work, there's a stop_in_progress check and only one CPU would
modify the mask.

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>


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

* Re: [PATCH] arm64: move smp_send_stop() cpu mask off stack
  2025-06-20 11:10 [PATCH] arm64: move smp_send_stop() cpu mask off stack Arnd Bergmann
  2025-06-20 11:24 ` Catalin Marinas
@ 2025-07-04 17:44 ` Will Deacon
  1 sibling, 0 replies; 3+ messages in thread
From: Will Deacon @ 2025-07-04 17:44 UTC (permalink / raw)
  To: Catalin Marinas, Arnd Bergmann
  Cc: kernel-team, Will Deacon, Arnd Bergmann, Jonathan Cameron,
	Gavin Shan, Jean-Philippe Brucker, James Morse, Douglas Anderson,
	linux-arm-kernel, linux-kernel

On Fri, 20 Jun 2025 13:10:41 +0200, Arnd Bergmann wrote:
> For really large values of CONFIG_NR_CPUS, a CPU mask value should
> not be put on the stack:
> 
> arch/arm64/kernel/smp.c:1188:1: error: the frame size of 8544 bytes is larger than 1536 bytes [-Werror=frame-larger-than=]
> 
> This could be achieved using alloc_cpumask_var(), which makes it
> depend on CONFIG_CPUMASK_OFFSTACK, but as this function is already
> serialized and can only run on one CPU, making the variable 'static'
> is easier.
> 
> [...]

Applied to arm64 (for-next/fixes), thanks!

[1/1] arm64: move smp_send_stop() cpu mask off stack
      https://git.kernel.org/arm64/c/6c66bb655ca3

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev


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

end of thread, other threads:[~2025-07-04 17:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-20 11:10 [PATCH] arm64: move smp_send_stop() cpu mask off stack Arnd Bergmann
2025-06-20 11:24 ` Catalin Marinas
2025-07-04 17:44 ` Will Deacon

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).