All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/smpboot: Mark native_play_dead() as __noreturn
@ 2025-10-27 15:51 Thorsten Blum
  2025-10-27 19:28 ` Josh Poimboeuf
  2025-10-31 11:04 ` [tip: objtool/core] " tip-bot2 for Thorsten Blum
  0 siblings, 2 replies; 5+ messages in thread
From: Thorsten Blum @ 2025-10-27 15:51 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	H. Peter Anvin, Josh Poimboeuf, Peter Zijlstra,
	Sean Christopherson, Kai Huang, Brian Gerst, Thomas Huth,
	Patryk Wlazlyn, Zheyun Shen, Kevin Loughlin, K Prateek Nayak,
	Rafael J. Wysocki, Li Chen, Tim Chen
  Cc: Thorsten Blum, Ingo Molnar, Tom Lendacky, Kevin Brodsky,
	linux-kernel

native_play_dead() ends by calling the non-returning function
hlt_play_dead() and therefore also never returns.

The !CONFIG_HOTPLUG_CPU stub version of native_play_dead()
unconditionally calls BUG() and does not return either.

Add the __noreturn attribute to both function definitions and their
declaration to document this behavior and to potentially improve
compiler optimizations.

Remove the obsolete comment, and add native_play_dead() to the objtool's
list of __noreturn functions.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 arch/x86/include/asm/smp.h | 2 +-
 arch/x86/kernel/smpboot.c  | 8 ++------
 tools/objtool/noreturns.h  | 1 +
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
index 22bfebe6776d..84951572ab81 100644
--- a/arch/x86/include/asm/smp.h
+++ b/arch/x86/include/asm/smp.h
@@ -109,7 +109,7 @@ int common_cpu_up(unsigned int cpunum, struct task_struct *tidle);
 int native_kick_ap(unsigned int cpu, struct task_struct *tidle);
 int native_cpu_disable(void);
 void __noreturn hlt_play_dead(void);
-void native_play_dead(void);
+void __noreturn native_play_dead(void);
 void play_dead_common(void);
 void wbinvd_on_cpu(int cpu);
 void wbinvd_on_all_cpus(void);
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index eb289abece23..a4ba735842a8 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1328,11 +1328,7 @@ void __noreturn hlt_play_dead(void)
 		native_halt();
 }
 
-/*
- * native_play_dead() is essentially a __noreturn function, but it can't
- * be marked as such as the compiler may complain about it.
- */
-void native_play_dead(void)
+void __noreturn native_play_dead(void)
 {
 	if (cpu_feature_enabled(X86_FEATURE_KERNEL_IBRS))
 		__update_spec_ctrl(0);
@@ -1351,7 +1347,7 @@ int native_cpu_disable(void)
 	return -ENOSYS;
 }
 
-void native_play_dead(void)
+void __noreturn native_play_dead(void)
 {
 	BUG();
 }
diff --git a/tools/objtool/noreturns.h b/tools/objtool/noreturns.h
index 802895fae3ca..14f8ab653449 100644
--- a/tools/objtool/noreturns.h
+++ b/tools/objtool/noreturns.h
@@ -36,6 +36,7 @@ NORETURN(machine_real_restart)
 NORETURN(make_task_dead)
 NORETURN(mpt_halt_firmware)
 NORETURN(mwait_play_dead)
+NORETURN(native_play_dead)
 NORETURN(nmi_panic_self_stop)
 NORETURN(panic)
 NORETURN(vpanic)
-- 
2.51.0


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

* Re: [PATCH] x86/smpboot: Mark native_play_dead() as __noreturn
  2025-10-27 15:51 [PATCH] x86/smpboot: Mark native_play_dead() as __noreturn Thorsten Blum
