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

[Xen-devel] [PATCH RFC 04/44] x86/boot: Introduce cpu_smpboot_bsp() to dynamically allocate BSP state



Move the existing stub allocation into the new function, and call it before
initialising the idle domain; eventually it will allocate the pagetables for
the idle vcpu to use.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/arch/x86/setup.c      |  6 ++----
 xen/arch/x86/smpboot.c    | 15 +++++++++++++++
 xen/include/asm-x86/smp.h |  1 +
 3 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 2e10c6b..64286f7 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1502,11 +1502,9 @@ void __init noreturn __start_xen(unsigned long mbi_p)
     if ( cpu_has_fsgsbase )
         set_in_cr4(X86_CR4_FSGSBASE);
 
-    init_idle_domain();
+    cpu_smpboot_bsp();
 
-    this_cpu(stubs.addr) = alloc_stub_page(smp_processor_id(),
-                                           &this_cpu(stubs).mfn);
-    BUG_ON(!this_cpu(stubs.addr));
+    init_idle_domain();
 
     trap_init();
 
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index e7fa159..36b87dd 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -756,6 +756,21 @@ static int cpu_smpboot_alloc(unsigned int cpu)
     return rc;
 }
 
+void __init cpu_smpboot_bsp(void)
+{
+    unsigned int cpu = smp_processor_id();
+    int rc = -ENOMEM;
+
+    if ( (per_cpu(stubs.addr, cpu) =
+          alloc_stub_page(cpu, &per_cpu(stubs, cpu).mfn)) == 0 )
+        goto err;
+
+    return;
+
+ err:
+    panic("Error preparing BSP smpboot data: %d", rc);
+}
+
 static int cpu_smpboot_callback(
     struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
diff --git a/xen/include/asm-x86/smp.h b/xen/include/asm-x86/smp.h
index 4e5f673..409f3af 100644
--- a/xen/include/asm-x86/smp.h
+++ b/xen/include/asm-x86/smp.h
@@ -53,6 +53,7 @@ int cpu_add(uint32_t apic_id, uint32_t acpi_id, uint32_t pxm);
 
 void __stop_this_cpu(void);
 
+void cpu_smpboot_bsp(void);
 long cpu_up_helper(void *data);
 long cpu_down_helper(void *data);
 
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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