The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] powerpc/boot: Mark exit() and ps3_exit() as __noreturn
@ 2026-08-07 15:23 Thorsten Blum
  2026-08-07 15:32 ` Christophe Leroy (CS GROUP)
  0 siblings, 1 reply; 3+ messages in thread
From: Thorsten Blum @ 2026-08-07 15:23 UTC (permalink / raw)
  To: Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy (CS GROUP), Geoff Levand
  Cc: Thorsten Blum, linuxppc-dev, linux-kernel

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

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 arch/powerpc/boot/ops.h | 2 +-
 arch/powerpc/boot/ps3.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/boot/ops.h b/arch/powerpc/boot/ops.h
index a40c2162a4e9..df52b14816e2 100644
--- a/arch/powerpc/boot/ops.h
+++ b/arch/powerpc/boot/ops.h
@@ -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();
diff --git a/arch/powerpc/boot/ps3.c b/arch/powerpc/boot/ps3.c
index 89ff46b8b225..22fa35960926 100644
--- a/arch/powerpc/boot/ps3.c
+++ b/arch/powerpc/boot/ps3.c
@@ -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");
 

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

* Re: [PATCH] powerpc/boot: Mark exit() and ps3_exit() as __noreturn
  2026-08-07 15:23 [PATCH] powerpc/boot: Mark exit() and ps3_exit() as __noreturn Thorsten Blum
@ 2026-08-07 15:32 ` Christophe Leroy (CS GROUP)
  2026-08-07 19:54   ` Thorsten Blum
  0 siblings, 1 reply; 3+ messages in thread
From: Christophe Leroy (CS GROUP) @ 2026-08-07 15:32 UTC (permalink / raw)
  To: Thorsten Blum, Madhavan Srinivasan, Michael Ellerman,
	Nicholas Piggin, Geoff Levand
  Cc: linuxppc-dev, linux-kernel



Le 07/08/2026 à 17:23, Thorsten Blum a écrit :
> 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

> 
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
>   arch/powerpc/boot/ops.h | 2 +-
>   arch/powerpc/boot/ps3.c | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/boot/ops.h b/arch/powerpc/boot/ops.h
> index a40c2162a4e9..df52b14816e2 100644
> --- a/arch/powerpc/boot/ops.h
> +++ b/arch/powerpc/boot/ops.h
> @@ -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();
> diff --git a/arch/powerpc/boot/ps3.c b/arch/powerpc/boot/ps3.c
> index 89ff46b8b225..22fa35960926 100644
> --- a/arch/powerpc/boot/ps3.c
> +++ b/arch/powerpc/boot/ps3.c
> @@ -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");
>   


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

* Re: [PATCH] powerpc/boot: Mark exit() and ps3_exit() as __noreturn
  2026-08-07 15:32 ` Christophe Leroy (CS GROUP)
@ 2026-08-07 19:54   ` Thorsten Blum
  0 siblings, 0 replies; 3+ messages in thread
From: Thorsten Blum @ 2026-08-07 19:54 UTC (permalink / raw)
  To: Christophe Leroy (CS GROUP)
  Cc: Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
	Geoff Levand, linuxppc-dev, linux-kernel

On Fri, Aug 07, 2026 at 05:32:44PM +0200, Christophe Leroy (CS GROUP) wrote:
> Le 07/08/2026 à 17:23, Thorsten Blum a écrit :
> > 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

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

end of thread, other threads:[~2026-08-07 19:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-07 15:23 [PATCH] powerpc/boot: Mark exit() and ps3_exit() as __noreturn Thorsten Blum
2026-08-07 15:32 ` Christophe Leroy (CS GROUP)
2026-08-07 19:54   ` Thorsten Blum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox