ia64/xen-unstable

changeset 14676:36ff129dbd8b

xen: Fix domain shutdown to synchronously stop domain execution.
Signed-off-by: Keir Fraser <keir@xensource.com>
author Keir Fraser <keir@xensource.com>
date Fri Mar 30 18:39:34 2007 +0100 (2007-03-30)
parents 5138c48c7138
children 2b715386b4cf
files xen/common/domain.c xen/common/domctl.c
line diff
     1.1 --- a/xen/common/domain.c	Fri Mar 30 17:33:31 2007 +0100
     1.2 +++ b/xen/common/domain.c	Fri Mar 30 18:39:34 2007 +0100
     1.3 @@ -265,7 +265,10 @@ void domain_kill(struct domain *d)
     1.4  
     1.5      /* Already dying? Then bail. */
     1.6      if ( xchg(&d->is_dying, 1) )
     1.7 +    {
     1.8 +        domain_unpause(d);
     1.9          return;
    1.10 +    }
    1.11  
    1.12      /* Tear down state /after/ setting the dying flag. */
    1.13      smp_wmb();
    1.14 @@ -332,8 +335,11 @@ void domain_shutdown(struct domain *d, u
    1.15      if ( d->domain_id == 0 )
    1.16          dom0_shutdown(reason);
    1.17  
    1.18 +    atomic_inc(&d->pause_count);
    1.19      if ( !xchg(&d->is_shutdown, 1) )
    1.20          d->shutdown_code = reason;
    1.21 +    else
    1.22 +        domain_unpause(d);
    1.23  
    1.24      for_each_vcpu ( d, v )
    1.25          vcpu_sleep_nosync(v);
     2.1 --- a/xen/common/domctl.c	Fri Mar 30 17:33:31 2007 +0100
     2.2 +++ b/xen/common/domctl.c	Fri Mar 30 18:39:34 2007 +0100
     2.3 @@ -282,17 +282,15 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc
     2.4      case XEN_DOMCTL_resumedomain:
     2.5      {
     2.6          struct domain *d = rcu_lock_domain_by_id(op->domain);
     2.7 -        struct vcpu *v;
     2.8  
     2.9          ret = -ESRCH;
    2.10 -        if ( d != NULL )
    2.11 -        {
    2.12 -            ret = 0;
    2.13 -            if ( xchg(&d->is_shutdown, 0) )
    2.14 -                for_each_vcpu ( d, v )
    2.15 -                    vcpu_wake(v);
    2.16 -            rcu_unlock_domain(d);
    2.17 -        }
    2.18 +        if ( d == NULL )
    2.19 +            break;
    2.20 +
    2.21 +        if ( xchg(&d->is_shutdown, 0) )
    2.22 +            domain_unpause(d);
    2.23 +        rcu_unlock_domain(d);
    2.24 +        ret = 0;
    2.25      }
    2.26      break;
    2.27