[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v8 57/65] x86/setup: allocate the BSP's stack after the speculation mitigations



From: Roger Pau Monne <roger.pau@xxxxxxxxxx>

The BSP's heap stack is allocated as soon as the heap has all memory,
long before the BSP moves to it at the end of __start_xen().  A later
change maps it a second time when the cpu-stack option, resolved with
the speculation mitigations, is in use, and that mapping needs
interrupts enabled.

Rather than allocate it early in the function and then map it way
later, when both requirements hold, move the allocation down so that
the later change can be added immediately after.  No functional
change.

Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
Assisted-by: Claude Code:claude-fable-5, Claude Code:claude-opus-4-8, Claude 
Code:claude-opus-5-5
Signed-off-by: George Dunlap <gwd@xxxxxxxxxxxxxx>
---
Changes in v8:
- New in this version.

Changes since previously posted version ("x86: adventures in Address Space 
Isolation", v2):
- Split out of "x86/mm: switch to a per-CPU mapped stack when using
  ASI" (now "x86/mm: run every CPU on a per-CPU stack address").
---
 xen/arch/x86/setup.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index b71c42263e..3a9edb7427 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1942,10 +1942,6 @@ void asmlinkage __init noreturn __start_xen(void)
     /* The heap now has all memory, and page-tables come from it. */
     sparse_dmap_init();
 
-    bsp_stack = cpu_alloc_stack(0); /* Needs to know IDT vs FRED */
-    if ( !bsp_stack )
-        panic("No memory for BSP stack\n");
-
     console_init_ring();
     vesa_init();
 
@@ -2134,6 +2130,10 @@ void asmlinkage __init noreturn __start_xen(void)
 
     boot_apply_alt_calls();
 
+    bsp_stack = cpu_alloc_stack(0); /* Needs to know IDT vs FRED */
+    if ( !bsp_stack )
+        panic("No memory for BSP stack\n");
+
     /*
      * 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
-- 
2.56.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.