Skip to contentSkip to conversation

arm64: move smp_send_stop() cpu mask off stack

PATCH Applied Arnd Bergmann 3 participants 3 messages Jun 20, 2025 – Jul 4, 2025 arm64

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: move smp_send_stop() cpu mask off stack

From: Arnd Bergmann <[email protected]>

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.

---
 arch/arm64/kernel/smp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/smp.c +1 -1
index 15987100c0cf..5c605dc7f5be 100644
@@ -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;
 
 	/*
Signature · 1 line
2.39.5
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 22 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

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.

---
 arch/arm64/kernel/smp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/smp.c +0 -0
index 15987100c0cf..5c605dc7f5be 100644

arch/arm64/kernel/smp.c static inline unsigned int num_other_online_cpus(void) · line 1111

Quoted 6 lines
arch/arm64/kernel/smp.c +1 -1
@@ -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.

maintainer Applied
#2 lore raw
In reply to Arnd Bergmann
Quoted 11 lines · Arnd Bergmann

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,

Signature · 5 lines
Will

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