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

[Xen-changelog] [xen-unstable] waitqueue: Reorder prepare_to_wait() so that vcpu is definitely on the



# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1322149765 0
# Node ID de4fe05fe887d8c8ae71022ccd40cc9991def1bf
# Parent  9b65336f688f3b6b15ae11d74cebf88cd41ad19d
waitqueue: Reorder prepare_to_wait() so that vcpu is definitely on the
queue on exit, even after a wakeup.

Otherwise, when we go round the loop in wait_event(), we may not
actually sleep after the first iteration, as we do not put ourselves
back on the queue on wakeup.

Signed-off-by: Keir Fraser <keir@xxxxxxx>
---


diff -r 9b65336f688f -r de4fe05fe887 xen/common/wait.c
--- a/xen/common/wait.c Thu Nov 24 15:48:10 2011 +0000
+++ b/xen/common/wait.c Thu Nov 24 15:49:25 2011 +0000
@@ -107,6 +107,8 @@
 {
     char *cpu_info = (char *)get_cpu_info();
 
+    ASSERT(wqv->esp == 0);
+
     asm volatile (
 #ifdef CONFIG_X86_64
         "push %%rax; push %%rbx; push %%rcx; push %%rdx; push %%rdi; "
@@ -173,14 +175,13 @@
     struct waitqueue_vcpu *wqv = curr->waitqueue_vcpu;
 
     ASSERT(!in_atomic());
+    __prepare_to_wait(wqv);
+
     ASSERT(list_empty(&wqv->list));
-
     spin_lock(&wq->lock);
     list_add_tail(&wqv->list, &wq->list);
     vcpu_pause_nosync(curr);
     spin_unlock(&wq->lock);
-
-    __prepare_to_wait(wqv);
 }
 
 void finish_wait(struct waitqueue_head *wq)

_______________________________________________
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®.