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

[Xen-devel] [PATCH] waitqueue: increase stack array


  • To: xen-devel@xxxxxxxxxxxxxxxxxxx
  • From: Olaf Hering <olaf@xxxxxxxxx>
  • Date: Tue, 08 Nov 2011 18:34:53 +0100
  • Delivery-date: Tue, 08 Nov 2011 09:38:41 -0800
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

# HG changeset patch
# User Olaf Hering <olaf@xxxxxxxxx>
# Date 1320773665 -3600
# Node ID 455f064fe54eeb57a43aa0c45a56cc4c4847d7a0
# Parent  c6f1423918baecb7a11eb7a151b9d5fb00888228
waitqueue: increase stack array

In my testing 1500 bytes were not enough, at least 1800 bytes were required.
Allocate a whole page for waitqueue_vcpu and use the remainder as stack array.

Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>

diff -r c6f1423918ba -r 455f064fe54e xen/common/wait.c
--- a/xen/common/wait.c
+++ b/xen/common/wait.c
@@ -33,7 +33,8 @@ struct waitqueue_vcpu {
      * hypervisor context before sleeping (descheduling), setjmp/longjmp-style.
      */
     void *esp;
-    char stack[1500];
+    unsigned short stack_len;
+    char stack[0];
 #endif
 };
 
@@ -41,12 +42,13 @@ int init_waitqueue_vcpu(struct vcpu *v)
 {
     struct waitqueue_vcpu *wqv;
 
-    wqv = xzalloc(struct waitqueue_vcpu);
+    wqv = alloc_xenheap_page();
     if ( wqv == NULL )
         return -ENOMEM;
 
     INIT_LIST_HEAD(&wqv->list);
     wqv->vcpu = v;
+    wqv->stack_len = PAGE_SIZE - sizeof(*wqv);
 
     v->waitqueue_vcpu = wqv;
 
@@ -62,7 +64,7 @@ void destroy_waitqueue_vcpu(struct vcpu 
         return;
 
     BUG_ON(!list_empty(&wqv->list));
-    xfree(wqv);
+    free_xenheap_page(wqv);
 
     v->waitqueue_vcpu = NULL;
 }
@@ -114,7 +116,7 @@ static void __prepare_to_wait(struct wai
         : "=S" (wqv->esp)
         : "c" (cpu_info), "D" (wqv->stack)
         : "memory" );
-    BUG_ON((cpu_info - (char *)wqv->esp) > sizeof(wqv->stack));
+    BUG_ON((cpu_info - (char *)wqv->esp) > wqv->stack_len);
 }
 
 static void __finish_wait(struct waitqueue_vcpu *wqv)

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


 


Rackspace

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