Skip to contentSkip to conversation

cpu,sched: Mark arch_cpu_idle_dead() __noreturn

PATCH Applied Josh Poimboeuf 9 participants 86 messages Feb 14, 2023 – Mar 10, 2023

Subsystems (19)
Arm (32-bit) x86 PowerPC MIPS +15 more subsystems
lore
Share & tools
lore

Josh Poimboeuf

author maintainer
#0 lore raw

v2 cover cpu,sched: Mark arch_cpu_idle_dead() __noreturn

v2:
- make arch_call_rest_init() and rest_init() __noreturn
- make objtool 'global_returns' work for weak functions
- rebase on tip/objtool/core with dependencies merged in (mingo)
- add acks

v1.1:
- add __noreturn to all arch_cpu_idle_dead() implementations (mpe)

Josh Poimboeuf (24):
alpha/cpu: Expose arch_cpu_idle_dead()'s prototype declaration alpha/cpu: Make sure arch_cpu_idle_dead() doesn't return arm/cpu: Make sure arch_cpu_idle_dead() doesn't return arm64/cpu: Mark cpu_die() __noreturn
csky/cpu: Make sure arch_cpu_idle_dead() doesn't return ia64/cpu: Mark play_dead() __noreturn
loongarch/cpu: Make sure play_dead() doesn't return loongarch/cpu: Mark play_dead() __noreturn
mips/cpu: Expose play_dead()'s prototype definition mips/cpu: Make sure play_dead() doesn't return mips/cpu: Mark play_dead() __noreturn
powerpc/cpu: Mark start_secondary_resume() __noreturn sh/cpu: Make sure play_dead() doesn't return
sh/cpu: Mark play_dead() __noreturn
sh/cpu: Expose arch_cpu_idle_dead()'s prototype definition sparc/cpu: Mark cpu_play_dead() __noreturn
x86/cpu: Make sure play_dead() doesn't return
x86/cpu: Mark play_dead() __noreturn
xtensa/cpu: Make sure cpu_die() doesn't return xtensa/cpu: Mark cpu_die() __noreturn
sched/idle: Make sure weak version of arch_cpu_idle_dead() doesn't
return
objtool: Include weak functions in 'global_noreturns' check
init: Make arch_call_rest_init() and rest_init() __noreturn sched/idle: Mark arch_cpu_idle_dead() __noreturn

 arch/alpha/kernel/process.c      |  4 +++-
 arch/arm/kernel/smp.c            |  4 +++-
 arch/arm64/include/asm/smp.h     |  2 +-
 arch/arm64/kernel/process.c      |  2 +-
 arch/csky/kernel/smp.c           |  4 +++-
 arch/ia64/kernel/process.c       |  6 +++---
 arch/loongarch/include/asm/smp.h |  2 +-
 arch/loongarch/kernel/process.c  |  2 +-
 arch/loongarch/kernel/smp.c      |  2 +-
 arch/mips/include/asm/smp.h      |  2 +-
 arch/mips/kernel/process.c       |  2 +-
 arch/mips/kernel/smp-bmips.c     |  3 +++
 arch/mips/loongson64/smp.c       |  1 +
 arch/parisc/kernel/process.c     |  2 +-
 arch/powerpc/include/asm/smp.h   |  2 +-
 arch/powerpc/kernel/smp.c        |  2 +-
 arch/riscv/kernel/cpu-hotplug.c  |  2 +-
 arch/s390/kernel/idle.c          |  2 +-
 arch/s390/kernel/setup.c         |  2 +-
 arch/sh/include/asm/smp-ops.h    |  5 +++--
 arch/sh/kernel/idle.c            |  3 ++-
 arch/sparc/include/asm/smp_64.h  |  2 +-
 arch/sparc/kernel/process_64.c   |  2 +-
 arch/x86/include/asm/smp.h       |  3 ++-
 arch/x86/kernel/process.c        |  4 ++--
 arch/xtensa/include/asm/smp.h    |  2 +-
 arch/xtensa/kernel/smp.c         |  4 +++-
 include/linux/cpu.h              |  2 +-
 include/linux/start_kernel.h     |  4 ++--
 init/main.c                      |  4 ++--
 kernel/sched/idle.c              |  2 +-
 tools/objtool/check.c            | 11 +++++++----
 32 files changed, 57 insertions(+), 39 deletions(-)
Signature · 1 line
2.39.1
author maintainer
#1 lore raw

PATCH v2 1/24 alpha/cpu: Expose arch_cpu_idle_dead()'s prototype declaration

Include <linux/cpu.h> to make sure arch_cpu_idle_dead() matches its prototype going forward.

---
 arch/alpha/kernel/process.c | 1 +
 1 file changed, 1 insertion(+)
arch/alpha/kernel/process.c +1 -0
index ce20c31828a0..d1f2e8b6b107 100644
@@ -9,6 +9,7 @@
  * This file handles the architecture-dependent parts of process handling.
  */
 
+#include <linux/cpu.h>
 #include <linux/errno.h>
 #include <linux/module.h>
 #include <linux/sched.h>
Signature · 1 line
2.39.1
merge bot Applied
#2 lore raw

[tip: objtool/core] alpha/cpu: Expose arch_cpu_idle_dead()'s prototype declaration

The following commit has been merged into the objtool/core branch of tip:

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     1e8a0be5ed3aaa26dd77927df32bbd0df3449a1e
Gitweb:        https://git.kernel.org/tip/1e8a0be5ed3aaa26dd77927df32bbd0df3449a1e
Author:        Josh Poimboeuf <[email protected]>
AuthorDate:    Mon, 13 Feb 2023 23:05:35 -08:00
Committer:     Josh Poimboeuf <[email protected]>
CommitterDate: Mon, 06 Mar 2023 15:34:03 -08:00

alpha/cpu: Expose arch_cpu_idle_dead()'s prototype declaration

Include <linux/cpu.h> to make sure arch_cpu_idle_dead() matches its prototype going forward.

---
 arch/alpha/kernel/process.c | 1 +
 1 file changed, 1 insertion(+)
arch/alpha/kernel/process.c +1 -0
index e9cf719..3251102 100644
@@ -9,6 +9,7 @@
  * This file handles the architecture-dependent parts of process handling.
  */
 
+#include <linux/cpu.h>
 #include <linux/errno.h>
 #include <linux/module.h>
 #include <linux/sched.h>
author maintainer
#3 lore raw

PATCH v2 2/24 alpha/cpu: Make sure arch_cpu_idle_dead() doesn't return

In reply to Josh Poimboeuf

arch_cpu_idle_dead() doesn't return. Make that more explicit with a BUG().

BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next.

---
 arch/alpha/kernel/process.c | 1 +
 1 file changed, 1 insertion(+)
arch/alpha/kernel/process.c +1 -0
index d1f2e8b6b107..d0ff06eda8fa 100644
@@ -63,6 +63,7 @@ void arch_cpu_idle(void)
 void arch_cpu_idle_dead(void)
 {
 	wtint(INT_MAX);
+	BUG();
 }
 #endif /* ALPHA_WTINT */
 
Signature · 1 line
2.39.1
merge bot Applied
#4 lore raw

[tip: objtool/core] alpha/cpu: Make sure arch_cpu_idle_dead() doesn't return

The following commit has been merged into the objtool/core branch of tip:

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     550db6795e9bb0b1b40f9c52bbe3d0ee735dbdb0
Gitweb:        https://git.kernel.org/tip/550db6795e9bb0b1b40f9c52bbe3d0ee735dbdb0
Author:        Josh Poimboeuf <[email protected]>
AuthorDate:    Mon, 13 Feb 2023 23:05:36 -08:00
Committer:     Josh Poimboeuf <[email protected]>
CommitterDate: Mon, 06 Mar 2023 15:34:03 -08:00

alpha/cpu: Make sure arch_cpu_idle_dead() doesn't return

arch_cpu_idle_dead() doesn't return. Make that more explicit with a BUG().

BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next.

---
 arch/alpha/kernel/process.c | 1 +
 1 file changed, 1 insertion(+)
arch/alpha/kernel/process.c +1 -0
index 3251102..a82fefa 100644
@@ -63,6 +63,7 @@ void arch_cpu_idle(void)
 void arch_cpu_idle_dead(void)
 {
 	wtint(INT_MAX);
+	BUG();
 }
 #endif /* ALPHA_WTINT */
 
author maintainer
#5 lore raw

PATCH v2 3/24 arm/cpu: Make sure arch_cpu_idle_dead() doesn't return

In reply to Josh Poimboeuf

arch_cpu_idle_dead() doesn't return. Make that more explicit with a BUG().

BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next.

---
 arch/arm/kernel/smp.c | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/kernel/smp.c +2 -0
index 0b8c25763adc..adcd417c526b 100644
@@ -382,6 +382,8 @@ void arch_cpu_idle_dead(void)
 		: "r" (task_stack_page(current) + THREAD_SIZE - 8),
 		  "r" (current)
 		: "r0");
+
+	BUG();
 }
 #endif /* CONFIG_HOTPLUG_CPU */
 
Signature · 1 line
2.39.1
#6 lore raw

Re: [PATCH v2 03/24] arm/cpu: Make sure arch_cpu_idle_dead() doesn't return

Quoted 6 lines · Josh Poimboeuf

arch_cpu_idle_dead() doesn't return. Make that more explicit with a BUG().

BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next.

This is silly. Just mark the function __noreturn and be done with it. If the CPU ever executes code past the "b" instruction, it's already really broken that the extra instructions that BUG() gives will be meaningless.

This patch does nothing except add yet more bloat the kernel.

Sorry, but NAK.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
author maintainer
#7 lore raw

Re: [PATCH v2 03/24] arm/cpu: Make sure arch_cpu_idle_dead() doesn't return

Quoted 8 lines · Russell King (Oracle)
Quoted 6 lines · Josh Poimboeuf

arch_cpu_idle_dead() doesn't return. Make that more explicit with a BUG().

BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next.

Quoted 8 lines

This is silly. Just mark the function __noreturn and be done with it. If the CPU ever executes code past the "b" instruction, it's already really broken that the extra instructions that BUG() gives will be meaningless.

This patch does nothing except add yet more bloat the kernel.

Sorry, but NAK.

Problem is, the compiler can't read inline asm. So you'd get a "'noreturn' function does return" warning.

We can do an unreachable() instead of a BUG() here if you prefer undefined behavior.

Signature · 1 line
Josh
#8 lore raw

Re: [PATCH v2 03/24] arm/cpu: Make sure arch_cpu_idle_dead() doesn't return

Quoted 16 lines · Josh Poimboeuf
Quoted 15 lines · Russell King (Oracle)
Quoted 6 lines · Josh Poimboeuf

arch_cpu_idle_dead() doesn't return. Make that more explicit with a BUG().

BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next.

This is silly. Just mark the function __noreturn and be done with it. If the CPU ever executes code past the "b" instruction, it's already really broken that the extra instructions that BUG() gives will be meaningless.

This patch does nothing except add yet more bloat the kernel.

Quoted 7 lines
Quoted 1 line

Sorry, but NAK.

Problem is, the compiler can't read inline asm. So you'd get a "'noreturn' function does return" warning.

We can do an unreachable() instead of a BUG() here if you prefer undefined behavior.

That's fine.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
author maintainer
#9 lore raw

PATCH v2 3/24 arm/cpu: Add unreachable() to arch_cpu_idle_dead()

arch_cpu_idle_dead() doesn't return. Make that visible to the compiler with an unreachable() code annotation.

---
 arch/arm/kernel/smp.c | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/kernel/smp.c +2 -0
index 0b8c25763adc..441ea5cff390 100644
@@ -382,6 +382,8 @@ void arch_cpu_idle_dead(void)
 		: "r" (task_stack_page(current) + THREAD_SIZE - 8),
 		  "r" (current)
 		: "r0");
+
+	unreachable();
 }
 #endif /* CONFIG_HOTPLUG_CPU */
 
Signature · 1 line
2.39.1
merge bot Applied
#10 lore raw

[tip: objtool/core] arm/cpu: Add unreachable() to arch_cpu_idle_dead()

The following commit has been merged into the objtool/core branch of tip:

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     b40c7d6d31ac2f6b78371cdc08bc1b6b62f01375
Gitweb:        https://git.kernel.org/tip/b40c7d6d31ac2f6b78371cdc08bc1b6b62f01375
Author:        Josh Poimboeuf <[email protected]>
AuthorDate:    Thu, 16 Feb 2023 10:38:55 -08:00
Committer:     Josh Poimboeuf <[email protected]>
CommitterDate: Mon, 06 Mar 2023 15:34:04 -08:00

arm/cpu: Add unreachable() to arch_cpu_idle_dead()

arch_cpu_idle_dead() doesn't return. Make that visible to the compiler with an unreachable() code annotation.

---
 arch/arm/kernel/smp.c | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/kernel/smp.c +2 -0
index 0b8c257..441ea5c 100644
@@ -382,6 +382,8 @@ void arch_cpu_idle_dead(void)
 		: "r" (task_stack_page(current) + THREAD_SIZE - 8),
 		  "r" (current)
 		: "r0");
+
+	unreachable();
 }
 #endif /* CONFIG_HOTPLUG_CPU */
 
author maintainer
#11 lore raw

PATCH v2 4/24 arm64/cpu: Mark cpu_die() __noreturn

In reply to Josh Poimboeuf

cpu_die() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn.

---
 arch/arm64/include/asm/smp.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/include/asm/smp.h +1 -1
index fc55f5a57a06..5733a31bab08 100644
@@ -100,7 +100,7 @@ static inline void arch_send_wakeup_ipi_mask(const struct cpumask *mask)
 extern int __cpu_disable(void);
 
 extern void __cpu_die(unsigned int cpu);
-extern void cpu_die(void);
+extern void __noreturn cpu_die(void);
 extern void cpu_die_early(void);
 
 static inline void cpu_park_loop(void)
Signature · 1 line
2.39.1
#12 lore raw

Re: [PATCH v2 04/24] arm64/cpu: Mark cpu_die() __noreturn

Quoted 13 lines · Josh Poimboeuf

cpu_die() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn.

---
  arch/arm64/include/asm/smp.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/include/asm/smp.h +0 -0
index fc55f5a57a06..5733a31bab08 100644

arch/arm64/include/asm/smp.h static inline void arch_send_wakeup_ipi_mask(const struct cpumask *mask) · line 104