@ 2025-10-27 19:28 ` Josh Poimboeuf
  2025-10-27 19:56   ` Thorsten Blum
  2025-10-31 11:04 ` [tip: objtool/core] " tip-bot2 for Thorsten Blum
  1 sibling, 1 reply; 5+ messages in thread
From: Josh Poimboeuf @ 2025-10-27 19:28 UTC (permalink / raw)
  To: Thorsten Blum
  Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	H. Peter Anvin, Peter Zijlstra, Sean Christopherson, Kai Huang,
	Brian Gerst, Thomas Huth, Patryk Wlazlyn, Zheyun Shen,
	Kevin Loughlin, K Prateek Nayak, Rafael J. Wysocki, Li Chen,
	Tim Chen, Ingo Molnar, Tom Lendacky, Kevin Brodsky, linux-kernel

On Mon, Oct 27, 2025 at 04:51:02PM +0100, Thorsten Blum wrote:
> native_play_dead() ends by calling the non-returning function
> hlt_play_dead() and therefore also never returns.
> 
> The !CONFIG_HOTPLUG_CPU stub version of native_play_dead()
> unconditionally calls BUG() and does not return either.
> 
> Add the __noreturn attribute to both function definitions and their
> declaration to document this behavior and to potentially improve
> compiler optimizations.
> 
> Remove the obsolete comment, and add native_play_dead() to the objtool's
> list of __noreturn functions.
> 
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>

Is there an objtool warning that this fixes?  If so, it would be helpful
to put it in the description above.

And same for the other patch.

Otherwise it LGTM.  Thanks!

-- 
Josh

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

* Re: [PATCH] x86/smpboot: Mark native_play_dead() as __noreturn
  2025-10-27 19:28 ` Josh Poimboeuf
@ 2025-10-27 19:56   ` Thorsten Blum
  2025-10-27 20:32     ` Josh Poimboeuf
  0 siblings, 1 reply; 5+ messages in thread
From: Thorsten Blum @ 2025-10-27 19:56 UTC (permalink / raw)
  To: Josh Poimboeuf
  Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	H. Peter Anvin, Peter Zijlstra, Sean Christopherson, Kai Huang,
	Brian Gerst, Thomas Huth, Patryk Wlazlyn, Zheyun Shen,
	Kevin Loughlin, K Prateek Nayak, Rafael J. Wysocki, Li Chen,
	Tim Chen, Ingo Molnar, Tom Lendacky, Kevin Brodsky, linux-kernel

On 27. Oct 2025, at 20:28, Josh Poimboeuf wrote:
> On Mon, Oct 27, 2025 at 04:51:02PM +0100, Thorsten Blum wrote:
>> native_play_dead() ends by calling the non-returning function
>> hlt_play_dead() and therefore also never returns.
>> 
>> The !CONFIG_HOTPLUG_CPU stub version of native_play_dead()
>> unconditionally calls BUG() and does not return either.
>> 
>> Add the __noreturn attribute to both function definitions and their
>> declaration to document this behavior and to potentially improve
>> compiler optimizations.
>> 
>> Remove the obsolete comment, and add native_play_dead() to the objtool's
>> list of __noreturn functions.
>> 
>> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> 
> Is there an objtool warning that this fixes?  If so, it would be helpful
> to put it in the description above.

Not that I'm aware of.


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

* Re: [PATCH] x86/smpboot: Mark native_play_dead() as __noreturn
  2025-10-27 19:56   ` Thorsten Blum
@ 2025-10-27 20:32     ` Josh Poimboeuf
  0 siblings, 0 replies; 5+ messages in thread
From: Josh Poimboeuf @ 2025-10-27 20:32 UTC (permalink / raw)
  To: Thorsten Blum
  Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	H. Peter Anvin, Peter Zijlstra, Sean Christopherson, Kai Huang,
	Brian Gerst, Thomas Huth, Patryk Wlazlyn, Zheyun Shen,
	Kevin Loughlin, K Prateek Nayak, Rafael J. Wysocki, Li Chen,
	Tim Chen, Ingo Molnar, Tom Lendacky, Kevin Brodsky, linux-kernel

On Mon, Oct 27, 2025 at 08:56:18PM +0100, Thorsten Blum wrote:
> On 27. Oct 2025, at 20:28, Josh Poimboeuf wrote:
> > On Mon, Oct 27, 2025 at 04:51:02PM +0100, Thorsten Blum wrote:
> >> native_play_dead() ends by calling the non-returning function
> >> hlt_play_dead() and therefore also never returns.
> >> 
> >> The !CONFIG_HOTPLUG_CPU stub version of native_play_dead()
> >> unconditionally calls BUG() and does not return either.
> >> 
> >> Add the __noreturn attribute to both function definitions and their
> >> declaration to document this behavior and to potentially improve
> >> compiler optimizations.
> >> 
> >> Remove the obsolete comment, and add native_play_dead() to the objtool's
> >> list of __noreturn functions.
> >> 
> >> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> > 
> > Is there an objtool warning that this fixes?  If so, it would be helpful
> > to put it in the description above.
> 
> Not that I'm aware of.

