Skip to contentSkip to conversation

powerpc/boot: Mark exit() and ps3_exit() as __noreturn

PATCH In review Thorsten Blum 2 participants 3 messages Aug 7

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/boot: Mark exit() and ps3_exit() as __noreturn

Since neither exit() nor ps3_exit() return, annotate both functions with the __noreturn attribute to improve compiler optimizations.

---
 arch/powerpc/boot/ops.h | 2 +-
 arch/powerpc/boot/ps3.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/boot/ops.h +1 -1
index a40c2162a4e9..df52b14816e2 100644
@@ -217,7 +217,7 @@ static inline void free(void *ptr)
 		platform_ops.free(ptr);
 }
 
-static inline void exit(void)
+static inline void __noreturn exit(void)
 {
 	if (platform_ops.exit)
 		platform_ops.exit();
arch/powerpc/boot/ps3.c +1 -1
index 89ff46b8b225..22fa35960926 100644
@@ -45,7 +45,7 @@ static void ps3_console_write(const char *buf, int len)
 {
 }
 
-static void ps3_exit(void)
+static void __noreturn ps3_exit(void)
 {
 	printf("ps3_exit\n");
 
#1 lore raw

Le 07/08/2026 à 17:23, Thorsten Blum a écrit :

Quoted 2 lines

Since neither exit() nor ps3_exit() return, annotate both functions with the __noreturn attribute to improve compiler optimizations.

Is it worth spending time optimising a boot sequence that will run only once at startup ?

Do you have any figure on the improvement ?

Christophe

Quoted 33 lines
---
  arch/powerpc/boot/ops.h | 2 +-
  arch/powerpc/boot/ps3.c | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/boot/ops.h +1 -1
index a40c2162a4e9..df52b14816e2 100644
@@ -217,7 +217,7 @@ static inline void free(void *ptr)
  		platform_ops.free(ptr);
  }
 
-static inline void exit(void)
+static inline void __noreturn exit(void)
  {
  	if (platform_ops.exit)
  		platform_ops.exit();
arch/powerpc/boot/ps3.c +1 -1
index 89ff46b8b225..22fa35960926 100644
@@ -45,7 +45,7 @@ static void ps3_console_write(const char *buf, int len)
  {
  }
 
-static void ps3_exit(void)
+static void __noreturn ps3_exit(void)
  {
  	printf("ps3_exit\n");
 
#2 lore raw
Quoted 8 lines · Christophe Leroy (CS GROUP)

Le 07/08/2026 à 17:23, Thorsten Blum a écrit :

Quoted 2 lines

Since neither exit() nor ps3_exit() return, annotate both functions with the __noreturn attribute to improve compiler optimizations.

Is it worth spending time optimising a boot sequence that will run only once at startup ?

Do you have any figure on the improvement ?

No, and I haven't checked its impact. Maybe compilers can already infer that both functions never return and optimize them accordingly. Besides potential compiler optimizations, it also serves as documentation.

I can reword the commit message to clarify that, or drop the patch.

Thanks,
Thorsten