WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] waitqueue: increase stack array
From: Olaf Hering <olaf@xxxxxxxxx>
Date: Tue, 08 Nov 2011 18:34:53 +0100
Delivery-date: Tue, 08 Nov 2011 09:38:41 -0800
Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1320773711; l=1592; s=domk; d=aepfle.de; h=To:From:Date:Subject:Content-Transfer-Encoding:MIME-Version: Content-Type:X-RZG-CLASS-ID:X-RZG-AUTH; bh=cx7gVFRVRWFx4t6w/P595EOliE8=; b=wikWR84j2JKMkyjXcPPCZtOWmJ+tU02tErnQaz5ED9qnMvO/dCWlHBhrji72Z+81Vl+ 04MRsbpclygeLUnTkbMUIEBiBfQCWb5Vgg3xMCMgB3d/btP1ddx9UMeS39iWVAFoozGDk rhUk9LGJxIkKms1YlexoQ1Y8Kg7rAcirm+0=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.7.5
# 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] waitqueue: increase stack array, Olaf Hering <=