mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] x86/smp: Move the static call update for 'smp_ops' into smp_prepare_boot_cpu()
@ 2026-01-22 14:15 Hou Wenlong
  2026-01-22 14:15 ` [PATCH 2/2] x86/smp: Don't export x86_smp_ops_static_call_update() Hou Wenlong
  2026-01-22 14:21 ` [PATCH 1/2] x86/smp: Move the static call update for 'smp_ops' into smp_prepare_boot_cpu() Borislav Petkov
  0 siblings, 2 replies; 4+ messages in thread
From: Hou Wenlong @ 2026-01-22 14:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: Hou Wenlong, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, H. Peter Anvin, Juergen Gross, Boris Ostrovsky,
	Peter Zijlstra, Rafael J. Wysocki, K Prateek Nayak, Li Chen,
	Brian Gerst, Sohil Mehta, Tim Chen, Patryk Wlazlyn, Eric Dumazet,
	xen-devel

The commit 1f60230cdc63 ("x86/smp: Use static_call for
arch_send_call_function_ipi()") changed to use a static call for
arch_send_call_function_ipi(), which causes two problems:

First, the KVM guest also changes 'smp_ops.send_call_func_ipi' when the
PV sched yield feature is available. However, the missing
static_call_update() breaks the PV sched yield feature.

Additionally, xen_smp_init() is called before static_call_init() during
the booting of the XENPV guest, which triggers a warning in
__static_call_update().

To simplify, move the static call update for 'smp_ops' into
smp_prepare_boot_cpu() to address these two problems together.

Fixes: 1f60230cdc63 ("x86/smp: Use static_call for arch_send_call_function_ipi()")
Signed-off-by: Hou Wenlong <houwenlong.hwl@antgroup.com>
---
I'm not sure if the XEN part is okay or not. I think there should be no
IPI before smp_prepare_boot_cpu(), and even if there is, it's okay for
the KVM guest to use the native version before smp_prepare_boot_cpu().
---
 arch/x86/kernel/smpboot.c | 1 +
 arch/x86/xen/smp_hvm.c    | 1 -
 arch/x86/xen/smp_pv.c     | 1 -
 3 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 5cd6950ab672..84b8a4163ddb 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1088,6 +1088,7 @@ void __init smp_prepare_cpus_common(void)
 
 void __init smp_prepare_boot_cpu(void)
 {
+	x86_smp_ops_static_call_update();
 	smp_ops.smp_prepare_boot_cpu();
 }
 
diff --git a/arch/x86/xen/smp_hvm.c b/arch/x86/xen/smp_hvm.c
index 5ea0f53e4ea3..485c1d8804f7 100644
--- a/arch/x86/xen/smp_hvm.c
+++ b/arch/x86/xen/smp_hvm.c
@@ -85,5 +85,4 @@ void __init xen_hvm_smp_init(void)
 	smp_ops.smp_send_reschedule = xen_smp_send_reschedule;
 	smp_ops.send_call_func_ipi = xen_smp_send_call_function_ipi;
 	smp_ops.send_call_func_single_ipi = xen_smp_send_call_function_single_ipi;
-	x86_smp_ops_static_call_update();
 }