Quoted 6 lines
arch/arm64/include/asm/smp.h +1 -1
@@ -100,7 +100,7 @@ static inline void arch_send_wakeup_ipi_mask(const struct cpumask *mask)
  extern int __cpu_disable(void);
 
  extern void __cpu_die(unsigned int cpu);
-extern void cpu_die(void);
+extern void __noreturn cpu_die(void);
  extern void cpu_die_early(void);

Shouldn't cpu_operations::cpu_die() be declared noreturn first?

reviewer Acked-by
#13 lore raw

Re: [PATCH v2 04/24] arm64/cpu: Mark cpu_die() __noreturn

Quoted 9 lines · Philippe Mathieu-Daudé
Quoted 8 lines · Josh Poimboeuf

cpu_die() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn.

---
  arch/arm64/include/asm/smp.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines

arch/arm64/include/asm/smp.h static inline void arch_send_wakeup_ipi_mask(const struct cpumask *mask) · line 103

Quoted 10 lines
arch/arm64/include/asm/smp.h +1 -1
index fc55f5a57a06..5733a31bab08 100644
@@ -100,7 +100,7 @@ static inline void arch_send_wakeup_ipi_mask(const struct cpumask *mask)
  extern int __cpu_disable(void);
  extern void __cpu_die(unsigned int cpu);
-extern void cpu_die(void);
+extern void __noreturn cpu_die(void);
  extern void cpu_die_early(void);

Shouldn't cpu_operations::cpu_die() be declared noreturn first?

The cpu_die() function ends with a BUG(), and so does not return, even if a cpu_operations::cpu_die() function that it calls erroneously returned.

We *could* mark cpu_operations::cpu_die() as noreturn, but I'd prefer that we did not so that the compiler doesn't optimize away the BUG() which is there to catch such erroneous returns.

That said, could we please add __noreturn to the implementation of cpu_die() in arch/arm64/kernel/smp.c? i.e. the fixup below.

With that fixup:

Mark.

---->8----

arch/arm64/kernel/smp.c +1 -1
index ffc5d76cf695..a98a76f7c1c6 100644
@@ -361,7 +361,7 @@ void __cpu_die(unsigned int cpu)
  * Called from the idle thread for the CPU which has been shutdown.
  *
  */
-void cpu_die(void)
+void __noreturn cpu_die(void)
 {
        unsigned int cpu = smp_processor_id();
        const struct cpu_operations *ops = get_cpu_ops(cpu);
author maintainer
#14 lore raw

Re: [PATCH v2 04/24] arm64/cpu: Mark cpu_die() __noreturn

Quoted 26 lines · Mark Rutland
Quoted 9 lines · Philippe Mathieu-Daudé
Quoted 8 lines · Josh Poimboeuf

cpu_die() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn.

---
  arch/arm64/include/asm/smp.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines

arch/arm64/include/asm/smp.h static inline void arch_send_wakeup_ipi_mask(const struct cpumask *mask) · line 103

Quoted 10 lines
arch/arm64/include/asm/smp.h +1 -1
index fc55f5a57a06..5733a31bab08 100644
@@ -100,7 +100,7 @@ static inline void arch_send_wakeup_ipi_mask(const struct cpumask *mask)
  extern int __cpu_disable(void);
  extern void __cpu_die(unsigned int cpu);
-extern void cpu_die(void);
+extern void __noreturn cpu_die(void);
  extern void cpu_die_early(void);

Shouldn't cpu_operations::cpu_die() be declared noreturn first?

The cpu_die() function ends with a BUG(), and so does not return, even if a cpu_operations::cpu_die() function that it calls erroneously returned.

Quoted 6 lines

We *could* mark cpu_operations::cpu_die() as noreturn, but I'd prefer that we did not so that the compiler doesn't optimize away the BUG() which is there to catch such erroneous returns.

That said, could we please add __noreturn to the implementation of cpu_die() in arch/arm64/kernel/smp.c? i.e. the fixup below.

Done.

Quoted 3 lines

With that fixup:

Thanks!

Signature · 1 line
Josh
author maintainer
#15 lore raw

PATCH v2 4/24 arm64/cpu: Mark cpu_die() __noreturn

cpu_die() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn.

---
 arch/arm64/include/asm/smp.h | 2 +-
 arch/arm64/kernel/smp.c      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm64/include/asm/smp.h +1 -1
index fc55f5a57a06..5733a31bab08 100644
@@ -100,7 +100,7 @@ static inline void arch_send_wakeup_ipi_mask(const struct cpumask *mask)
 extern int __cpu_disable(void);
 
 extern void __cpu_die(unsigned int cpu);
-extern void cpu_die(void);
+extern void __noreturn cpu_die(void);
 extern void cpu_die_early(void);
 
 static inline void cpu_park_loop(void)
arch/arm64/kernel/smp.c +1 -1
index 4e8327264255..d5d09a18b4f8 100644
@@ -361,7 +361,7 @@ void __cpu_die(unsigned int cpu)
  * Called from the idle thread for the CPU which has been shutdown.
  *
  */
-void cpu_die(void)
+void __noreturn cpu_die(void)
 {
 	unsigned int cpu = smp_processor_id();
 	const struct cpu_operations *ops = get_cpu_ops(cpu);
Signature · 1 line
2.39.1
Reviewed-by on v2 4/24
#16 lore raw

Re: [PATCH v2.1 04/24] arm64/cpu: Mark cpu_die() __noreturn

Quoted 9 lines · Josh Poimboeuf

cpu_die() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn.

---
  arch/arm64/include/asm/smp.h | 2 +-
  arch/arm64/kernel/smp.c      | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
merge bot Applied
#17 lore raw

[tip: objtool/core] arm64/cpu: Mark cpu_die() __noreturn

In reply to Josh Poimboeuf
The following commit has been merged into the objtool/core branch of tip:

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     9bdc61ef27db5eaac48f1cc5deb8224603e79c89
Gitweb:        https://git.kernel.org/tip/9bdc61ef27db5eaac48f1cc5deb8224603e79c89
Author:        Josh Poimboeuf <[email protected]>
AuthorDate:    Thu, 16 Feb 2023 10:42:01 -08:00
Committer:     Josh Poimboeuf <[email protected]>
CommitterDate: Mon, 06 Mar 2023 15:34:04 -08:00

arm64/cpu: Mark cpu_die() __noreturn

cpu_die() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn.

---
 arch/arm64/include/asm/smp.h | 2 +-
 arch/arm64/kernel/smp.c      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm64/include/asm/smp.h +1 -1
index fc55f5a..5733a31 100644
@@ -100,7 +100,7 @@ static inline void arch_send_wakeup_ipi_mask(const struct cpumask *mask)
 extern int __cpu_disable(void);
 
 extern void __cpu_die(unsigned int cpu);
-extern void cpu_die(void);
+extern void __noreturn cpu_die(void);
 extern void cpu_die_early(void);
 
 static inline void cpu_park_loop(void)
arch/arm64/kernel/smp.c +1 -1
index 4e83272..d5d09a1 100644
@@ -361,7 +361,7 @@ void __cpu_die(unsigned int cpu)
  * Called from the idle thread for the CPU which has been shutdown.
  *
  */
-void cpu_die(void)
+void __noreturn cpu_die(void)
 {
 	unsigned int cpu = smp_processor_id();
 	const struct cpu_operations *ops = get_cpu_ops(cpu);
author maintainer
#18 lore raw

PATCH v2 5/24 csky/cpu: Make sure arch_cpu_idle_dead() doesn't return

In reply to Josh Poimboeuf

arch_cpu_idle_dead() doesn't return. Make that more explicit with a BUG().

BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next.

---
 arch/csky/kernel/smp.c | 2 ++
 1 file changed, 2 insertions(+)
arch/csky/kernel/smp.c +2 -0
index b45d1073307f..0ec20efaf5fd 100644
@@ -317,5 +317,7 @@ void arch_cpu_idle_dead(void)
 		"jmpi	csky_start_secondary"
 		:
 		: "r" (secondary_stack));
+
+	BUG();
 }
 #endif
Signature · 1 line
2.39.1
merge bot Applied
#19 lore raw

[tip: objtool/core] csky/cpu: Make sure arch_cpu_idle_dead() doesn't return

The following commit has been merged into the objtool/core branch of tip:

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     1b2442a835a0acc7d76ae2f48ca7a94f962b29c8
Gitweb:        https://git.kernel.org/tip/1b2442a835a0acc7d76ae2f48ca7a94f962b29c8
Author:        Josh Poimboeuf <[email protected]>
AuthorDate:    Mon, 13 Feb 2023 23:05:39 -08:00
Committer:     Josh Poimboeuf <[email protected]>
CommitterDate: Mon, 06 Mar 2023 15:34:05 -08:00

csky/cpu: Make sure arch_cpu_idle_dead() doesn't return

arch_cpu_idle_dead() doesn't return. Make that more explicit with a BUG().

BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next.

---
 arch/csky/kernel/smp.c | 2 ++
 1 file changed, 2 insertions(+)
arch/csky/kernel/smp.c +2 -0
index b45d107..0ec20ef 100644
@@ -317,5 +317,7 @@ void arch_cpu_idle_dead(void)
 		"jmpi	csky_start_secondary"
 		:
 		: "r" (secondary_stack));
+
+	BUG();
 }
 #endif
author maintainer
#20 lore raw

PATCH v2 6/24 ia64/cpu: Mark play_dead() __noreturn

In reply to Josh Poimboeuf

play_dead() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn.

---
 arch/ia64/kernel/process.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/ia64/kernel/process.c +2 -2
index f6195a0a00ae..78f5794b2dde 100644
@@ -201,7 +201,7 @@ __setup("nohalt", nohalt_setup);
 
 #ifdef CONFIG_HOTPLUG_CPU
 /* We don't actually take CPU down, just spin without interrupts. */
-static inline void play_dead(void)
+static inline void __noreturn play_dead(void)
 {
 	unsigned int this_cpu = smp_processor_id();
 
@@ -219,7 +219,7 @@ static inline void play_dead(void)
 	BUG();
 }
 #else
-static inline void play_dead(void)
+static inline void __noreturn play_dead(void)
 {
 	BUG();
 }
Signature · 1 line
2.39.1
merge bot Applied
#22 lore raw

[tip: objtool/core] ia64/cpu: Mark play_dead() __noreturn

In reply to Josh Poimboeuf
The following commit has been merged into the objtool/core branch of tip:

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     93c0edffbc92abe1efb8c7081df0cc1577a79ace
Gitweb:        https://git.kernel.org/tip/93c0edffbc92abe1efb8c7081df0cc1577a79ace
Author:        Josh Poimboeuf <[email protected]>
AuthorDate:    Mon, 13 Feb 2023 23:05:40 -08:00
Committer:     Josh Poimboeuf <[email protected]>
CommitterDate: Mon, 06 Mar 2023 15:34:05 -08:00

ia64/cpu: Mark play_dead() __noreturn

play_dead() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn.

---
 arch/ia64/kernel/process.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/ia64/kernel/process.c +2 -2
index f6195a0..78f5794 100644
@@ -201,7 +201,7 @@ __setup("nohalt", nohalt_setup);
 
 #ifdef CONFIG_HOTPLUG_CPU
 /* We don't actually take CPU down, just spin without interrupts. */
-static inline void play_dead(void)
+static inline void __noreturn play_dead(void)
 {
 	unsigned int this_cpu = smp_processor_id();
 
@@ -219,7 +219,7 @@ static inline void play_dead(void)
 	BUG();
 }
 #else
-static inline void play_dead(void)
+static inline void __noreturn play_dead(void)
 {
 	BUG();
 }
author maintainer
#23 lore raw

PATCH v2 7/24 loongarch/cpu: Make sure play_dead() doesn't return

In reply to Josh Poimboeuf

play_dead() doesn't return. Make that more explicit with a BUG().

BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next.

---
 arch/loongarch/kernel/smp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/loongarch/kernel/smp.c +1 -1
index 8c6e227cb29d..51f328169a7b 100644
@@ -336,7 +336,7 @@ void play_dead(void)
 	iocsr_write32(0xffffffff, LOONGARCH_IOCSR_IPI_CLEAR);
 
 	init_fn();
-	unreachable();
+	BUG();
 }
 
 #endif
Signature · 1 line
2.39.1
merge bot Applied
#24 lore raw

[tip: objtool/core] loongarch/cpu: Make sure play_dead() doesn't return

The following commit has been merged into the objtool/core branch of tip:

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     13bf7923a4dd34f3d2681768a148b10ddbdb95ed
Gitweb:        https://git.kernel.org/tip/13bf7923a4dd34f3d2681768a148b10ddbdb95ed
Author:        Josh Poimboeuf <[email protected]>
AuthorDate:    Mon, 13 Feb 2023 23:05:41 -08:00
Committer:     Josh Poimboeuf <[email protected]>
CommitterDate: Mon, 06 Mar 2023 15:34:06 -08:00

loongarch/cpu: Make sure play_dead() doesn't return

play_dead() doesn't return. Make that more explicit with a BUG().

BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next.

---
 arch/loongarch/kernel/smp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/loongarch/kernel/smp.c +1 -1
index 8c6e227..51f3281 100644
@@ -336,7 +336,7 @@ void play_dead(void)
 	iocsr_write32(0xffffffff, LOONGARCH_IOCSR_IPI_CLEAR);
 
 	init_fn();
-	unreachable();
+	BUG();
 }
 
 #endif
author maintainer
#25 lore raw

PATCH v2 8/24 loongarch/cpu: Mark play_dead() __noreturn

In reply to Josh Poimboeuf

play_dead() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn.

---
 arch/loongarch/include/asm/smp.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/loongarch/include/asm/smp.h +1 -1
index d82687390b4a..416b653bccb4 100644
@@ -99,7 +99,7 @@ static inline void __cpu_die(unsigned int cpu)
 	loongson_cpu_die(cpu);
 }
 
-extern void play_dead(void);
+extern void __noreturn play_dead(void);
 #endif
 
 #endif /* __ASM_SMP_H */
Signature · 1 line
2.39.1
merge bot Applied
#27 lore raw

[tip: objtool/core] loongarch/cpu: Mark play_dead() __noreturn

In reply to Josh Poimboeuf
The following commit has been merged into the objtool/core branch of tip:

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     6c0f2d071eded22cb72413e0abfaa5b3373b4d96
Gitweb:        https://git.kernel.org/tip/6c0f2d071eded22cb72413e0abfaa5b3373b4d96
Author:        Josh Poimboeuf <[email protected]>
AuthorDate:    Mon, 13 Feb 2023 23:05:42 -08:00
Committer:     Josh Poimboeuf <[email protected]>
CommitterDate: Mon, 06 Mar 2023 15:34:06 -08:00

