Signed-off-by: Keir Fraser <keir@xensource.com>
/* Already dying? Then bail. */
if ( xchg(&d->is_dying, 1) )
+ {
+ domain_unpause(d);
return;
+ }
/* Tear down state /after/ setting the dying flag. */
smp_wmb();
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);
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;