diff options
author | Keir Fraser <keir@xen.org> | 2011-11-24 15:49:25 +0000 |
---|---|---|
committer | Keir Fraser <keir@xen.org> | 2011-11-24 15:49:25 +0000 |
commit | 9333781f509b67bf5c08a790664a660bab3dc819 (patch) | |
tree | 5631889cbfa93aadb3c9dc7448ebd578801622b6 /xen/common/wait.c | |
parent | 7d798b7c997fe7631431275371d134ae3e926be7 (diff) | |
download | xen-9333781f509b67bf5c08a790664a660bab3dc819.tar.gz xen-9333781f509b67bf5c08a790664a660bab3dc819.tar.bz2 xen-9333781f509b67bf5c08a790664a660bab3dc819.zip |
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@xen.org>
Diffstat (limited to 'xen/common/wait.c')
-rw-r--r-- | xen/common/wait.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/xen/common/wait.c b/xen/common/wait.c index cf515b1aee..b125dc5be2 100644 --- a/xen/common/wait.c +++ b/xen/common/wait.c @@ -107,6 +107,8 @@ static void __prepare_to_wait(struct waitqueue_vcpu *wqv) { 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 @@ void prepare_to_wait(struct waitqueue_head *wq) struct waitqueue_vcpu *wqv = curr->waitqueue_vcpu; ASSERT(!in_atomic()); - ASSERT(list_empty(&wqv->list)); + __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) |