loongarch/cpu: Mark play_dead() __noreturn

play_dead() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn.

---
 arch/loongarch/include/asm/smp.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/loongarch/include/asm/smp.h +1 -1
index d826873..416b653 100644
@@ -99,7 +99,7 @@ static inline void __cpu_die(unsigned int cpu)
 	loongson_cpu_die(cpu);
 }
 
-extern void play_dead(void);
+extern void __noreturn play_dead(void);
 #endif
 
 #endif /* __ASM_SMP_H */
author maintainer
#28 lore raw

PATCH v2 9/24 mips/cpu: Expose play_dead()'s prototype definition

In reply to Josh Poimboeuf

Include <asm/smp.h> to make sure play_dead() matches its prototype going forward.

---
 arch/mips/kernel/smp-bmips.c | 1 +
 1 file changed, 1 insertion(+)
arch/mips/kernel/smp-bmips.c +1 -0
index f5d7bfa3472a..df9158e8329d 100644
@@ -38,6 +38,7 @@
 #include <asm/traps.h>
 #include <asm/barrier.h>
 #include <asm/cpu-features.h>
+#include <asm/smp.h>
 
 static int __maybe_unused max_cpus = 1;
 
Signature · 1 line
2.39.1
#29 lore raw

Re: [PATCH v2 09/24] mips/cpu: Expose play_dead()'s prototype definition

Hi Josh,

Quoted 14 lines · Josh Poimboeuf

Include <asm/smp.h> to make sure play_dead() matches its prototype going forward.

---
  arch/mips/kernel/smp-bmips.c | 1 +
  1 file changed, 1 insertion(+)
arch/mips/kernel/smp-bmips.c +0 -0
index f5d7bfa3472a..df9158e8329d 100644

arch/mips/kernel/smp-bmips.c line 41

Quoted 4 lines
arch/mips/kernel/smp-bmips.c +1 -0
@@ -38,6 +38,7 @@
  #include <asm/traps.h>
  #include <asm/barrier.h>
  #include <asm/cpu-features.h>
+#include <asm/smp.h>

What about the other implementations?

$ git grep -L asm/smp.h $(git grep -wlF 'play_dead(void)' arch/mips)
arch/mips/cavium-octeon/smp.c
arch/mips/kernel/smp-bmips.c
arch/mips/kernel/smp-cps.c
arch/mips/loongson64/smp.c
author maintainer
#30 lore raw

Re: [PATCH v2 09/24] mips/cpu: Expose play_dead()'s prototype definition

Quoted 24 lines · Philippe Mathieu-Daudé

Hi Josh,

Quoted 14 lines · Josh Poimboeuf

Include <asm/smp.h> to make sure play_dead() matches its prototype going forward.

---
  arch/mips/kernel/smp-bmips.c | 1 +
  1 file changed, 1 insertion(+)
arch/mips/kernel/smp-bmips.c +0 -0
index f5d7bfa3472a..df9158e8329d 100644

arch/mips/kernel/smp-bmips.c line 41

Quoted 4 lines
arch/mips/kernel/smp-bmips.c +1 -0
@@ -38,6 +38,7 @@
  #include <asm/traps.h>
  #include <asm/barrier.h>
  #include <asm/cpu-features.h>
+#include <asm/smp.h>

What about the other implementations?

Quoted 5 lines
$ git grep -L asm/smp.h $(git grep -wlF 'play_dead(void)' arch/mips)
arch/mips/cavium-octeon/smp.c
arch/mips/kernel/smp-bmips.c
arch/mips/kernel/smp-cps.c
arch/mips/loongson64/smp.c

Indeed. I really wish we had -Wmissing-prototypes.

I'll squash this in:

arch/mips/cavium-octeon/smp.c +1 -0
index 89954f5f87fb..4212584e6efa 100644
@@ -20,6 +20,7 @@
 #include <asm/mmu_context.h>
 #include <asm/time.h>
 #include <asm/setup.h>
+#include <asm/smp.h>
 
 #include <asm/octeon/octeon.h>
 
arch/mips/kernel/smp-cps.c +1 -0
index bcd6a944b839..6d69a9ba8167 100644
@@ -20,6 +20,7 @@
 #include <asm/mipsregs.h>
 #include <asm/pm-cps.h>
 #include <asm/r4kcache.h>
+#include <asm/smp.h>
 #include <asm/smp-cps.h>
 #include <asm/time.h>
 #include <asm/uasm.h>
arch/mips/loongson64/smp.c +1 -0
index c81c2bd07c62..df8d789ede3c 100644
@@ -14,6 +14,7 @@
 #include <linux/cpufreq.h>
 #include <linux/kexec.h>
 #include <asm/processor.h>
+#include <asm/smp.h>
 #include <asm/time.h>
 #include <asm/tlbflush.h>
 #include <asm/cacheflush.h>
#31 lore raw

Re: [PATCH v2 09/24] mips/cpu: Expose play_dead()'s prototype definition

Quoted 64 lines · Josh Poimboeuf
Quoted 24 lines · Philippe Mathieu-Daudé

Hi Josh,

Quoted 14 lines · Josh Poimboeuf

Include <asm/smp.h> to make sure play_dead() matches its prototype going forward.

---
   arch/mips/kernel/smp-bmips.c | 1 +
   1 file changed, 1 insertion(+)
arch/mips/kernel/smp-bmips.c +0 -0
index f5d7bfa3472a..df9158e8329d 100644

arch/mips/kernel/smp-bmips.c line 41

Quoted 4 lines
arch/mips/kernel/smp-bmips.c +1 -0
@@ -38,6 +38,7 @@
   #include <asm/traps.h>
   #include <asm/barrier.h>
   #include <asm/cpu-features.h>
+#include <asm/smp.h>

What about the other implementations?

Quoted 5 lines
$ git grep -L asm/smp.h $(git grep -wlF 'play_dead(void)' arch/mips)
arch/mips/cavium-octeon/smp.c
arch/mips/kernel/smp-bmips.c
arch/mips/kernel/smp-cps.c
arch/mips/loongson64/smp.c

Indeed. I really wish we had -Wmissing-prototypes.

I'll squash this in:

arch/mips/cavium-octeon/smp.c +1 -0
index 89954f5f87fb..4212584e6efa 100644
@@ -20,6 +20,7 @@
  #include <asm/mmu_context.h>
  #include <asm/time.h>
  #include <asm/setup.h>
+#include <asm/smp.h>
 
  #include <asm/octeon/octeon.h>
 
arch/mips/kernel/smp-cps.c +1 -0
index bcd6a944b839..6d69a9ba8167 100644
@@ -20,6 +20,7 @@
  #include <asm/mipsregs.h>
  #include <asm/pm-cps.h>
  #include <asm/r4kcache.h>
+#include <asm/smp.h>
  #include <asm/smp-cps.h>
  #include <asm/time.h>
  #include <asm/uasm.h>
arch/mips/loongson64/smp.c +0 -0
index c81c2bd07c62..df8d789ede3c 100644

arch/mips/loongson64/smp.c line 20

Quoted 7 lines
arch/mips/loongson64/smp.c +1 -0
@@ -14,6 +14,7 @@
  #include <linux/cpufreq.h>
  #include <linux/kexec.h>
  #include <asm/processor.h>
+#include <asm/smp.h>
  #include <asm/time.h>
  #include <asm/tlbflush.h>
  #include <asm/cacheflush.h>

Thanks.

author maintainer
#32 lore raw

PATCH v2 9/24 mips/cpu: Expose play_dead()'s prototype definition

Include <asm/smp.h> to make sure play_dead() matches its prototype going forward.

---
 arch/mips/cavium-octeon/smp.c | 1 +
 arch/mips/kernel/smp-bmips.c  | 1 +
 arch/mips/kernel/smp-cps.c    | 1 +
 arch/mips/loongson64/smp.c    | 1 +
 4 files changed, 4 insertions(+)
arch/mips/cavium-octeon/smp.c +1 -0
index 89954f5f87fb..4212584e6efa 100644
@@ -20,6 +20,7 @@
 #include <asm/mmu_context.h>
 #include <asm/time.h>
 #include <asm/setup.h>
+#include <asm/smp.h>
 
 #include <asm/octeon/octeon.h>
 
arch/mips/kernel/smp-bmips.c +1 -0
index f5d7bfa3472a..df9158e8329d 100644
@@ -38,6 +38,7 @@
 #include <asm/traps.h>
 #include <asm/barrier.h>
 #include <asm/cpu-features.h>
+#include <asm/smp.h>
 
 static int __maybe_unused max_cpus = 1;
 
arch/mips/kernel/smp-cps.c +1 -0
index bcd6a944b839..6d69a9ba8167 100644
@@ -20,6 +20,7 @@
 #include <asm/mipsregs.h>
 #include <asm/pm-cps.h>
 #include <asm/r4kcache.h>
+#include <asm/smp.h>
 #include <asm/smp-cps.h>
 #include <asm/time.h>
 #include <asm/uasm.h>
arch/mips/loongson64/smp.c +1 -0
index 660e1de4412a..4e24b317e7cb 100644
@@ -14,6 +14,7 @@
 #include <linux/cpufreq.h>
 #include <linux/kexec.h>
 #include <asm/processor.h>
+#include <asm/smp.h>
 #include <asm/time.h>
 #include <asm/tlbflush.h>
 #include <asm/cacheflush.h>
Signature · 1 line
2.39.1
author maintainer
#33 lore raw

Re: [PATCH v2.1 09/24] mips/cpu: Expose play_dead()'s prototype definition

Quoted 6 lines · Josh Poimboeuf

Include <asm/smp.h> to make sure play_dead() matches its prototype going forward.

The latest version of this patch triggered a new kbuild warning which is fixed by the below patch. If there are no objections I'll bundle it in with the rest of the set for merging.

---8<---

Subject: [PATCH] mips/smp: Add CONFIG_SMP guard for raw_smp_processor_id()
Content-type: text/plain

Without CONFIG_SMP, raw_smp_processor_id() is not expected to be defined by the arch.

---
 arch/mips/include/asm/smp.h | 2 ++
 1 file changed, 2 insertions(+)
arch/mips/include/asm/smp.h +2 -0
index 4eee29b7845c..cf992b8b1e46 100644
@@ -25,6 +25,7 @@ extern cpumask_t cpu_sibling_map[];
 extern cpumask_t cpu_core_map[];
 extern cpumask_t cpu_foreign_map[];
 
+#ifdef CONFIG_SMP
 static inline int raw_smp_processor_id(void)
 {
 #if defined(__VDSO__)
@@ -36,6 +37,7 @@ static inline int raw_smp_processor_id(void)
 #endif
 }
 #define raw_smp_processor_id raw_smp_processor_id
+#endif
 
 /* Map from cpu id to sequential logical cpu number.  This will only
    not be idempotent when cpus failed to come on-line.	*/
Signature · 1 line
2.39.1
#34 lore raw

Re: [PATCH v2.1 09/24] mips/cpu: Expose play_dead()'s prototype definition

Quoted 32 lines · Josh Poimboeuf

The latest version of this patch triggered a new kbuild warning which is fixed by the below patch. If there are no objections I'll bundle it in with the rest of the set for merging.

---8<---

Subject: [PATCH] mips/smp: Add CONFIG_SMP guard for raw_smp_processor_id()
Content-type: text/plain

Without CONFIG_SMP, raw_smp_processor_id() is not expected to be defined by the arch.

---
  arch/mips/include/asm/smp.h | 2 ++
  1 file changed, 2 insertions(+)
arch/mips/include/asm/smp.h +1 -0
index 4eee29b7845c..cf992b8b1e46 100644
@@ -25,6 +25,7 @@ extern cpumask_t cpu_sibling_map[];
  extern cpumask_t cpu_core_map[];
  extern cpumask_t cpu_foreign_map[];
 
+#ifdef CONFIG_SMP
  static inline int raw_smp_processor_id(void)
  {
  #if defined(__VDSO__)

arch/mips/include/asm/smp.h static inline int raw_smp_processor_id(void) · line 43

Quoted 7 lines
arch/mips/include/asm/smp.h +1 -0
@@ -36,6 +37,7 @@ static inline int raw_smp_processor_id(void)
  #endif
  }
  #define raw_smp_processor_id raw_smp_processor_id
+#endif
 
  /* Map from cpu id to sequential logical cpu number.  This will only
     not be idempotent when cpus failed to come on-line.	*/
merge bot Applied
#35 lore raw

[tip: objtool/core] mips/cpu: Expose play_dead()'s prototype definition

In reply to Josh Poimboeuf
The following commit has been merged into the objtool/core branch of tip:

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     142dbcf3b6a93ecfe8ccbee60c611175f5459c23
Gitweb:        https://git.kernel.org/tip/142dbcf3b6a93ecfe8ccbee60c611175f5459c23
Author:        Josh Poimboeuf <[email protected]>
AuthorDate:    Thu, 16 Feb 2023 10:42:52 -08:00
Committer:     Josh Poimboeuf <[email protected]>
CommitterDate: Wed, 08 Mar 2023 08:44:19 -08:00

mips/cpu: Expose play_dead()'s prototype definition

Include <asm/smp.h> to make sure play_dead() matches its prototype going forward.

---
 arch/mips/cavium-octeon/smp.c | 1 +
 arch/mips/kernel/smp-bmips.c  | 2 ++
 arch/mips/kernel/smp-cps.c    | 1 +
 arch/mips/loongson64/smp.c    | 1 +
 4 files changed, 5 insertions(+)
arch/mips/cavium-octeon/smp.c +1 -0
index 89954f5..4212584 100644
@@ -20,6 +20,7 @@
 #include <asm/mmu_context.h>
 #include <asm/time.h>
 #include <asm/setup.h>
+#include <asm/smp.h>
 
 #include <asm/octeon/octeon.h>
 
arch/mips/kernel/smp-bmips.c +2 -0
index f5d7bfa..51d5dae 100644
@@ -54,6 +54,8 @@ static void bmips_set_reset_vec(int cpu, u32 val);
 
 #ifdef CONFIG_SMP
 
+#include <asm/smp.h>
+
 /* initial $sp, $gp - used by arch/mips/kernel/bmips_vec.S */
 unsigned long bmips_smp_boot_sp;
 unsigned long bmips_smp_boot_gp;
