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

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®