Skip to contentSkip to conversation

x86/setup: delay setting SYS_STATE_smp_boot

PATCH In review Roger Pau Monne 1 participant 2 messages May 16, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/setup: delay setting SYS_STATE_smp_boot

Booting with Shadow Stacks leads to the following assert on a debug hypervisor:

(XEN) [   11.625166] Assertion 'local_irq_is_enabled()' failed at arch/x86/smp.c:265
(XEN) [   11.629410] ----[ Xen-4.17.0-10.24-d  x86_64  debug=y  Not tainted ]----
(XEN) [   11.633679] CPU:    0
(XEN) [   11.637834] RIP:    e008:[<ffff82d040345300>] flush_area_mask+0x40/0x13e
[...]
(XEN) [   11.806158] Xen call trace:
(XEN) [   11.811255]    [<ffff82d040345300>] R flush_area_mask+0x40/0x13e
(XEN) [   11.816459]    [<ffff82d040338a40>] F modify_xen_mappings+0xc5/0x958
(XEN) [   11.821689]    [<ffff82d0404474f9>] F arch/x86/alternative.c#_alternative_instructions+0xb7/0xb9
(XEN) [   11.827053]    [<ffff82d0404476cc>] F alternative_branches+0xf/0x12
(XEN) [   11.832416]    [<ffff82d04044e37d>] F __start_xen+0x1ef4/0x2776
(XEN) [   11.837809]    [<ffff82d040203344>] F __high_start+0x94/0xa0

Fix this by switching to state SYS_STATE_smp_boot after alternatives have been applied.

Fixes (78e072bc37 'x86/mm: avoid inadvertently degrading a TLB flush to local only')
---
 xen/arch/x86/setup.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
xen/arch/x86/setup.c +2 -2
index 53a73010e0..318f02f6ae 100644
@@ -1853,12 +1853,12 @@ void __init noreturn __start_xen(unsigned long mbi_p)
 
     console_init_postirq();
 
-    system_state = SYS_STATE_smp_boot;
-
     do_presmp_initcalls();
 
     alternative_branches();
 
+    system_state = SYS_STATE_smp_boot;
+
     /*
      * NB: when running as a PV shim VCPUOP_up/down is wired to the shim
      * physical cpu_add/remove functions, so launch the guest with only
Signature · 1 line
2.36.0
#1 lore raw
Quoted 16 lines · Roger Pau Monne

Booting with Shadow Stacks leads to the following assert on a debug hypervisor:

(XEN) [   11.625166] Assertion 'local_irq_is_enabled()' failed at arch/x86/smp.c:265
(XEN) [   11.629410] ----[ Xen-4.17.0-10.24-d  x86_64  debug=y  Not tainted ]----
(XEN) [   11.633679] CPU:    0
(XEN) [   11.637834] RIP:    e008:[<ffff82d040345300>] flush_area_mask+0x40/0x13e
[...]
(XEN) [   11.806158] Xen call trace:
(XEN) [   11.811255]    [<ffff82d040345300>] R flush_area_mask+0x40/0x13e
(XEN) [   11.816459]    [<ffff82d040338a40>] F modify_xen_mappings+0xc5/0x958
(XEN) [   11.821689]    [<ffff82d0404474f9>] F arch/x86/alternative.c#_alternative_instructions+0xb7/0xb9
(XEN) [   11.827053]    [<ffff82d0404476cc>] F alternative_branches+0xf/0x12
(XEN) [   11.832416]    [<ffff82d04044e37d>] F __start_xen+0x1ef4/0x2776
(XEN) [   11.837809]    [<ffff82d040203344>] F __high_start+0x94/0xa0
Quoted 2 lines

Fix this by switching to state SYS_STATE_smp_boot after alternatives have been applied.

Consider this patch superseded by:

https://lore.kernel.org/xen-devel/[email protected]

Thanks, Roger.