arch/mips/kernel/smp-cps.c +1 -0
index 4fc288b..00a0e25 100644
@@ -20,6 +20,7 @@
 #include <asm/mipsregs.h>
 #include <asm/pm-cps.h>
 #include <asm/r4kcache.h>
+#include <asm/smp.h>
 #include <asm/smp-cps.h>
 #include <asm/time.h>
 #include <asm/uasm.h>
arch/mips/loongson64/smp.c +1 -0
index 660e1de..4e24b31 100644
@@ -14,6 +14,7 @@
 #include <linux/cpufreq.h>
 #include <linux/kexec.h>
 #include <asm/processor.h>
+#include <asm/smp.h>
 #include <asm/time.h>
 #include <asm/tlbflush.h>
 #include <asm/cacheflush.h>
author maintainer
#36 lore raw

PATCH v2 10/24 mips/cpu: Make sure play_dead() doesn't return

In reply to Josh Poimboeuf

play_dead() doesn't return. Make that more explicit with a BUG().

BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next.

---
 arch/mips/kernel/smp-bmips.c | 2 ++
 arch/mips/loongson64/smp.c   | 1 +
 2 files changed, 3 insertions(+)
arch/mips/kernel/smp-bmips.c +2 -0
index df9158e8329d..be85fa075830 100644
@@ -414,6 +414,8 @@ void __ref play_dead(void)
 	"	wait\n"
 	"	j	bmips_secondary_reentry\n"
 	: : : "memory");
+
+	BUG();
 }
 
 #endif /* CONFIG_HOTPLUG_CPU */
arch/mips/loongson64/smp.c +1 -0
index 660e1de4412a..c81c2bd07c62 100644
@@ -822,6 +822,7 @@ void play_dead(void)
 	state_addr = &per_cpu(cpu_state, cpu);
 	mb();
 	play_dead_at_ckseg1(state_addr);
+	BUG();
 }
 
 static int loongson3_disable_clock(unsigned int cpu)
Signature · 1 line
2.39.1
Reviewed-by on v2 10/24
#37 lore raw

Re: [PATCH v2 10/24] mips/cpu: Make sure play_dead() doesn't return

Quoted 6 lines · Josh Poimboeuf

play_dead() doesn't return. Make that more explicit with a BUG().

BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next.

Quoted 6 lines
---
  arch/mips/kernel/smp-bmips.c | 2 ++
  arch/mips/loongson64/smp.c   | 1 +
  2 files changed, 3 insertions(+)
merge bot Applied
#38 lore raw

[tip: objtool/core] mips/cpu: Make sure play_dead() doesn't return

In reply to Josh Poimboeuf
The following commit has been merged into the objtool/core branch of tip:

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     a80ceed6c9c24088d7a2e3c414eae1fe88a8ccbe
Gitweb:        https://git.kernel.org/tip/a80ceed6c9c24088d7a2e3c414eae1fe88a8ccbe
Author:        Josh Poimboeuf <[email protected]>
AuthorDate:    Mon, 13 Feb 2023 23:05:44 -08:00
Committer:     Josh Poimboeuf <[email protected]>
CommitterDate: Wed, 08 Mar 2023 08:44:23 -08:00

mips/cpu: Make sure play_dead() doesn't return

play_dead() doesn't return. Make that more explicit with a BUG().

BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next.

---
 arch/mips/kernel/smp-bmips.c | 2 ++
 arch/mips/loongson64/smp.c   | 1 +
 2 files changed, 3 insertions(+)
arch/mips/kernel/smp-bmips.c +2 -0
index 51d5dae..15466d4 100644
@@ -415,6 +415,8 @@ void __ref play_dead(void)
 	"	wait\n"
 	"	j	bmips_secondary_reentry\n"
 	: : : "memory");
+
+	BUG();
 }
 
 #endif /* CONFIG_HOTPLUG_CPU */
arch/mips/loongson64/smp.c +1 -0
index 4e24b31..df8d789 100644
@@ -823,6 +823,7 @@ out:
 	state_addr = &per_cpu(cpu_state, cpu);
 	mb();
 	play_dead_at_ckseg1(state_addr);
+	BUG();
 }
 
 static int loongson3_disable_clock(unsigned int cpu)
author maintainer
#39 lore raw

PATCH v2 11/24 mips/cpu: Mark play_dead() __noreturn

In reply to Josh Poimboeuf

play_dead() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn.

---
 arch/mips/include/asm/smp.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/include/asm/smp.h +1 -1
index 5d9ff61004ca..4eee29b7845c 100644
@@ -88,7 +88,7 @@ static inline void __cpu_die(unsigned int cpu)
 	mp_ops->cpu_die(cpu);
 }
 
-extern void play_dead(void);
+extern void __noreturn play_dead(void);
 #endif
 
 #ifdef CONFIG_KEXEC
Signature · 1 line
2.39.1
Reviewed-by on v2 11/24
#40 lore raw

Re: [PATCH v2 11/24] mips/cpu: Mark play_dead() __noreturn

Quoted 8 lines · Josh Poimboeuf

play_dead() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn.

---
  arch/mips/include/asm/smp.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
merge bot Applied
#41 lore raw

[tip: objtool/core] mips/cpu: Mark play_dead() __noreturn

In reply to Josh Poimboeuf
The following commit has been merged into the objtool/core branch of tip:

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     9e57f049d1571db1dc77c69c87403defc9d3e5ae
Gitweb:        https://git.kernel.org/tip/9e57f049d1571db1dc77c69c87403defc9d3e5ae
Author:        Josh Poimboeuf <[email protected]>
AuthorDate:    Mon, 13 Feb 2023 23:05:45 -08:00
Committer:     Josh Poimboeuf <[email protected]>
CommitterDate: Wed, 08 Mar 2023 08:44:23 -08:00

mips/cpu: Mark play_dead() __noreturn

play_dead() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn.

---
 arch/mips/include/asm/smp.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/include/asm/smp.h +1 -1
index 5d9ff61..4eee29b 100644
@@ -88,7 +88,7 @@ static inline void __cpu_die(unsigned int cpu)
 	mp_ops->cpu_die(cpu);
 }
 
-extern void play_dead(void);
+extern void __noreturn play_dead(void);
 #endif
 
 #ifdef CONFIG_KEXEC
author maintainer
#42 lore raw

PATCH v2 12/24 powerpc/cpu: Mark start_secondary_resume() __noreturn

In reply to Josh Poimboeuf

start_secondary_resume() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn.

---
 arch/powerpc/include/asm/smp.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/include/asm/smp.h +1 -1
index f63505d74932..cfd42ca8765c 100644
@@ -66,7 +66,7 @@ void start_secondary(void *unused);
 extern int smp_send_nmi_ipi(int cpu, void (*fn)(struct pt_regs *), u64 delay_us);
 extern int smp_send_safe_nmi_ipi(int cpu, void (*fn)(struct pt_regs *), u64 delay_us);
 extern void smp_send_debugger_break(void);
-extern void start_secondary_resume(void);
+extern void __noreturn start_secondary_resume(void);
 extern void smp_generic_give_timebase(void);
 extern void smp_generic_take_timebase(void);
 
Signature · 1 line
2.39.1
Reviewed-by on v2 12/24
#43 lore raw

Re: [PATCH v2 12/24] powerpc/cpu: Mark start_secondary_resume() __noreturn

Le 14/02/2023 à 08:05, Josh Poimboeuf a écrit :

Quoted 5 lines

start_secondary_resume() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn.

Quoted 9 lines
---
  arch/powerpc/include/asm/smp.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/include/asm/smp.h +0 -0
index f63505d74932..cfd42ca8765c 100644

arch/powerpc/include/asm/smp.h void start_secondary(void *unused); · line 69

Quoted 5 lines
arch/powerpc/include/asm/smp.h +1 -1
@@ -66,7 +66,7 @@ void start_secondary(void *unused);
  extern int smp_send_nmi_ipi(int cpu, void (*fn)(struct pt_regs *), u64 delay_us);
  extern int smp_send_safe_nmi_ipi(int cpu, void (*fn)(struct pt_regs *), u64 delay_us);
  extern void smp_send_debugger_break(void);
-extern void start_secondary_resume(void);
+extern void __noreturn start_secondary_resume(void);

Would have been a good opportunity to drop the pointless 'extern' keyword.

Checkpatch reports:

CHECK: extern prototypes should be avoided in .h files #19: FILE: arch/powerpc/include/asm/smp.h:69:
+extern void __noreturn start_secondary_resume(void);

Quoted 3 lines
arch/powerpc/include/asm/smp.h +0 -0
  extern void smp_generic_give_timebase(void);
  extern void smp_generic_take_timebase(void);
 
merge bot Applied
#44 lore raw

[tip: objtool/core] powerpc/cpu: Mark start_secondary_resume() __noreturn

In reply to Josh Poimboeuf
The following commit has been merged into the objtool/core branch of tip:

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     5e00d69cdef4cd1c737e6286a39f83ce20a91034
Gitweb:        https://git.kernel.org/tip/5e00d69cdef4cd1c737e6286a39f83ce20a91034
Author:        Josh Poimboeuf <[email protected]>
AuthorDate:    Mon, 13 Feb 2023 23:05:46 -08:00
Committer:     Josh Poimboeuf <[email protected]>
CommitterDate: Wed, 08 Mar 2023 08:44:24 -08:00

powerpc/cpu: Mark start_secondary_resume() __noreturn

start_secondary_resume() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn.

---
 arch/powerpc/include/asm/smp.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/include/asm/smp.h +1 -1
index 6c6cb53..aaaa576 100644
@@ -67,7 +67,7 @@ void start_secondary(void *unused);
 extern int smp_send_nmi_ipi(int cpu, void (*fn)(struct pt_regs *), u64 delay_us);
 extern int smp_send_safe_nmi_ipi(int cpu, void (*fn)(struct pt_regs *), u64 delay_us);
 extern void smp_send_debugger_break(void);
-extern void start_secondary_resume(void);
+extern void __noreturn start_secondary_resume(void);
 extern void smp_generic_give_timebase(void);
 extern void smp_generic_take_timebase(void);
 
author maintainer
#45 lore raw

PATCH v2 13/24 sh/cpu: Make sure play_dead() doesn't return

In reply to Josh Poimboeuf

play_dead() doesn't return. Make that more explicit with a BUG().

BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next.

---
 arch/sh/include/asm/smp-ops.h | 1 +
 1 file changed, 1 insertion(+)
arch/sh/include/asm/smp-ops.h +1 -0
index e27702130eb6..63866b1595a0 100644
@@ -27,6 +27,7 @@ static inline void plat_smp_setup(void)
 static inline void play_dead(void)
 {
 	mp_ops->play_dead();
+	BUG();
 }
 
 extern void register_smp_ops(struct plat_smp_ops *ops);
Signature · 1 line
2.39.1
#46 lore raw

Re: [PATCH v2 13/24] sh/cpu: Make sure play_dead() doesn't return

Quoted 16 lines · Josh Poimboeuf

play_dead() doesn't return. Make that more explicit with a BUG().

BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next.

---
  arch/sh/include/asm/smp-ops.h | 1 +
  1 file changed, 1 insertion(+)
arch/sh/include/asm/smp-ops.h +0 -0
index e27702130eb6..63866b1595a0 100644

arch/sh/include/asm/smp-ops.h static inline void plat_smp_setup(void) · line 31

Quoted 5 lines
arch/sh/include/asm/smp-ops.h +1 -0
@@ -27,6 +27,7 @@ static inline void plat_smp_setup(void)
  static inline void play_dead(void)
  {
  	mp_ops->play_dead();
+	BUG();
  }

Shouldn't we decorate plat_smp_ops::play_dead() as noreturn first?

author maintainer
#47 lore raw

Re: [PATCH v2 13/24] sh/cpu: Make sure play_dead() doesn't return

Quoted 12 lines · Philippe Mathieu-Daudé
Quoted 11 lines · Josh Poimboeuf

play_dead() doesn't return. Make that more explicit with a BUG().

BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next.

---
  arch/sh/include/asm/smp-ops.h | 1 +
  1 file changed, 1 insertion(+)
Quoted 12 lines

arch/sh/include/asm/smp-ops.h static inline void plat_smp_setup(void) · line 31

Quoted 10 lines
arch/sh/include/asm/smp-ops.h +1 -0
index e27702130eb6..63866b1595a0 100644
@@ -27,6 +27,7 @@ static inline void plat_smp_setup(void)
  static inline void play_dead(void)
  {
  	mp_ops->play_dead();
+	BUG();
  }

Shouldn't we decorate plat_smp_ops::play_dead() as noreturn first?

I guess it really depends on how far we want to go down the __noreturn rabbit hole. To keep the patch set constrained yet still useful I stopped when I got to a function pointer, as I think it still needs a BUG() afterwards either way.

That said, there would still be benefits of adding __noreturn to function pointers, I just wanted to keep the patch set down to a manageable size ;-)

Signature · 1 line
Josh
#48 lore raw

Re: [PATCH v2 13/24] sh/cpu: Make sure play_dead() doesn't return

In reply to Josh Poimboeuf
Quoted 16 lines · Josh Poimboeuf

play_dead() doesn't return. Make that more explicit with a BUG().

BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next.

---
  arch/sh/include/asm/smp-ops.h | 1 +
  1 file changed, 1 insertion(+)
arch/sh/include/asm/smp-ops.h +0 -0
index e27702130eb6..63866b1595a0 100644

arch/sh/include/asm/smp-ops.h static inline void plat_smp_setup(void) · line 31

Quoted 5 lines
arch/sh/include/asm/smp-ops.h +1 -0
@@ -27,6 +27,7 @@ static inline void plat_smp_setup(void)
  static inline void play_dead(void)
  {
  	mp_ops->play_dead();
+	BUG();
  }

Shouldn't we decorate plat_smp_ops::play_dead() as noreturn first?

merge bot Applied
#49 lore raw

[tip: objtool/core] sh/cpu: Make sure play_dead() doesn't return

In reply to Josh Poimboeuf
The following commit has been merged into the objtool/core branch of tip:

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     243971885418fcf772f18019eb3fabadcf0205d1
Gitweb:        https://git.kernel.org/tip/243971885418fcf772f18019eb3fabadcf0205d1
Author:        Josh Poimboeuf <[email protected]>
AuthorDate:    Mon, 13 Feb 2023 23:05:47 -08:00
Committer:     Josh Poimboeuf <[email protected]>
CommitterDate: Wed, 08 Mar 2023 08:44:24 -08:00