diff --git a/arch/x86/xen/smp_pv.c b/arch/x86/xen/smp_pv.c
index 72a334b32c32..c40f326f0c3a 100644
--- a/arch/x86/xen/smp_pv.c
+++ b/arch/x86/xen/smp_pv.c
@@ -441,7 +441,6 @@ static const struct smp_ops xen_smp_ops __initconst = {
 void __init xen_smp_init(void)
 {
 	smp_ops = xen_smp_ops;
-	x86_smp_ops_static_call_update();
 
 	/* Avoid searching for BIOS MP tables */
 	x86_init.mpparse.find_mptable		= x86_init_noop;
-- 
2.31.1


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

* [PATCH 2/2] x86/smp: Don't export x86_smp_ops_static_call_update()
  2026-01-22 14:15 [PATCH 1/2] x86/smp: Move the static call update for 'smp_ops' into smp_prepare_boot_cpu() Hou Wenlong
@ 2026-01-22 14:15 ` Hou Wenlong
  2026-01-22 14:21 ` [PATCH 1/2] x86/smp: Move the static call update for 'smp_ops' into smp_prepare_boot_cpu() Borislav Petkov
  1 sibling, 0 replies; 4+ messages in thread
From: Hou Wenlong @ 2026-01-22 14:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: Hou Wenlong, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, H. Peter Anvin, Peter Zijlstra (Intel),
	Eric Dumazet, Rafael J. Wysocki

x86_smp_ops_static_call_update() is only used in the kernel instead of a
module, so there is no need to export it.

Signed-off-by: Hou Wenlong <houwenlong.hwl@antgroup.com>
---
 arch/x86/kernel/smp.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c
index 4633ade87993..e19ff954d86c 100644
--- a/arch/x86/kernel/smp.c
+++ b/arch/x86/kernel/smp.c
@@ -317,7 +317,6 @@ void x86_smp_ops_static_call_update(void)
 	static_call_update(x86_smp_send_reschedule,
 			   smp_ops.smp_send_reschedule);
 }
-EXPORT_SYMBOL_GPL(x86_smp_ops_static_call_update);
 
 int arch_cpu_rescan_dead_smt_siblings(void)
 {
-- 
2.31.1


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

* Re: [PATCH 1/2] x86/smp: Move the static call update for 'smp_ops' into smp_prepare_boot_cpu()
  2026-01-22 14:15 [PATCH 1/2] x86/smp: Move the static call update for 'smp_ops' into smp_prepare_boot_cpu() Hou Wenlong
  2026-01-22 14:15 ` [PATCH 2/2] x86/smp: Don't export x86_smp_ops_static_call_update() Hou Wenlong
@ 2026-01-22 14:21 ` Borislav Petkov
  2026-01-23  3:04   ` Hou Wenlong
  1 sibling, 1 reply; 4+ messages in thread
From: Borislav Petkov @ 2026-01-22 14:21 UTC (permalink / raw)
  To: Hou Wenlong
  Cc: linux-kernel, Thomas Gleixner, Ingo Molnar, Dave Hansen, x86,
	H. Peter Anvin, Juergen Gross, Boris Ostrovsky, Peter Zijlstra,
	Rafael J. Wysocki, K Prateek Nayak, Li Chen, Brian Gerst,
	Sohil Mehta, Tim Chen, Patryk Wlazlyn, Eric Dumazet, xen-devel

On Thu, Jan 22, 2026 at 10:15:43PM +0800, Hou Wenlong wrote:
> The commit 1f60230cdc63 ("x86/smp: Use static_call for
> arch_send_call_function_ipi()") changed to use a static call for
> arch_send_call_function_ipi(), which causes two problems:
> 
> First, the KVM guest also changes 'smp_ops.send_call_func_ipi' when the
> PV sched yield feature is available. However, the missing
> static_call_update() breaks the PV sched yield feature.
> 
> Additionally, xen_smp_init() is called before static_call_init() during
> the booting of the XENPV guest, which triggers a warning in
> __static_call_update().
> 
> To simplify, move the static call update for 'smp_ops' into
> smp_prepare_boot_cpu() to address these two problems together.
> 
> Fixes: 1f60230cdc63 ("x86/smp: Use static_call for arch_send_call_function_ipi()")
> Signed-off-by: Hou Wenlong <houwenlong.hwl@antgroup.com>
> ---
> I'm not sure if the XEN part is okay or not. I think there should be no
> IPI before smp_prepare_boot_cpu(), and even if there is, it's okay for
> the KVM guest to use the native version before smp_prepare_boot_cpu().

All three commits zapped from tip:x86/core.

We can try again once this is resolved.

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

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

* Re: [PATCH 1/2] x86/smp: Move the static call update for 'smp_ops' into smp_prepare_boot_cpu()
  2026-01-22 14:21 ` [PATCH 1/2] x86/smp: Move the static call update for 'smp_ops' into smp_prepare_boot_cpu() Borislav Petkov
@ 2026-01-23  3:04   ` Hou Wenlong
  0 siblings, 0 replies; 4+ messages in thread
From: Hou Wenlong @ 2026-01-23  3:04 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: linux-kernel, Thomas Gleixner, Ingo Molnar, Dave Hansen, x86,
	H. Peter Anvin, Juergen Gross, Boris Ostrovsky, Peter Zijlstra,
	Rafael J. Wysocki, K Prateek Nayak, Li Chen, Brian Gerst,
	Sohil Mehta, Tim Chen, Patryk Wlazlyn, Eric Dumazet, xen-devel

On Thu, Jan 22, 2026 at 03:21:56PM +0100, Borislav Petkov wrote:
> On Thu, Jan 22, 2026 at 10:15:43PM +0800, Hou Wenlong wrote:
> > The commit 1f60230cdc63 ("x86/smp: Use static_call for
> > arch_send_call_function_ipi()") changed to use a static call for
> > arch_send_call_function_ipi(), which causes two problems:
> > 
> > First, the KVM guest also changes 'smp_ops.send_call_func_ipi' when the
> > PV sched yield feature is available. However, the missing
> > static_call_update() breaks the PV sched yield feature.
> > 
> > Additionally, xen_smp_init() is called before static_call_init() during
> > the booting of the XENPV guest, which triggers a warning in
> > __static_call_update().
> > 
> > To simplify, move the static call update for 'smp_ops' into
> > smp_prepare_boot_cpu() to address these two problems together.
> > 
> > Fixes: 1f60230cdc63 ("x86/smp: Use static_call for arch_send_call_function_ipi()")
> > Signed-off-by: Hou Wenlong <houwenlong.hwl@antgroup.com>
> > ---
> > I'm not sure if the XEN part is okay or not. I think there should be no
> > IPI before smp_prepare_boot_cpu(), and even if there is, it's okay for
> > the KVM guest to use the native version before smp_prepare_boot_cpu().
> 
> All three commits zapped from tip:x86/core.
> 
> We can try again once this is resolved.
>

Get it, thanks!

> Thx.
> 
> -- 
> Regards/Gruss,
>     Boris.
> 
> https://people.kernel.org/tglx/notes-about-netiquette

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

end of thread, other threads:[~2026-01-23  3:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-22 14:15 [PATCH 1/2] x86/smp: Move the static call update for 'smp_ops' into smp_prepare_boot_cpu() Hou Wenlong
2026-01-22 14:15 ` [PATCH 2/2] x86/smp: Don't export x86_smp_ops_static_call_update() Hou Wenlong
2026-01-22 14:21 ` [PATCH 1/2] x86/smp: Move the static call update for 'smp_ops' into smp_prepare_boot_cpu() Borislav Petkov
2026-01-23  3:04   ` Hou Wenlong

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

all inboxes | Powered by JetHome®