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

[Xen-changelog] [linux-2.6.18-xen] Do not allocate vcpu_guest_context on the stack when initialising a



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1201864272 0
# Node ID 687ef5a4fcb7c6a0c8fe90ab25ce58a465c1cb4b
# Parent  e32fe4703ab68245dedcf32d76510623ba86953a
Do not allocate vcpu_guest_context on the stack when initialising a
new VCPU. It is too big for 4kB stacks.
Original patch by Donald Dutile <ddutile@xxxxxxxxxx> backported from
upstream pv_ops work.
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 drivers/xen/core/smpboot.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff -r e32fe4703ab6 -r 687ef5a4fcb7 drivers/xen/core/smpboot.c
--- a/drivers/xen/core/smpboot.c        Tue Jan 29 11:53:33 2008 +0000
+++ b/drivers/xen/core/smpboot.c        Fri Feb 01 11:11:12 2008 +0000
@@ -182,7 +182,11 @@ static void __cpuinit cpu_bringup_and_id
 
 static void __cpuinit cpu_initialize_context(unsigned int cpu)
 {
-       vcpu_guest_context_t ctxt;
+       /* vcpu_guest_context_t is too large to allocate on the stack.
+        * Hence we allocate statically and protect it with a lock */
+       static vcpu_guest_context_t ctxt;
+       static DEFINE_SPINLOCK(ctxt_lock);
+
        struct task_struct *idle = idle_task(cpu);
 #ifdef __x86_64__
        struct desc_ptr *gdt_descr = &cpu_gdt_descr[cpu];
@@ -192,6 +196,8 @@ static void __cpuinit cpu_initialize_con
 
        if (cpu_test_and_set(cpu, cpu_initialized_map))
                return;
+
+       spin_lock(&ctxt_lock);
 
        memset(&ctxt, 0, sizeof(ctxt));
 
@@ -242,7 +248,10 @@ static void __cpuinit cpu_initialize_con
        ctxt.gs_base_kernel = (unsigned long)(cpu_pda(cpu));
 #endif
 
-       BUG_ON(HYPERVISOR_vcpu_op(VCPUOP_initialise, cpu, &ctxt));
+       if (HYPERVISOR_vcpu_op(VCPUOP_initialise, cpu, &ctxt))
+               BUG();
+
+       spin_unlock(&ctxt_lock);
 }
 
 void __init smp_prepare_cpus(unsigned int max_cpus)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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