sh/cpu: Make sure play_dead() doesn't return

play_dead() doesn't return. Make that more explicit with a BUG().

BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next.

---
 arch/sh/include/asm/smp-ops.h | 1 +
 1 file changed, 1 insertion(+)
arch/sh/include/asm/smp-ops.h +1 -0
index e277021..63866b1 100644
@@ -27,6 +27,7 @@ static inline void plat_smp_setup(void)
 static inline void play_dead(void)
 {
 	mp_ops->play_dead();
+	BUG();
 }
 
 extern void register_smp_ops(struct plat_smp_ops *ops);
author maintainer
#50 lore raw

PATCH v2 14/24 sh/cpu: Mark play_dead() __noreturn

In reply to Josh Poimboeuf

play_dead() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn.

---
 arch/sh/include/asm/smp-ops.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/sh/include/asm/smp-ops.h +2 -2
index 63866b1595a0..97331fcb7b85 100644
@@ -24,7 +24,7 @@ static inline void plat_smp_setup(void)
 	mp_ops->smp_setup();
 }
 
-static inline void play_dead(void)
+static inline void __noreturn play_dead(void)
 {
 	mp_ops->play_dead();
 	BUG();
@@ -43,7 +43,7 @@ static inline void register_smp_ops(struct plat_smp_ops *ops)
 {
 }
 
-static inline void play_dead(void)
+static inline void __noreturn play_dead(void)
 {
 	BUG();
 }
Signature · 1 line
2.39.1
merge bot Applied
#51 lore raw

[tip: objtool/core] sh/cpu: Mark play_dead() __noreturn

The following commit has been merged into the objtool/core branch of tip:

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     1644b74192265875cdf37dadfa33f34e0ea4fcc8
Gitweb:        https://git.kernel.org/tip/1644b74192265875cdf37dadfa33f34e0ea4fcc8
Author:        Josh Poimboeuf <[email protected]>
AuthorDate:    Mon, 13 Feb 2023 23:05:48 -08:00
Committer:     Josh Poimboeuf <[email protected]>
CommitterDate: Wed, 08 Mar 2023 08:44:24 -08:00

sh/cpu: Mark play_dead() __noreturn

play_dead() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn.

---
 arch/sh/include/asm/smp-ops.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/sh/include/asm/smp-ops.h +2 -2
index 63866b1..97331fc 100644
@@ -24,7 +24,7 @@ static inline void plat_smp_setup(void)
 	mp_ops->smp_setup();
 }
 
-static inline void play_dead(void)
+static inline void __noreturn play_dead(void)
 {
 	mp_ops->play_dead();
 	BUG();
@@ -43,7 +43,7 @@ static inline void register_smp_ops(struct plat_smp_ops *ops)
 {
 }
 
-static inline void play_dead(void)
+static inline void __noreturn play_dead(void)
 {
 	BUG();
 }
author maintainer
#52 lore raw

PATCH v2 15/24 sh/cpu: Expose arch_cpu_idle_dead()'s prototype definition

In reply to Josh Poimboeuf

Include <linux/cpu.h> to make sure arch_cpu_idle_dead() matches its prototype going forward.

---
 arch/sh/kernel/idle.c | 1 +
 1 file changed, 1 insertion(+)
arch/sh/kernel/idle.c +1 -0
index 3418c40f0099..114f0c4abeac 100644
@@ -4,6 +4,7 @@
  *
  *  Copyright (C) 2002 - 2009  Paul Mundt
  */
+#include <linux/cpu.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/mm.h>
Signature · 1 line
2.39.1
merge bot Applied
#53 lore raw

[tip: objtool/core] sh/cpu: Expose arch_cpu_idle_dead()'s prototype definition

The following commit has been merged into the objtool/core branch of tip:

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     fd49efb3c75475b65d7541ee40603498807ff110
Gitweb:        https://git.kernel.org/tip/fd49efb3c75475b65d7541ee40603498807ff110
Author:        Josh Poimboeuf <[email protected]>
AuthorDate:    Mon, 13 Feb 2023 23:05:49 -08:00
Committer:     Josh Poimboeuf <[email protected]>
CommitterDate: Wed, 08 Mar 2023 08:44:25 -08:00

sh/cpu: Expose arch_cpu_idle_dead()'s prototype definition

Include <linux/cpu.h> to make sure arch_cpu_idle_dead() matches its prototype going forward.

---
 arch/sh/kernel/idle.c | 1 +
 1 file changed, 1 insertion(+)
arch/sh/kernel/idle.c +1 -0
index 3418c40..114f0c4 100644
@@ -4,6 +4,7 @@
  *
  *  Copyright (C) 2002 - 2009  Paul Mundt
  */
+#include <linux/cpu.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/mm.h>
author maintainer
#54 lore raw

PATCH v2 16/24 sparc/cpu: Mark cpu_play_dead() __noreturn

In reply to Josh Poimboeuf

cpu_play_dead() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn.

---
 arch/sparc/include/asm/smp_64.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sparc/include/asm/smp_64.h +1 -1
index e75783b6abc4..505b6700805d 100644
@@ -49,7 +49,7 @@ int hard_smp_processor_id(void);
 
 void smp_fill_in_cpu_possible_map(void);
 void smp_fill_in_sib_core_maps(void);
-void cpu_play_dead(void);
+void __noreturn cpu_play_dead(void);
 
 void smp_fetch_global_regs(void);
 void smp_fetch_global_pmu(void);
Signature · 1 line
2.39.1
merge bot Applied
#56 lore raw

[tip: objtool/core] sparc/cpu: Mark cpu_play_dead() __noreturn

In reply to Josh Poimboeuf
The following commit has been merged into the objtool/core branch of tip:

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     b9952d5009440b01dedd793a57abbe6cfe10f995
Gitweb:        https://git.kernel.org/tip/b9952d5009440b01dedd793a57abbe6cfe10f995
Author:        Josh Poimboeuf <[email protected]>
AuthorDate:    Mon, 13 Feb 2023 23:05:50 -08:00
Committer:     Josh Poimboeuf <[email protected]>
CommitterDate: Wed, 08 Mar 2023 08:44:25 -08:00

sparc/cpu: Mark cpu_play_dead() __noreturn

cpu_play_dead() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn.

---
 arch/sparc/include/asm/smp_64.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sparc/include/asm/smp_64.h +1 -1
index e75783b..505b670 100644
@@ -49,7 +49,7 @@ int hard_smp_processor_id(void);
 
 void smp_fill_in_cpu_possible_map(void);
 void smp_fill_in_sib_core_maps(void);
-void cpu_play_dead(void);
+void __noreturn cpu_play_dead(void);
 
 void smp_fetch_global_regs(void);
 void smp_fetch_global_pmu(void);
author maintainer
#57 lore raw

PATCH v2 17/24 x86/cpu: Make sure play_dead() doesn't return

In reply to Josh Poimboeuf

After commit 076cbf5d2163 ("x86/xen: don't let xen_pv_play_dead() return"), play_dead() never returns. Make that more explicit with a BUG().

BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next.

---
 arch/x86/include/asm/smp.h | 1 +
 1 file changed, 1 insertion(+)
arch/x86/include/asm/smp.h +1 -0
index b4dbb20dab1a..8f628e08b25a 100644
@@ -96,6 +96,7 @@ static inline void __cpu_die(unsigned int cpu)
 static inline void play_dead(void)
 {
 	smp_ops.play_dead();
+	BUG();
 }
 
 static inline void smp_send_reschedule(int cpu)
Signature · 1 line
2.39.1
#58 lore raw

Re: [PATCH v2 17/24] x86/cpu: Make sure play_dead() doesn't return

Quoted 18 lines · Josh Poimboeuf

After commit 076cbf5d2163 ("x86/xen: don't let xen_pv_play_dead() return"), play_dead() never returns. Make that more explicit with a BUG().

BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next.

---
  arch/x86/include/asm/smp.h | 1 +
  1 file changed, 1 insertion(+)
arch/x86/include/asm/smp.h +0 -0
index b4dbb20dab1a..8f628e08b25a 100644

arch/x86/include/asm/smp.h static inline void __cpu_die(unsigned int cpu) · line 100

Quoted 5 lines
arch/x86/include/asm/smp.h +1 -0
@@ -96,6 +96,7 @@ static inline void __cpu_die(unsigned int cpu)
  static inline void play_dead(void)
  {
  	smp_ops.play_dead();
+	BUG();
  }

Similarly, smp_ops::play_dead() should be decorated noreturn first.

#59 lore raw

Re: [PATCH v2 17/24] x86/cpu: Make sure play_dead() doesn't return

In reply to Josh Poimboeuf
Quoted 18 lines · Josh Poimboeuf

After commit 076cbf5d2163 ("x86/xen: don't let xen_pv_play_dead() return"), play_dead() never returns. Make that more explicit with a BUG().

BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next.

---
  arch/x86/include/asm/smp.h | 1 +
  1 file changed, 1 insertion(+)
arch/x86/include/asm/smp.h +0 -0
index b4dbb20dab1a..8f628e08b25a 100644

arch/x86/include/asm/smp.h static inline void __cpu_die(unsigned int cpu) · line 100

Quoted 5 lines
arch/x86/include/asm/smp.h +1 -0
@@ -96,6 +96,7 @@ static inline void __cpu_die(unsigned int cpu)
  static inline void play_dead(void)
  {
  	smp_ops.play_dead();
+	BUG();
  }

Similarly, smp_ops::play_dead() should be decorated noreturn first.

merge bot Applied
#60 lore raw

[tip: objtool/core] x86/cpu: Make sure play_dead() doesn't return

In reply to Josh Poimboeuf
The following commit has been merged into the objtool/core branch of tip:

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     a02f50b573b3c90a3633a5ab67435fe4c0de144d
Gitweb:        https://git.kernel.org/tip/a02f50b573b3c90a3633a5ab67435fe4c0de144d
Author:        Josh Poimboeuf <[email protected]>
AuthorDate:    Mon, 13 Feb 2023 23:05:51 -08:00
Committer:     Josh Poimboeuf <[email protected]>
CommitterDate: Wed, 08 Mar 2023 08:44:26 -08:00

x86/cpu: Make sure play_dead() doesn't return

After commit 076cbf5d2163 ("x86/xen: don't let xen_pv_play_dead() return"), play_dead() never returns. Make that more explicit with a BUG().

BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next.

---
 arch/x86/include/asm/smp.h | 1 +
 1 file changed, 1 insertion(+)
arch/x86/include/asm/smp.h +1 -0
index b4dbb20..8f628e0 100644
@@ -96,6 +96,7 @@ static inline void __cpu_die(unsigned int cpu)
 static inline void play_dead(void)
 {
 	smp_ops.play_dead();
+	BUG();
 }
 
 static inline void smp_send_reschedule(int cpu)
author maintainer
#61 lore raw

PATCH v2 18/24 x86/cpu: Mark play_dead() __noreturn

In reply to Josh Poimboeuf

play_dead() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn.

---
 arch/x86/include/asm/smp.h | 2 +-
 arch/x86/kernel/process.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/include/asm/smp.h +1 -1
index 8f628e08b25a..e6d1d2810e38 100644
@@ -93,7 +93,7 @@ static inline void __cpu_die(unsigned int cpu)
 	smp_ops.cpu_die(cpu);
 }
 
-static inline void play_dead(void)
+static inline void __noreturn play_dead(void)
 {
 	smp_ops.play_dead();
 	BUG();
arch/x86/kernel/process.c +1 -1
index e57cd31bfec4..4433d13edd44 100644
@@ -715,7 +715,7 @@ static bool x86_idle_set(void)
 }
 
 #ifndef CONFIG_SMP
-static inline void play_dead(void)
+static inline void __noreturn play_dead(void)
 {
 	BUG();
 }
Signature · 1 line
2.39.1
merge bot Applied
#62 lore raw

[tip: objtool/core] x86/cpu: Mark play_dead() __noreturn

The following commit has been merged into the objtool/core branch of tip:

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     eab89405b6b59947ee29cc21fb39ead66142c9b5
Gitweb:        https://git.kernel.org/tip/eab89405b6b59947ee29cc21fb39ead66142c9b5
Author:        Josh Poimboeuf <[email protected]>
AuthorDate:    Mon, 13 Feb 2023 23:05:52 -08:00
Committer:     Josh Poimboeuf <[email protected]>
CommitterDate: Wed, 08 Mar 2023 08:44:26 -08:00

x86/cpu: Mark play_dead() __noreturn

play_dead() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn.

---
 arch/x86/include/asm/smp.h | 2 +-
 arch/x86/kernel/process.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/include/asm/smp.h +1 -1
index 8f628e0..e6d1d28 100644
@@ -93,7 +93,7 @@ static inline void __cpu_die(unsigned int cpu)
 	smp_ops.cpu_die(cpu);
 }
 
-static inline void play_dead(void)
+static inline void __noreturn play_dead(void)
 {
 	smp_ops.play_dead();
 	BUG();
arch/x86/kernel/process.c +1 -1
index b650cde..f1ec36c 100644
@@ -715,7 +715,7 @@ static bool x86_idle_set(void)
 }
 
 #ifndef CONFIG_SMP
-static inline void play_dead(void)
+static inline void __noreturn play_dead(void)
 {
 	BUG();
 }
author maintainer
#63 lore raw

PATCH v2 19/24 xtensa/cpu: Make sure cpu_die() doesn't return

In reply to Josh Poimboeuf

cpu_die() doesn't return. Make that more explicit with a BUG().

BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next.

---
 arch/xtensa/kernel/smp.c | 2 ++
 1 file changed, 2 insertions(+)
arch/xtensa/kernel/smp.c +2 -0
index 4dc109dd6214..7bad78495536 100644
@@ -341,6 +341,8 @@ void __ref cpu_die(void)
 	__asm__ __volatile__(
 			"	movi	a2, cpu_restart\n"
 			"	jx	a2\n");
+
+	BUG();
 }
 
 #endif /* CONFIG_HOTPLUG_CPU */
Signature · 1 line
2.39.1
#64 lore raw

Re: [PATCH v2 19/24] xtensa/cpu: Make sure cpu_die() doesn't return

Hi Josh,

arch/xtensa/kernel/smp.c

Quoted 15 lines · Josh Poimboeuf

cpu_die() doesn't return. Make that more explicit with a BUG().

BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next.

---
  arch/xtensa/kernel/smp.c | 2 ++
  1 file changed, 2 insertions(+)
arch/xtensa/kernel/smp.c +0 -0
index 4dc109dd6214..7bad78495536 100644

Can you update the documentation along? Currently we have:

/*
* Called from the idle thread for the CPU which has been shutdown. *
* Note that we disable IRQs here, but do not re-enable them
* before returning to the caller. This is also the behaviour
* of the other hotplug-cpu capable cores, so presumably coming
* out of idle fixes this.
*/

Quoted 9 lines
arch/xtensa/kernel/smp.c +2 -0
@@ -341,6 +341,8 @@ void __ref cpu_die(void)
  	__asm__ __volatile__(
  			"	movi	a2, cpu_restart\n"
  			"	jx	a2\n");
+
+	BUG();
  }
 
  #endif /* CONFIG_HOTPLUG_CPU */
author maintainer
#65 lore raw

Re: [PATCH v2 19/24] xtensa/cpu: Make sure cpu_die() doesn't return

Quoted 21 lines · Philippe Mathieu-Daudé

Hi Josh,

arch/xtensa/kernel/smp.c

Quoted 15 lines · Josh Poimboeuf

cpu_die() doesn't return. Make that more explicit with a BUG().

BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next.

---
  arch/xtensa/kernel/smp.c | 2 ++
  1 file changed, 2 insertions(+)
arch/xtensa/kernel/smp.c +0 -0
index 4dc109dd6214..7bad78495536 100644

Can you update the documentation along? Currently we have:

Quoted 8 lines

/*
* Called from the idle thread for the CPU which has been shutdown. *
* Note that we disable IRQs here, but do not re-enable them
* before returning to the caller. This is also the behaviour
* of the other hotplug-cpu capable cores, so presumably coming
* out of idle fixes this.
*/

void __ref cpu_die(void)

{
	idle_task_exit();
	local_irq_disable();
	__asm__ __volatile__(
			"	movi	a2, cpu_restart\n"
			"	jx	a2\n");

	BUG();
}

Hm, not only is the comment wrong, but it seems to be branching to cpu_restart? That doesn't seem right at all.

Max/Chris?

Signature · 1 line
Josh
#66 lore raw

Re: [PATCH v2 19/24] xtensa/cpu: Make sure cpu_die() doesn't return

Quoted 11 lines · On Tue, 14 Feb 2023 10:23:22 -0800 Josh Poimboeuf <[email protected]> wrote:

void __ref cpu_die(void)

{
	idle_task_exit();
	local_irq_disable();
	__asm__ __volatile__(
			"	movi	a2, cpu_restart\n"
			"	jx	a2\n");

	BUG();
}
Quoted 2 lines

Hm, not only is the comment wrong, but it seems to be branching to cpu_restart? That doesn't seem right at all.

Agreed, that does not look right at all.

-- Steve

Quoted 3 lines

Max/Chris?

maintainer
#67 lore raw

Re: [PATCH v2 19/24] xtensa/cpu: Make sure cpu_die() doesn't return

In reply to Josh Poimboeuf
Quoted 23 lines · Josh Poimboeuf
Quoted 10 lines · Philippe Mathieu-Daudé

Can you update the documentation along? Currently we have:

/*
* Called from the idle thread for the CPU which has been shutdown. *
* Note that we disable IRQs here, but do not re-enable them
* before returning to the caller. This is also the behaviour
* of the other hotplug-cpu capable cores, so presumably coming
* out of idle fixes this.
*/

void __ref cpu_die(void)

{
        idle_task_exit();
        local_irq_disable();
        __asm__ __volatile__(
                        "       movi    a2, cpu_restart\n"
                        "       jx      a2\n");

        BUG();
}
Quoted 2 lines

Hm, not only is the comment wrong, but it seems to be branching to cpu_restart? That doesn't seem right at all.

Perhaps the name is a bit misleading. The CPU that enters 'cpu_restart' loops there until a call to 'boot_secondary' releases it, after which it goes to '_startup'. So it is a restart, but not immediate.

Signature · 2 lines
Thanks.
-- Max
author maintainer
#68 lore raw

Re: [PATCH v2 19/24] xtensa/cpu: Make sure cpu_die() doesn't return

Quoted 24 lines · Max Filippov
Quoted 23 lines · Josh Poimboeuf
Quoted 10 lines · Philippe Mathieu-Daudé

Can you update the documentation along? Currently we have:

/*
* Called from the idle thread for the CPU which has been shutdown. *
* Note that we disable IRQs here, but do not re-enable them
* before returning to the caller. This is also the behaviour
* of the other hotplug-cpu capable cores, so presumably coming
* out of idle fixes this.
*/

void __ref cpu_die(void)

{
        idle_task_exit();
        local_irq_disable();
        __asm__ __volatile__(
                        "       movi    a2, cpu_restart\n"
                        "       jx      a2\n");

        BUG();
}
Quoted 6 lines
Quoted 2 lines

Hm, not only is the comment wrong, but it seems to be branching to cpu_restart? That doesn't seem right at all.

Perhaps the name is a bit misleading. The CPU that enters 'cpu_restart' loops there until a call to 'boot_secondary' releases it, after which it goes to '_startup'. So it is a restart, but not immediate.

Ah, I see. That sounds similar to what Xen does.

Signature · 1 line
Josh
#69 lore raw

Re: [PATCH v2 19/24] xtensa/cpu: Make sure cpu_die() doesn't return

In reply to Josh Poimboeuf

Hi Josh,

arch/xtensa/kernel/smp.c

Quoted 15 lines · Josh Poimboeuf

cpu_die() doesn't return. Make that more explicit with a BUG().

BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next.

---
  arch/xtensa/kernel/smp.c | 2 ++
  1 file changed, 2 insertions(+)
arch/xtensa/kernel/smp.c +0 -0
index 4dc109dd6214..7bad78495536 100644

Can you update the documentation along? Currently we have:

/*
* Called from the idle thread for the CPU which has been shutdown. *
* Note that we disable IRQs here, but do not re-enable them
* before returning to the caller. This is also the behaviour
* of the other hotplug-cpu capable cores, so presumably coming
* out of idle fixes this.
*/

Quoted 9 lines
arch/xtensa/kernel/smp.c +2 -0
@@ -341,6 +341,8 @@ void __ref cpu_die(void)
  	__asm__ __volatile__(
  			"	movi	a2, cpu_restart\n"
  			"	jx	a2\n");
+
+	BUG();
  }
 
  #endif /* CONFIG_HOTPLUG_CPU */
merge bot Applied
#70 lore raw

[tip: objtool/core] xtensa/cpu: Make sure cpu_die() doesn't return

In reply to Josh Poimboeuf
The following commit has been merged into the objtool/core branch of tip:

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     d08e12e8126ec88d6cb1a7eb160d8d7b52c8699f
Gitweb:        https://git.kernel.org/tip/d08e12e8126ec88d6cb1a7eb160d8d7b52c8699f
Author:        Josh Poimboeuf <[email protected]>
AuthorDate:    Mon, 13 Feb 2023 23:05:53 -08:00
Committer:     Josh Poimboeuf <[email protected]>
CommitterDate: Wed, 08 Mar 2023 08:44:27 -08:00

xtensa/cpu: Make sure cpu_die() doesn't return

cpu_die() doesn't return. Make that more explicit with a BUG().

BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next.

---
 arch/xtensa/kernel/smp.c | 2 ++
 1 file changed, 2 insertions(+)
arch/xtensa/kernel/smp.c +2 -0
index 4dc109d..7bad784 100644
@@ -341,6 +341,8 @@ void __ref cpu_die(void)
 	__asm__ __volatile__(
 			"	movi	a2, cpu_restart\n"
 			"	jx	a2\n");
+
+	BUG();
 }
 
 #endif /* CONFIG_HOTPLUG_CPU */
author maintainer
#71 lore raw

PATCH v2 20/24 xtensa/cpu: Mark cpu_die() __noreturn

In reply to Josh Poimboeuf

cpu_die() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn.

---
 arch/xtensa/include/asm/smp.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/xtensa/include/asm/smp.h +1 -1
index 4e43f5643891..5dc5bf8cdd77 100644
@@ -33,7 +33,7 @@ void show_ipi_list(struct seq_file *p, int prec);
 
 void __cpu_die(unsigned int cpu);
 int __cpu_disable(void);
-void cpu_die(void);
+void __noreturn cpu_die(void);
 void cpu_restart(void);
 
 #endif /* CONFIG_HOTPLUG_CPU */
Signature · 1 line
2.39.1
maintainer Acked-by on v2 20/24
#72 lore raw

Re: [PATCH v2 20/24] xtensa/cpu: Mark cpu_die() __noreturn

Quoted 8 lines · Josh Poimboeuf

cpu_die() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn.

---
 arch/xtensa/include/asm/smp.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 2 lines
Thanks.
-- Max
merge bot Applied
#73 lore raw

[tip: objtool/core] xtensa/cpu: Mark cpu_die() __noreturn

In reply to Josh Poimboeuf
The following commit has been merged into the objtool/core branch of tip:

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     69dee6f0338a20c76a7bc61c0a6b59f25e1b25c8
Gitweb:        https://git.kernel.org/tip/69dee6f0338a20c76a7bc61c0a6b59f25e1b25c8
Author:        Josh Poimboeuf <[email protected]>
AuthorDate:    Mon, 13 Feb 2023 23:05:54 -08:00
Committer:     Josh Poimboeuf <[email protected]>
CommitterDate: Wed, 08 Mar 2023 08:44:27 -08:00

xtensa/cpu: Mark cpu_die() __noreturn

cpu_die() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn.

---
 arch/xtensa/include/asm/smp.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/xtensa/include/asm/smp.h +1 -1
index 4e43f56..5dc5bf8 100644
@@ -33,7 +33,7 @@ void show_ipi_list(struct seq_file *p, int prec);
 
 void __cpu_die(unsigned int cpu);
 int __cpu_disable(void);
-void cpu_die(void);
+void __noreturn cpu_die(void);
 void cpu_restart(void);
 
 #endif /* CONFIG_HOTPLUG_CPU */
author maintainer
#74 lore raw

PATCH v2 21/24 sched/idle: Make sure weak version of arch_cpu_idle_dead() doesn't return

In reply to Josh Poimboeuf

arch_cpu_idle_dead() should never return. Make it so.

---
 kernel/sched/idle.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/idle.c +1 -1
index e9ef66be2870..56e152f06d0f 100644
@@ -75,7 +75,7 @@ static noinline int __cpuidle cpu_idle_poll(void)
 void __weak arch_cpu_idle_prepare(void) { }
 void __weak arch_cpu_idle_enter(void) { }
 void __weak arch_cpu_idle_exit(void) { }