Ok.

Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>

-- 
Josh

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

* [tip: objtool/core] x86/smpboot: Mark native_play_dead() as __noreturn
  2025-10-27 15:51 [PATCH] x86/smpboot: Mark native_play_dead() as __noreturn Thorsten Blum
  2025-10-27 19:28 ` Josh Poimboeuf
@ 2025-10-31 11:04 ` tip-bot2 for Thorsten Blum
  1 sibling, 0 replies; 5+ messages in thread
From: tip-bot2 for Thorsten Blum @ 2025-10-31 11:04 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Thorsten Blum, Josh Poimboeuf, x86, linux-kernel

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

Commit-ID:     0ccf30fc64acca8e43a54a4f54fb3a4f155d4692
Gitweb:        https://git.kernel.org/tip/0ccf30fc64acca8e43a54a4f54fb3a4f155d4692
Author:        Thorsten Blum <thorsten.blum@linux.dev>
AuthorDate:    Mon, 27 Oct 2025 16:51:02 +01:00
Committer:     Josh Poimboeuf <jpoimboe@kernel.org>
CommitterDate: Thu, 30 Oct 2025 08:29:41 -07:00

x86/smpboot: Mark native_play_dead() as __noreturn

native_play_dead() ends by calling the non-returning function
hlt_play_dead() and therefore also never returns.

The !CONFIG_HOTPLUG_CPU stub version of native_play_dead()
unconditionally calls BUG() and does not return either.

Add the __noreturn attribute to both function definitions and their
declaration to document this behavior and to potentially improve
compiler optimizations.

Remove the obsolete comment, and add native_play_dead() to the objtool's
list of __noreturn functions.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Link: https://patch.msgid.link/20251027155107.183136-1-thorsten.blum@linux.dev
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
---
 arch/x86/include/asm/smp.h | 2 +-
 arch/x86/kernel/smpboot.c  | 8 ++------
 tools/objtool/noreturns.h  | 1 +
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
index 22bfebe..8495157 100644
--- a/arch/x86/include/asm/smp.h
+++ b/arch/x86/include/asm/smp.h
@@ -109,7 +109,7 @@ int common_cpu_up(unsigned int cpunum, struct task_struct *tidle);
 int native_kick_ap(unsigned int cpu, struct task_struct *tidle);
 int native_cpu_disable(void);
 void __noreturn hlt_play_dead(void);
-void native_play_dead(void);
+void __noreturn native_play_dead(void);
 void play_dead_common(void);
 void wbinvd_on_cpu(int cpu);
 void wbinvd_on_all_cpus(void);
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index eb289ab..a4ba735 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1328,11 +1328,7 @@ void __noreturn hlt_play_dead(void)
 		native_halt();
 }
 
-/*
- * native_play_dead() is essentially a __noreturn function, but it can't
- * be marked as such as the compiler may complain about it.
- */
-void native_play_dead(void)
+void __noreturn native_play_dead(void)
 {
 	if (cpu_feature_enabled(X86_FEATURE_KERNEL_IBRS))
 		__update_spec_ctrl(0);
@@ -1351,7 +1347,7 @@ int native_cpu_disable(void)
 	return -ENOSYS;
 }
 
-void native_play_dead(void)
+void __noreturn native_play_dead(void)
 {
 	BUG();
 }
diff --git a/tools/objtool/noreturns.h b/tools/objtool/noreturns.h
index 802895f..14f8ab6 100644
--- a/tools/objtool/noreturns.h
+++ b/tools/objtool/noreturns.h
@@ -36,6 +36,7 @@ NORETURN(machine_real_restart)
 NORETURN(make_task_dead)
 NORETURN(mpt_halt_firmware)
 NORETURN(mwait_play_dead)
+NORETURN(native_play_dead)
 NORETURN(nmi_panic_self_stop)
 NORETURN(panic)
 NORETURN(vpanic)

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

end of thread, other threads:[~2025-10-31 11:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-27 15:51 [PATCH] x86/smpboot: Mark native_play_dead() as __noreturn Thorsten Blum
2025-10-27 19:28 ` Josh Poimboeuf
2025-10-27 19:56   ` Thorsten Blum
2025-10-27 20:32     ` Josh Poimboeuf
2025-10-31 11:04 ` [tip: objtool/core] " tip-bot2 for Thorsten Blum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.