aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common/wait.c
diff options
context:
space:
mode:
authorKeir Fraser <keir@xen.org>2011-11-25 20:32:05 +0000
committerKeir Fraser <keir@xen.org>2011-11-25 20:32:05 +0000
commitd93b583113fd9835960cd1479220e16e79d7081a (patch)
tree8503be66ba26117982d02567e638ea9c1e6ef0db /xen/common/wait.c
parent6eb91524ed2f167bb31aeb7bbf8455e06e4f48b6 (diff)
downloadxen-d93b583113fd9835960cd1479220e16e79d7081a.tar.gz
xen-d93b583113fd9835960cd1479220e16e79d7081a.tar.bz2
xen-d93b583113fd9835960cd1479220e16e79d7081a.zip
waitqueue: Hold a reference to a domain on a waitqueue.
Also allow waitqueues to be dynamically destroyed. Signed-off-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/common/wait.c')
-rw-r--r--xen/common/wait.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/xen/common/wait.c b/xen/common/wait.c
index a05ac4f57f..2fb2309ac0 100644
--- a/xen/common/wait.c
+++ b/xen/common/wait.c
@@ -87,6 +87,11 @@ void init_waitqueue_head(struct waitqueue_head *wq)
INIT_LIST_HEAD(&wq->list);
}
+void destroy_waitqueue_head(struct waitqueue_head *wq)
+{
+ wake_up_all(wq);
+}
+
void wake_up_nr(struct waitqueue_head *wq, unsigned int nr)
{
struct waitqueue_vcpu *wqv;
@@ -98,6 +103,7 @@ void wake_up_nr(struct waitqueue_head *wq, unsigned int nr)
wqv = list_entry(wq->list.next, struct waitqueue_vcpu, list);
list_del_init(&wqv->list);
vcpu_unpause(wqv->vcpu);
+ put_domain(wqv->vcpu->domain);
}
spin_unlock(&wq->lock);
@@ -218,6 +224,7 @@ void prepare_to_wait(struct waitqueue_head *wq)
spin_lock(&wq->lock);
list_add_tail(&wqv->list, &wq->list);
vcpu_pause_nosync(curr);
+ get_knownalive_domain(curr->domain);
spin_unlock(&wq->lock);
}
@@ -236,6 +243,7 @@ void finish_wait(struct waitqueue_head *wq)
{
list_del_init(&wqv->list);
vcpu_unpause(curr);
+ put_domain(curr->domain);
}
spin_unlock(&wq->lock);
}