-void __weak arch_cpu_idle_dead(void) { }
+void __weak arch_cpu_idle_dead(void) { while (1); }
 void __weak arch_cpu_idle(void)
 {
 	cpu_idle_force_poll = 1;
Signature · 1 line
2.39.1
merge bot Applied
#75 lore raw

[tip: objtool/core] sched/idle: Make sure weak version of arch_cpu_idle_dead() doesn't return

The following commit has been merged into the objtool/core branch of tip:

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     dfb0f170cadb03da4f408ae53cc2908120e1f90e
Gitweb:        https://git.kernel.org/tip/dfb0f170cadb03da4f408ae53cc2908120e1f90e
Author:        Josh Poimboeuf <[email protected]>
AuthorDate:    Mon, 13 Feb 2023 23:05:55 -08:00
Committer:     Josh Poimboeuf <[email protected]>
CommitterDate: Wed, 08 Mar 2023 08:44:27 -08:00

sched/idle: Make sure weak version of arch_cpu_idle_dead() doesn't return

arch_cpu_idle_dead() should never return. Make it so.

---
 kernel/sched/idle.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/idle.c +1 -1
index e9ef66b..56e152f 100644
@@ -75,7 +75,7 @@ static noinline int __cpuidle cpu_idle_poll(void)
 void __weak arch_cpu_idle_prepare(void) { }
 void __weak arch_cpu_idle_enter(void) { }
 void __weak arch_cpu_idle_exit(void) { }
-void __weak arch_cpu_idle_dead(void) { }
+void __weak arch_cpu_idle_dead(void) { while (1); }
 void __weak arch_cpu_idle(void)
 {
 	cpu_idle_force_poll = 1;
author maintainer
#76 lore raw

PATCH v2 22/24 objtool: Include weak functions in 'global_noreturns' check

In reply to Josh Poimboeuf

If a global __noreturn function prototype has a corresponding weak function, it should also be __noreturn.

---
 tools/objtool/check.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tools/objtool/check.c +4 -4
index ba07a8ebaf73..0a1cf867d9b2 100644
@@ -193,14 +193,14 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func,
 	if (!func)
 		return false;
 
-	if (func->bind == STB_WEAK)
-		return false;
-
-	if (func->bind == STB_GLOBAL)
+	if (func->bind == STB_GLOBAL || func->bind == STB_WEAK)
 		for (i = 0; i < ARRAY_SIZE(global_noreturns); i++)
 			if (!strcmp(func->name, global_noreturns[i]))
 				return true;
 
+	if (func->bind == STB_WEAK)
+		return false;
+
 	if (!func->len)
 		return false;
 
Signature · 1 line
2.39.1
author maintainer
#77 lore raw

PATCH v2 23/24 init: Make arch_call_rest_init() and rest_init() __noreturn

In reply to Josh Poimboeuf

arch_call_rest_init() and rest_init() don't return. Annotate them as such.

Fixes the following warning:

init/main.o: warning: objtool: start_kernel+0x4ad: unreachable instruction

---
 arch/s390/kernel/setup.c     | 2 +-
 include/linux/start_kernel.h | 4 ++--
 init/main.c                  | 4 ++--
 tools/objtool/check.c        | 2 ++
 4 files changed, 7 insertions(+), 5 deletions(-)
arch/s390/kernel/setup.c +1 -1
index 696c9e007a36..85abff362f29 100644
@@ -393,7 +393,7 @@ int __init arch_early_irq_init(void)
 	return 0;
 }
 
-void __init arch_call_rest_init(void)
+void __init __noreturn arch_call_rest_init(void)
 {
 	unsigned long stack;
 
include/linux/start_kernel.h +2 -2
index 8b369a41c03c..864921e54c92 100644
@@ -9,7 +9,7 @@
    up something else. */
 
 extern asmlinkage void __init start_kernel(void);
-extern void __init arch_call_rest_init(void);
-extern void __ref rest_init(void);
+extern void __init __noreturn arch_call_rest_init(void);
+extern void __ref __noreturn rest_init(void);
 
 #endif /* _LINUX_START_KERNEL_H */
init/main.c +2 -2
index e1c3911d7c70..ef71a9902e47 100644
@@ -683,7 +683,7 @@ static void __init setup_command_line(char *command_line)
 
 static __initdata DECLARE_COMPLETION(kthreadd_done);
 
-noinline void __ref rest_init(void)
+noinline void __ref __noreturn rest_init(void)
 {
 	struct task_struct *tsk;
 	int pid;
@@ -889,7 +889,7 @@ static int __init early_randomize_kstack_offset(char *buf)
 early_param("randomize_kstack_offset", early_randomize_kstack_offset);
 #endif
 
-void __init __weak arch_call_rest_init(void)
+void __init __weak __noreturn arch_call_rest_init(void)
 {
 	rest_init();
 }
tools/objtool/check.c +2 -0
index 0a1cf867d9b2..f79baae3e338 100644
@@ -167,6 +167,7 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func,
 		"__reiserfs_panic",
 		"__stack_chk_fail",
 		"__ubsan_handle_builtin_unreachable",
+		"arch_call_rest_init",
 		"cpu_bringup_and_idle",
 		"cpu_startup_entry",
 		"do_exit",
@@ -181,6 +182,7 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func,
 		"machine_real_restart",
 		"make_task_dead",
 		"panic",
+		"rest_init",
 		"rewind_stack_and_make_dead",
 		"sev_es_terminate",
 		"snp_abort",
Signature · 1 line
2.39.1
author maintainer
#78 lore raw

PATCH v2 24/24 sched/idle: Mark arch_cpu_idle_dead() __noreturn

In reply to Josh Poimboeuf

Before commit 076cbf5d2163 ("x86/xen: don't let xen_pv_play_dead() return"), in Xen, when a previously offlined CPU was brought back online, it unexpectedly resumed execution where it left off in the middle of the idle loop.

There were some hacks to make that work, but the behavior was surprising as do_idle() doesn't expect an offlined CPU to return from the dead (in arch_cpu_idle_dead()).

Now that Xen has been fixed, and the arch-specific implementations of arch_cpu_idle_dead() also don't return, give it a __noreturn attribute.

This will cause the compiler to complain if an arch-specific implementation might return. It also improves code generation for both caller and callee.

Also fixes the following warning:

vmlinux.o: warning: objtool: do_idle+0x25f: unreachable instruction

---
 arch/alpha/kernel/process.c     | 2 +-
 arch/arm/kernel/smp.c           | 2 +-
 arch/arm64/kernel/process.c     | 2 +-
 arch/csky/kernel/smp.c          | 2 +-
 arch/ia64/kernel/process.c      | 2 +-
 arch/loongarch/kernel/process.c | 2 +-
 arch/mips/kernel/process.c      | 2 +-
 arch/parisc/kernel/process.c    | 2 +-
 arch/powerpc/kernel/smp.c       | 2 +-
 arch/riscv/kernel/cpu-hotplug.c | 2 +-
 arch/s390/kernel/idle.c         | 2 +-
 arch/sh/kernel/idle.c           | 2 +-
 arch/sparc/kernel/process_64.c  | 2 +-
 arch/x86/kernel/process.c       | 2 +-
 arch/xtensa/kernel/smp.c        | 2 +-
 include/linux/cpu.h             | 2 +-
 kernel/sched/idle.c             | 2 +-
 tools/objtool/check.c           | 1 +
 18 files changed, 18 insertions(+), 17 deletions(-)
arch/alpha/kernel/process.c +1 -1
index d0ff06eda8fa..9bae2fc4910f 100644
@@ -60,7 +60,7 @@ void arch_cpu_idle(void)
 	wtint(0);
 }
 
-void arch_cpu_idle_dead(void)
+void __noreturn arch_cpu_idle_dead(void)
 {
 	wtint(INT_MAX);
 	BUG();
arch/arm/kernel/smp.c +1 -1
index adcd417c526b..c2daa0f2f784 100644
@@ -320,7 +320,7 @@ void __cpu_die(unsigned int cpu)
  * of the other hotplug-cpu capable cores, so presumably coming
  * out of idle fixes this.
  */
-void arch_cpu_idle_dead(void)
+void __noreturn arch_cpu_idle_dead(void)
 {
 	unsigned int cpu = smp_processor_id();
 
arch/arm64/kernel/process.c +1 -1
index 269ac1c25ae2..8d606bbb4a9a 100644
@@ -69,7 +69,7 @@ void (*pm_power_off)(void);
 EXPORT_SYMBOL_GPL(pm_power_off);
 
 #ifdef CONFIG_HOTPLUG_CPU
-void arch_cpu_idle_dead(void)
+void __noreturn arch_cpu_idle_dead(void)
 {
        cpu_die();
 }
arch/csky/kernel/smp.c +1 -1
index 0ec20efaf5fd..9c7a20b73ac6 100644
@@ -300,7 +300,7 @@ void __cpu_die(unsigned int cpu)
 	pr_notice("CPU%u: shutdown\n", cpu);
 }
 
-void arch_cpu_idle_dead(void)
+void __noreturn arch_cpu_idle_dead(void)
 {
 	idle_task_exit();
 
arch/ia64/kernel/process.c +1 -1
index 78f5794b2dde..9a5cd9fad3a9 100644
@@ -225,7 +225,7 @@ static inline void __noreturn play_dead(void)
 }
 #endif /* CONFIG_HOTPLUG_CPU */
 
-void arch_cpu_idle_dead(void)
+void __noreturn arch_cpu_idle_dead(void)
 {
 	play_dead();
 }
arch/loongarch/kernel/process.c +1 -1
index edfd220a3737..ba70e94eb996 100644
@@ -61,7 +61,7 @@ unsigned long boot_option_idle_override = IDLE_NO_OVERRIDE;
 EXPORT_SYMBOL(boot_option_idle_override);
 
 #ifdef CONFIG_HOTPLUG_CPU
-void arch_cpu_idle_dead(void)
+void __noreturn arch_cpu_idle_dead(void)
 {
 	play_dead();
 }
arch/mips/kernel/process.c +1 -1
index 093dbbd6b843..a3225912c862 100644
@@ -40,7 +40,7 @@
 #include <asm/stacktrace.h>
 
 #ifdef CONFIG_HOTPLUG_CPU
-void arch_cpu_idle_dead(void)
+void __noreturn arch_cpu_idle_dead(void)
 {
 	play_dead();
 }
arch/parisc/kernel/process.c +1 -1
index c064719b49b0..97c6f875bd0e 100644
@@ -159,7 +159,7 @@ EXPORT_SYMBOL(running_on_qemu);
 /*
  * Called from the idle thread for the CPU which has been shutdown.
  */
-void arch_cpu_idle_dead(void)
+void __noreturn arch_cpu_idle_dead(void)
 {
 #ifdef CONFIG_HOTPLUG_CPU
 	idle_task_exit();
arch/powerpc/kernel/smp.c +1 -1
index 6b90f10a6c81..f62e5e651bcd 100644
@@ -1752,7 +1752,7 @@ void __cpu_die(unsigned int cpu)
 		smp_ops->cpu_die(cpu);
 }
 
-void arch_cpu_idle_dead(void)
+void __noreturn arch_cpu_idle_dead(void)
 {
 	/*
 	 * Disable on the down path. This will be re-enabled by
arch/riscv/kernel/cpu-hotplug.c +1 -1
index f7a832e3a1d1..59b80211c25f 100644
@@ -71,7 +71,7 @@ void __cpu_die(unsigned int cpu)
 /*
  * Called from the idle thread for the CPU which has been shutdown.
  */
-void arch_cpu_idle_dead(void)
+void __noreturn arch_cpu_idle_dead(void)
 {
 	idle_task_exit();
 
arch/s390/kernel/idle.c +1 -1
index b04fb418307c..45b5ee28dbe3 100644
@@ -143,7 +143,7 @@ void arch_cpu_idle_exit(void)
 {
 }
 
-void arch_cpu_idle_dead(void)
+void __noreturn arch_cpu_idle_dead(void)
 {
 	cpu_die();
 }
arch/sh/kernel/idle.c +1 -1
index 114f0c4abeac..d662503b0665 100644
@@ -30,7 +30,7 @@ void default_idle(void)
 	clear_bl_bit();
 }
 
-void arch_cpu_idle_dead(void)
+void __noreturn arch_cpu_idle_dead(void)
 {
 	play_dead();
 }
arch/sparc/kernel/process_64.c +1 -1
index 91c2b8124527..b51d8fb0ecdc 100644
@@ -95,7 +95,7 @@ void arch_cpu_idle(void)
 }
 
 #ifdef CONFIG_HOTPLUG_CPU
-void arch_cpu_idle_dead(void)
+void __noreturn arch_cpu_idle_dead(void)
 {
 	sched_preempt_enable_no_resched();
 	cpu_play_dead();
arch/x86/kernel/process.c +1 -1
index 4433d13edd44..e52158263d30 100644
@@ -727,7 +727,7 @@ void arch_cpu_idle_enter(void)
 	local_touch_nmi();
 }
 
-void arch_cpu_idle_dead(void)
+void __noreturn arch_cpu_idle_dead(void)
 {
 	play_dead();
 }
arch/xtensa/kernel/smp.c +1 -1
index 7bad78495536..054bd64eab19 100644
@@ -322,7 +322,7 @@ void __cpu_die(unsigned int cpu)
 	pr_err("CPU%u: unable to kill\n", cpu);
 }
 
-void arch_cpu_idle_dead(void)
+void __noreturn arch_cpu_idle_dead(void)
 {
 	cpu_die();
 }
include/linux/cpu.h +1 -1
index f83e4519c5f0..8582a7142623 100644
@@ -182,7 +182,7 @@ void arch_cpu_idle(void);
 void arch_cpu_idle_prepare(void);
 void arch_cpu_idle_enter(void);
 void arch_cpu_idle_exit(void);
-void arch_cpu_idle_dead(void);
+void __noreturn arch_cpu_idle_dead(void);
 
 int cpu_report_state(int cpu);
 int cpu_check_up_prepare(int cpu);
kernel/sched/idle.c +1 -1
index 56e152f06d0f..342f58a329f5 100644
@@ -75,7 +75,7 @@ static noinline int __cpuidle cpu_idle_poll(void)
 void __weak arch_cpu_idle_prepare(void) { }
 void __weak arch_cpu_idle_enter(void) { }
 void __weak arch_cpu_idle_exit(void) { }
-void __weak arch_cpu_idle_dead(void) { while (1); }
+void __weak __noreturn arch_cpu_idle_dead(void) { while (1); }
 void __weak arch_cpu_idle(void)
 {
 	cpu_idle_force_poll = 1;
tools/objtool/check.c +1 -0
index f79baae3e338..4be38a40aaca 100644
@@ -168,6 +168,7 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func,
 		"__stack_chk_fail",
 		"__ubsan_handle_builtin_unreachable",
 		"arch_call_rest_init",
+		"arch_cpu_idle_dead",
 		"cpu_bringup_and_idle",
 		"cpu_startup_entry",
 		"do_exit",
Signature · 1 line
2.39.1
merge bot Applied
#79 lore raw

[tip: objtool/core] sched/idle: Mark arch_cpu_idle_dead() __noreturn

The following commit has been merged into the objtool/core branch of tip:

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     071c44e4278156f18a6a56958617223b6bffa6ab
Gitweb:        https://git.kernel.org/tip/071c44e4278156f18a6a56958617223b6bffa6ab
Author:        Josh Poimboeuf <[email protected]>
AuthorDate:    Mon, 13 Feb 2023 23:05:58 -08:00
Committer:     Josh Poimboeuf <[email protected]>
CommitterDate: Wed, 08 Mar 2023 08:44:28 -08:00

sched/idle: Mark arch_cpu_idle_dead() __noreturn

Before commit 076cbf5d2163 ("x86/xen: don't let xen_pv_play_dead() return"), in Xen, when a previously offlined CPU was brought back online, it unexpectedly resumed execution where it left off in the middle of the idle loop.

There were some hacks to make that work, but the behavior was surprising as do_idle() doesn't expect an offlined CPU to return from the dead (in arch_cpu_idle_dead()).

Now that Xen has been fixed, and the arch-specific implementations of arch_cpu_idle_dead() also don't return, give it a __noreturn attribute.

This will cause the compiler to complain if an arch-specific implementation might return. It also improves code generation for both caller and callee.

Also fixes the following warning:

vmlinux.o: warning: objtool: do_idle+0x25f: unreachable instruction

---
 arch/alpha/kernel/process.c     | 2 +-
 arch/arm/kernel/smp.c           | 2 +-
 arch/arm64/kernel/process.c     | 2 +-
 arch/csky/kernel/smp.c          | 2 +-
 arch/ia64/kernel/process.c      | 2 +-
 arch/loongarch/kernel/process.c | 2 +-
 arch/mips/kernel/process.c      | 2 +-
 arch/parisc/kernel/process.c    | 2 +-
 arch/powerpc/kernel/smp.c       | 2 +-
 arch/riscv/kernel/cpu-hotplug.c | 2 +-
 arch/s390/kernel/idle.c         | 2 +-
 arch/sh/kernel/idle.c           | 2 +-
 arch/sparc/kernel/process_64.c  | 2 +-
 arch/x86/kernel/process.c       | 2 +-
 arch/xtensa/kernel/smp.c        | 2 +-
 include/linux/cpu.h             | 2 +-
 kernel/sched/idle.c             | 2 +-
 tools/objtool/check.c           | 1 +
 18 files changed, 18 insertions(+), 17 deletions(-)
arch/alpha/kernel/process.c +1 -1
index a82fefa..582d965 100644
@@ -60,7 +60,7 @@ void arch_cpu_idle(void)
 	wtint(0);
 }
 
-void arch_cpu_idle_dead(void)
+void __noreturn arch_cpu_idle_dead(void)
 {
 	wtint(INT_MAX);
 	BUG();
arch/arm/kernel/smp.c +1 -1
index 441ea5c..d6be450 100644
@@ -320,7 +320,7 @@ void __cpu_die(unsigned int cpu)
  * of the other hotplug-cpu capable cores, so presumably coming
  * out of idle fixes this.
  */
-void arch_cpu_idle_dead(void)
+void __noreturn arch_cpu_idle_dead(void)
 {
 	unsigned int cpu = smp_processor_id();
 
arch/arm64/kernel/process.c +1 -1
index 71d59b5..089ced6 100644
@@ -69,7 +69,7 @@ void (*pm_power_off)(void);
 EXPORT_SYMBOL_GPL(pm_power_off);
 
 #ifdef CONFIG_HOTPLUG_CPU
-void arch_cpu_idle_dead(void)
+void __noreturn arch_cpu_idle_dead(void)
 {
        cpu_die();
 }
arch/csky/kernel/smp.c +1 -1
index 0ec20ef..9c7a20b 100644
@@ -300,7 +300,7 @@ void __cpu_die(unsigned int cpu)
 	pr_notice("CPU%u: shutdown\n", cpu);
 }
 
-void arch_cpu_idle_dead(void)
+void __noreturn arch_cpu_idle_dead(void)
 {
 	idle_task_exit();
 
arch/ia64/kernel/process.c +1 -1
index 78f5794..9a5cd9f 100644
@@ -225,7 +225,7 @@ static inline void __noreturn play_dead(void)
 }
 #endif /* CONFIG_HOTPLUG_CPU */
 
-void arch_cpu_idle_dead(void)
+void __noreturn arch_cpu_idle_dead(void)
 {
 	play_dead();
 }
arch/loongarch/kernel/process.c +1 -1
index fa2443c..b71e17c 100644
@@ -62,7 +62,7 @@ unsigned long boot_option_idle_override = IDLE_NO_OVERRIDE;
 EXPORT_SYMBOL(boot_option_idle_override);
 
 #ifdef CONFIG_HOTPLUG_CPU
-void arch_cpu_idle_dead(void)
+void __noreturn arch_cpu_idle_dead(void)
 {
 	play_dead();
 }
arch/mips/kernel/process.c +1 -1
index 093dbbd..a322591 100644
@@ -40,7 +40,7 @@
 #include <asm/stacktrace.h>
 
 #ifdef CONFIG_HOTPLUG_CPU
-void arch_cpu_idle_dead(void)
+void __noreturn arch_cpu_idle_dead(void)
 {
 	play_dead();
 }
arch/parisc/kernel/process.c +1 -1
index c064719..97c6f87 100644
@@ -159,7 +159,7 @@ EXPORT_SYMBOL(running_on_qemu);
 /*
  * Called from the idle thread for the CPU which has been shutdown.
  */
-void arch_cpu_idle_dead(void)
+void __noreturn arch_cpu_idle_dead(void)
 {
 #ifdef CONFIG_HOTPLUG_CPU
 	idle_task_exit();
arch/powerpc/kernel/smp.c +1 -1
index 6b90f10..f62e5e6 100644
@@ -1752,7 +1752,7 @@ void __cpu_die(unsigned int cpu)
 		smp_ops->cpu_die(cpu);
 }
 
-void arch_cpu_idle_dead(void)
+void __noreturn arch_cpu_idle_dead(void)
 {
 	/*
 	 * Disable on the down path. This will be re-enabled by
arch/riscv/kernel/cpu-hotplug.c +1 -1
index f7a832e..59b8021 100644
@@ -71,7 +71,7 @@ void __cpu_die(unsigned int cpu)
 /*
  * Called from the idle thread for the CPU which has been shutdown.
  */
-void arch_cpu_idle_dead(void)
+void __noreturn arch_cpu_idle_dead(void)
 {
 	idle_task_exit();
 
arch/s390/kernel/idle.c +1 -1
index 38e267c..e7239aa 100644
@@ -88,7 +88,7 @@ void arch_cpu_idle_exit(void)
 {
 }
 
-void arch_cpu_idle_dead(void)
+void __noreturn arch_cpu_idle_dead(void)
 {
 	cpu_die();
 }
arch/sh/kernel/idle.c +1 -1
index 114f0c4..d662503 100644
@@ -30,7 +30,7 @@ void default_idle(void)
 	clear_bl_bit();
 }
 
-void arch_cpu_idle_dead(void)
+void __noreturn arch_cpu_idle_dead(void)
 {
 	play_dead();
 }
arch/sparc/kernel/process_64.c +1 -1
index 91c2b81..b51d8fb 100644
@@ -95,7 +95,7 @@ void arch_cpu_idle(void)
 }
 
 #ifdef CONFIG_HOTPLUG_CPU
-void arch_cpu_idle_dead(void)
+void __noreturn arch_cpu_idle_dead(void)
 {
 	sched_preempt_enable_no_resched();
 	cpu_play_dead();
arch/x86/kernel/process.c +1 -1
index f1ec36c..3e30147 100644
@@ -727,7 +727,7 @@ void arch_cpu_idle_enter(void)
 	local_touch_nmi();
 }
 
-void arch_cpu_idle_dead(void)
+void __noreturn arch_cpu_idle_dead(void)
 {
 	play_dead();
 }
arch/xtensa/kernel/smp.c +1 -1
index 7bad784..054bd64 100644
@@ -322,7 +322,7 @@ void __cpu_die(unsigned int cpu)
 	pr_err("CPU%u: unable to kill\n", cpu);
 }
 
-void arch_cpu_idle_dead(void)
+void __noreturn arch_cpu_idle_dead(void)
 {
 	cpu_die();
 }
include/linux/cpu.h +1 -1
index f83e451..8582a71 100644
@@ -182,7 +182,7 @@ void arch_cpu_idle(void);
 void arch_cpu_idle_prepare(void);
 void arch_cpu_idle_enter(void);
 void arch_cpu_idle_exit(void);
-void arch_cpu_idle_dead(void);
+void __noreturn arch_cpu_idle_dead(void);
 
 int cpu_report_state(int cpu);
 int cpu_check_up_prepare(int cpu);
kernel/sched/idle.c +1 -1
index 56e152f..342f58a 100644
@@ -75,7 +75,7 @@ static noinline int __cpuidle cpu_idle_poll(void)
 void __weak arch_cpu_idle_prepare(void) { }
 void __weak arch_cpu_idle_enter(void) { }
 void __weak arch_cpu_idle_exit(void) { }
-void __weak arch_cpu_idle_dead(void) { while (1); }
+void __weak __noreturn arch_cpu_idle_dead(void) { while (1); }
 void __weak arch_cpu_idle(void)
 {
 	cpu_idle_force_poll = 1;
tools/objtool/check.c +1 -0
index f937be1..37c36dc 100644
@@ -202,6 +202,7 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func,
 		"__reiserfs_panic",
 		"__stack_chk_fail",
 		"__ubsan_handle_builtin_unreachable",
+		"arch_cpu_idle_dead",
 		"cpu_bringup_and_idle",
 		"cpu_startup_entry",
 		"do_exit",
#80 lore raw

[PATCH v2 25/24] x86/cpu: Expose arch_cpu_idle_dead()'s prototype definition

In reply to Josh Poimboeuf

Include <linux/cpu.h> to make sure arch_cpu_idle_dead() matches its prototype going forward.

---
Josh, feel free to include in your v3.

---
 arch/x86/kernel/process.c | 1 +
 1 file changed, 1 insertion(+)
arch/x86/kernel/process.c +1 -0
index 40d156a31676..7d27181a2518 100644
@@ -5,6 +5,7 @@
 #include <linux/kernel.h>
 #include <linux/mm.h>
 #include <linux/smp.h>
+#include <linux/cpu.h>
 #include <linux/prctl.h>
 #include <linux/slab.h>
 #include <linux/sched.h>
Signature · 1 line
2.38.1
#81 lore raw

[tip: objtool/core] x86/cpu: Expose arch_cpu_idle_dead()'s prototype definition

The following commit has been merged into the objtool/core branch of tip:

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     b4c108d7daf1039cf19388baff30a94563de3f3e
Gitweb:        https://git.kernel.org/tip/b4c108d7daf1039cf19388baff30a94563de3f3e
Author:        Philippe Mathieu-Daudé <[email protected]>
AuthorDate:    Tue, 14 Feb 2023 09:38:57 +01:00
Committer:     Josh Poimboeuf <[email protected]>
CommitterDate: Wed, 08 Mar 2023 08:44:30 -08:00

x86/cpu: Expose arch_cpu_idle_dead()'s prototype definition

Include <linux/cpu.h> to make sure arch_cpu_idle_dead() matches its prototype going forward.

---
 arch/x86/kernel/process.c | 1 +
 1 file changed, 1 insertion(+)
arch/x86/kernel/process.c +1 -0
index 3e30147..d9ecaa6 100644
@@ -5,6 +5,7 @@
 #include <linux/kernel.h>
 #include <linux/mm.h>
 #include <linux/smp.h>
+#include <linux/cpu.h>
 #include <linux/prctl.h>
 #include <linux/slab.h>
 #include <linux/sched.h>
#82 lore raw
In reply to Josh Poimboeuf
Quoted 8 lines · Josh Poimboeuf

v2:
- make arch_call_rest_init() and rest_init() __noreturn
- make objtool 'global_returns' work for weak functions
- rebase on tip/objtool/core with dependencies merged in (mingo)
- add acks

v1.1:
- add __noreturn to all arch_cpu_idle_dead() implementations (mpe)

Possible similar candidates: panic_smp_self_stop, nmi_panic_self_stop and kexec.

author maintainer
#83 lore raw
Quoted 7 lines · Philippe Mathieu-Daudé
Quoted 6 lines · Josh Poimboeuf

v2:
- make arch_call_rest_init() and rest_init() __noreturn
- make objtool 'global_returns' work for weak functions
- rebase on tip/objtool/core with dependencies merged in (mingo)
- add acks

Quoted 5 lines
Quoted 2 lines

v1.1:
- add __noreturn to all arch_cpu_idle_dead() implementations (mpe)

Possible similar candidates: panic_smp_self_stop, nmi_panic_self_stop and kexec.

Agreed. Any volunteers?

Signature · 1 line
Josh
#84 lore raw
In reply to Josh Poimboeuf
Quoted 8 lines · Josh Poimboeuf

v2:
- make arch_call_rest_init() and rest_init() __noreturn
- make objtool 'global_returns' work for weak functions
- rebase on tip/objtool/core with dependencies merged in (mingo)
- add acks

v1.1:
- add __noreturn to all arch_cpu_idle_dead() implementations (mpe)

Possible similar candidates: panic_smp_self_stop, nmi_panic_self_stop and kexec.

Tested-by on the v2 series
#85 lore raw
In reply to Josh Poimboeuf
Quoted 8 lines · Josh Poimboeuf

v2:
- make arch_call_rest_init() and rest_init() __noreturn
- make objtool 'global_returns' work for weak functions
- rebase on tip/objtool/core with dependencies merged in (mingo)
- add acks

v1.1:
- add __noreturn to all arch_cpu_idle_dead() implementations (mpe)

With this, rcutorture no longer gets objtool complaints on x86, thank you!

Quoted 64 lines

Josh Poimboeuf (24):
alpha/cpu: Expose arch_cpu_idle_dead()'s prototype declaration alpha/cpu: Make sure arch_cpu_idle_dead() doesn't return arm/cpu: Make sure arch_cpu_idle_dead() doesn't return arm64/cpu: Mark cpu_die() __noreturn
csky/cpu: Make sure arch_cpu_idle_dead() doesn't return ia64/cpu: Mark play_dead() __noreturn
loongarch/cpu: Make sure play_dead() doesn't return loongarch/cpu: Mark play_dead() __noreturn
mips/cpu: Expose play_dead()'s prototype definition mips/cpu: Make sure play_dead() doesn't return mips/cpu: Mark play_dead() __noreturn
powerpc/cpu: Mark start_secondary_resume() __noreturn sh/cpu: Make sure play_dead() doesn't return
sh/cpu: Mark play_dead() __noreturn
sh/cpu: Expose arch_cpu_idle_dead()'s prototype definition sparc/cpu: Mark cpu_play_dead() __noreturn
x86/cpu: Make sure play_dead() doesn't return
x86/cpu: Mark play_dead() __noreturn
xtensa/cpu: Make sure cpu_die() doesn't return xtensa/cpu: Mark cpu_die() __noreturn
sched/idle: Make sure weak version of arch_cpu_idle_dead() doesn't
return
objtool: Include weak functions in 'global_noreturns' check
init: Make arch_call_rest_init() and rest_init() __noreturn sched/idle: Mark arch_cpu_idle_dead() __noreturn

 arch/alpha/kernel/process.c      |  4 +++-
 arch/arm/kernel/smp.c            |  4 +++-
 arch/arm64/include/asm/smp.h     |  2 +-
 arch/arm64/kernel/process.c      |  2 +-
 arch/csky/kernel/smp.c           |  4 +++-
 arch/ia64/kernel/process.c       |  6 +++---
 arch/loongarch/include/asm/smp.h |  2 +-
 arch/loongarch/kernel/process.c  |  2 +-
 arch/loongarch/kernel/smp.c      |  2 +-
 arch/mips/include/asm/smp.h      |  2 +-
 arch/mips/kernel/process.c       |  2 +-
 arch/mips/kernel/smp-bmips.c     |  3 +++
 arch/mips/loongson64/smp.c       |  1 +
 arch/parisc/kernel/process.c     |  2 +-
 arch/powerpc/include/asm/smp.h   |  2 +-
 arch/powerpc/kernel/smp.c        |  2 +-
 arch/riscv/kernel/cpu-hotplug.c  |  2 +-
 arch/s390/kernel/idle.c          |  2 +-
 arch/s390/kernel/setup.c         |  2 +-
 arch/sh/include/asm/smp-ops.h    |  5 +++--
 arch/sh/kernel/idle.c            |  3 ++-
 arch/sparc/include/asm/smp_64.h  |  2 +-
 arch/sparc/kernel/process_64.c   |  2 +-
 arch/x86/include/asm/smp.h       |  3 ++-
 arch/x86/kernel/process.c        |  4 ++--
 arch/xtensa/include/asm/smp.h    |  2 +-
 arch/xtensa/kernel/smp.c         |  4 +++-
 include/linux/cpu.h              |  2 +-
 include/linux/start_kernel.h     |  4 ++--
 init/main.c                      |  4 ++--
 kernel/sched/idle.c              |  2 +-
 tools/objtool/check.c            | 11 +++++++----
 32 files changed, 57 insertions(+), 39 deletions(-)
Signature · 1 line
2.39.1