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

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



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1202135097 0
# Node ID 41cf298709339f07f60f315f0e4f6fbe09027237
# Parent  8af83080ec8981570b7d747094099b80d42b0e4f
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>
linux-2.6.18-xen changeset:   402:687ef5a4fcb7c6a0c8fe90ab25ce58a465c1cb4b
linux-2.6.18-xen date:        Fri Feb 01 11:11:12 2008 +0000
---
 linux-2.6-xen-sparse/drivers/xen/core/smpboot.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff -r 8af83080ec89 -r 41cf29870933 
linux-2.6-xen-sparse/drivers/xen/core/smpboot.c
--- a/linux-2.6-xen-sparse/drivers/xen/core/smpboot.c   Mon Feb 04 14:22:33 
2008 +0000
+++ b/linux-2.6-xen-sparse/drivers/xen/core/smpboot.c   Mon Feb 04 14:24:57 
2008 +0000
@@ -183,7 +183,11 @@ static void cpu_bringup_and_idle(void)
 
 static void 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];
@@ -193,6 +197,8 @@ static void cpu_initialize_context(unsig
 
        if (cpu_test_and_set(cpu, cpu_initialized_map))
                return;
+
+       spin_lock(&ctxt_lock);
 
        memset(&ctxt, 0, sizeof(ctxt));
 
@@ -243,7 +249,10 @@ static void cpu_initialize_context(unsig
        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®.