On 11/02/15 13:47, Jan Beulich wrote:
> XEN_DOMCTL_destroydomain so far is being special cased in libxc to
> reinvoke the operation when getting back EAGAIN. Quite a few other
> domctl-s have gained continuations, so I see no reason not to use them
> here too.
>
> Signed-off-by: Jan Beulich <jbeul...@suse.com>

In particular, it ought to be much more efficient as it avoids the
kernel/user context switches, and associated TLB flushes.

Reviewed-by: Andrew Cooper <andrew.coop...@citrix.com>

>
> --- a/tools/libxc/xc_domain.c
> +++ b/tools/libxc/xc_domain.c
> @@ -112,14 +112,10 @@ int xc_domain_unpause(xc_interface *xch,
>  int xc_domain_destroy(xc_interface *xch,
>                        uint32_t domid)
>  {
> -    int ret;
>      DECLARE_DOMCTL;
>      domctl.cmd = XEN_DOMCTL_destroydomain;
>      domctl.domain = (domid_t)domid;
> -    do {
> -        ret = do_domctl(xch, &domctl);
> -    } while ( ret && (errno == EAGAIN) );
> -    return ret;
> +    return do_domctl(xch, &domctl);
>  }
>  
>  int xc_domain_shutdown(xc_interface *xch,
> --- a/xen/common/domain.c
> +++ b/xen/common/domain.c
> @@ -617,13 +617,9 @@ int domain_kill(struct domain *d)
>      case DOMDYING_dying:
>          rc = domain_relinquish_resources(d);
>          if ( rc != 0 )
> -        {
> -            if ( rc == -ERESTART )
> -                rc = -EAGAIN;
>              break;
> -        }
>          if ( cpupool_move_domain(d, cpupool0) )
> -            return -EAGAIN;
> +            return -ERESTART;
>          for_each_vcpu ( d, v )
>              unmap_vcpu_info(v);
>          d->is_dying = DOMDYING_dead;
> --- a/xen/common/domctl.c
> +++ b/xen/common/domctl.c
> @@ -692,10 +692,11 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xe
>      break;
>  
>      case XEN_DOMCTL_destroydomain:
> -    {
>          ret = domain_kill(d);
> -    }
> -    break;
> +        if ( ret == -ERESTART )
> +            ret = hypercall_create_continuation(
> +                __HYPERVISOR_domctl, "h", u_domctl);
> +        break;
>  
>      case XEN_DOMCTL_setnodeaffinity:
>      {
>
>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

Reply via email to