All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] domctl: do away with tool stack based retrying
@ 2015-02-11 13:47 Jan Beulich
  2015-02-11 14:02 ` Andrew Cooper
  2015-02-13 14:34 ` Wei Liu
  0 siblings, 2 replies; 4+ messages in thread
From: Jan Beulich @ 2015-02-11 13:47 UTC (permalink / raw)
  To: xen-devel
  Cc: Keir Fraser, Stefano Stabellini, Tim Deegan, Ian Jackson,
	Ian Campbell, Wei Liu

[-- Attachment #1: Type: text/plain, Size: 1793 bytes --]

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 <jbeulich@suse.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:
     {




[-- Attachment #2: domctl-destroy-dom-continuation.patch --]
[-- Type: text/plain, Size: 1837 bytes --]

domctl: do away with tool stack based retrying

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 <jbeulich@suse.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:
     {

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] domctl: do away with tool stack based retrying
  2015-02-11 13:47 [PATCH] domctl: do away with tool stack based retrying Jan Beulich
@ 2015-02-11 14:02 ` Andrew Cooper
  2015-02-13 14:34 ` Wei Liu
  1 sibling, 0 replies; 4+ messages in thread
From: Andrew Cooper @ 2015-02-11 14:02 UTC (permalink / raw)
  To: Jan Beulich, xen-devel
  Cc: Wei Liu, Stefano Stabellini, Ian Jackson, Tim Deegan,
	Ian Campbell, Keir Fraser


[-- Attachment #1.1: Type: text/plain, Size: 2286 bytes --]

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 <jbeulich@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.cooper3@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


[-- Attachment #1.2: Type: text/html, Size: 3057 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] domctl: do away with tool stack based retrying
  2015-02-11 13:47 [PATCH] domctl: do away with tool stack based retrying Jan Beulich
  2015-02-11 14:02 ` Andrew Cooper
@ 2015-02-13 14:34 ` Wei Liu
  2015-02-18 13:31   ` Ian Campbell
  1 sibling, 1 reply; 4+ messages in thread
From: Wei Liu @ 2015-02-13 14:34 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Wei Liu, Keir Fraser, Stefano Stabellini, Tim Deegan,
	Ian Jackson, Ian Campbell, xen-devel

On Wed, Feb 11, 2015 at 01:47:09PM +0000, 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 <jbeulich@suse.com>
> 

Acked-by: Wei Liu <wei.liu2@citrix.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] domctl: do away with tool stack based retrying
  2015-02-13 14:34 ` Wei Liu
@ 2015-02-18 13:31   ` Ian Campbell
  0 siblings, 0 replies; 4+ messages in thread
From: Ian Campbell @ 2015-02-18 13:31 UTC (permalink / raw)
  To: Wei Liu
  Cc: Keir Fraser, Stefano Stabellini, Ian Jackson, Tim Deegan,
	Jan Beulich, xen-devel

On Fri, 2015-02-13 at 14:34 +0000, Wei Liu wrote:
> On Wed, Feb 11, 2015 at 01:47:09PM +0000, 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 <jbeulich@suse.com>
> > 
> 
> Acked-by: Wei Liu <wei.liu2@citrix.com>

Acked-by: Ian Campbell <ian.campbell@citrix.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-02-18 13:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-11 13:47 [PATCH] domctl: do away with tool stack based retrying Jan Beulich
2015-02-11 14:02 ` Andrew Cooper
2015-02-13 14:34 ` Wei Liu
2015-02-18 13:31   ` Ian Campbell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.