]> xenbits.xensource.com Git - xen.git/commitdiff
xen: Fix domain shutdown to synchronously stop domain execution.
authorKeir Fraser <keir@xensource.com>
Fri, 30 Mar 2007 17:39:34 +0000 (18:39 +0100)
committerKeir Fraser <keir@xensource.com>
Fri, 30 Mar 2007 17:39:34 +0000 (18:39 +0100)
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/common/domain.c
xen/common/domctl.c

index 57d3c5a0747324b707135f8b90c9977c955372ad..b1f11b75d9222656218bd0a535e9e7c9fed715da 100644 (file)
@@ -265,7 +265,10 @@ void domain_kill(struct domain *d)
 
     /* Already dying? Then bail. */
     if ( xchg(&d->is_dying, 1) )
+    {
+        domain_unpause(d);
         return;
+    }
 
     /* Tear down state /after/ setting the dying flag. */
     smp_wmb();
@@ -332,8 +335,11 @@ void domain_shutdown(struct domain *d, u8 reason)
     if ( d->domain_id == 0 )
         dom0_shutdown(reason);
 
+    atomic_inc(&d->pause_count);
     if ( !xchg(&d->is_shutdown, 1) )
         d->shutdown_code = reason;
+    else
+        domain_unpause(d);
 
     for_each_vcpu ( d, v )
         vcpu_sleep_nosync(v);
index 01af47a008c6d6fe46ac5391ab82cf71d35d14b8..27fd4113639b0f74bd98dc1a78871b35af9fa8a8 100644 (file)
@@ -282,17 +282,15 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domctl_t) u_domctl)
     case XEN_DOMCTL_resumedomain:
     {
         struct domain *d = rcu_lock_domain_by_id(op->domain);
-        struct vcpu *v;
 
         ret = -ESRCH;
-        if ( d != NULL )
-        {
-            ret = 0;
-            if ( xchg(&d->is_shutdown, 0) )
-                for_each_vcpu ( d, v )
-                    vcpu_wake(v);
-            rcu_unlock_domain(d);
-        }
+        if ( d == NULL )
+            break;
+
+        if ( xchg(&d->is_shutdown, 0) )
+            domain_unpause(d);
+        rcu_unlock_domain(d);
+        ret = 0;
     }
     break;