aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common/domain.c
diff options
context:
space:
mode:
authorKeir Fraser <keir@xen.org>2010-11-18 12:26:27 +0000
committerKeir Fraser <keir@xen.org>2010-11-18 12:26:27 +0000
commit6020fcb84859f63343a74f46bf2f2d3d8e5a195c (patch)
tree1bdf67153b6ed3e95b111e4f6b5d23a8a959041f /xen/common/domain.c
parent652ec2d1ec8c2c79dce01dc9136c0dfefeabc13e (diff)
downloadxen-6020fcb84859f63343a74f46bf2f2d3d8e5a195c.tar.gz
xen-6020fcb84859f63343a74f46bf2f2d3d8e5a195c.tar.bz2
xen-6020fcb84859f63343a74f46bf2f2d3d8e5a195c.zip
rcu_lock(current->domain) does not need to disable preemption.
If the guest sleeps in hypervisor context, it should not be destroyed until execution reaches a safe point (i.e., guest context). This is not implemented yet. :-) But the next patch will rely on it, to allow an HVM guest to execute hypercalls that indirectly invoke __hvm_copy() within an rcu_lock_current_domain() region. Signed-off-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/common/domain.c')
-rw-r--r--xen/common/domain.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 1a08636756..803c640a7f 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -398,7 +398,7 @@ struct domain *get_domain_by_id(domid_t dom)
struct domain *rcu_lock_domain_by_id(domid_t dom)
{
- struct domain *d;
+ struct domain *d = NULL;
rcu_read_lock(&domlist_read_lock);
@@ -407,12 +407,15 @@ struct domain *rcu_lock_domain_by_id(domid_t dom)
d = rcu_dereference(d->next_in_hashbucket) )
{
if ( d->domain_id == dom )
- return d;
+ {
+ rcu_lock_domain(d);
+ break;
+ }
}
rcu_read_unlock(&domlist_read_lock);
- return NULL;
+ return d;
}
int rcu_lock_target_domain_by_id(domid_t dom, struct domain **d)