domctl: do away with tool stack based retrying
authorJan Beulich <jbeulich@suse.com>
Wed, 18 Feb 2015 15:57:02 +0000 (16:57 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 18 Feb 2015 15:57:02 +0000 (16:57 +0100)
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>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/libxc/xc_domain.c
xen/common/domain.c
xen/common/domctl.c

index b8648720f7741477e0f5e296d7e5dfcaa9296987..845d1d7722af4b18f7d6a7d81daa7811509f842e 100644 (file)
@@ -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,
index 0b0568191a83642905c8b9989fe616fc443f4faa..aa78fd74e2fdfd004f8c625cee435e7dbe2b5b3d 100644 (file)
@@ -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;
index 33ecd454a0f1b78404397e0d7d0c0a7176b74b18..4a42c6656f12544c8e2f00c3271e9d8485dd8d82 100644 (file)
@@ -692,10 +692,11 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
     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:
     {