From: "Jan Beulich" Subject: [PATCH] domctl: do away with tool stack based retrying Date: Wed, 11 Feb 2015 13:47:09 +0000 Message-ID: <54DB6B6D020000780005F100@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__PartF7C2754D.2__=" Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YLXdH-0005Y0-TC for xen-devel@lists.xenproject.org; Wed, 11 Feb 2015 13:47:12 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: Keir Fraser , Stefano Stabellini , Tim Deegan , Ian Jackson , Ian Campbell , Wei Liu List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__PartF7C2754D.2__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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 --- 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 =3D XEN_DOMCTL_destroydomain; domctl.domain =3D (domid_t)domid; - do { - ret =3D do_domctl(xch, &domctl); - } while ( ret && (errno =3D=3D EAGAIN) ); - return ret; + return do_domctl(xch, &domctl); } =20 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 =3D domain_relinquish_resources(d); if ( rc !=3D 0 ) - { - if ( rc =3D=3D -ERESTART ) - rc =3D -EAGAIN; break; - } if ( cpupool_move_domain(d, cpupool0) ) - return -EAGAIN; + return -ERESTART; for_each_vcpu ( d, v ) unmap_vcpu_info(v); d->is_dying =3D 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; =20 case XEN_DOMCTL_destroydomain: - { ret =3D domain_kill(d); - } - break; + if ( ret =3D=3D -ERESTART ) + ret =3D hypercall_create_continuation( + __HYPERVISOR_domctl, "h", u_domctl); + break; =20 case XEN_DOMCTL_setnodeaffinity: { --=__PartF7C2754D.2__= Content-Type: text/plain; name="domctl-destroy-dom-continuation.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="domctl-destroy-dom-continuation.patch" domctl: do away with tool stack based retrying=0A=0AXEN_DOMCTL_destroydomai= n so far is being special cased in libxc to=0Areinvoke the operation when = getting back EAGAIN. Quite a few other=0Adomctl-s have gained continuations= , so I see no reason not to use them=0Ahere too.=0A=0ASigned-off-by: Jan = Beulich =0A=0A--- a/tools/libxc/xc_domain.c=0A+++ = b/tools/libxc/xc_domain.c=0A@@ -112,14 +112,10 @@ int xc_domain_unpause(xc_= interface *xch,=0A int xc_domain_destroy(xc_interface *xch,=0A = uint32_t domid)=0A {=0A- int ret;=0A DECLARE_DOMCTL;=0A = domctl.cmd =3D XEN_DOMCTL_destroydomain;=0A domctl.domain =3D = (domid_t)domid;=0A- do {=0A- ret =3D do_domctl(xch, &domctl);=0A-= } while ( ret && (errno =3D=3D EAGAIN) );=0A- return ret;=0A+ = return do_domctl(xch, &domctl);=0A }=0A =0A int xc_domain_shutdown(xc_inter= face *xch,=0A--- a/xen/common/domain.c=0A+++ b/xen/common/domain.c=0A@@ = -617,13 +617,9 @@ int domain_kill(struct domain *d)=0A case DOMDYING_dy= ing:=0A rc =3D domain_relinquish_resources(d);=0A if ( rc = !=3D 0 )=0A- {=0A- if ( rc =3D=3D -ERESTART )=0A- = rc =3D -EAGAIN;=0A break;=0A- }=0A if ( = cpupool_move_domain(d, cpupool0) )=0A- return -EAGAIN;=0A+ = return -ERESTART;=0A for_each_vcpu ( d, v )=0A = unmap_vcpu_info(v);=0A d->is_dying =3D DOMDYING_dead;=0A--- = a/xen/common/domctl.c=0A+++ b/xen/common/domctl.c=0A@@ -692,10 +692,11 @@ = long do_domctl(XEN_GUEST_HANDLE_PARAM(xe=0A break;=0A =0A case = XEN_DOMCTL_destroydomain:=0A- {=0A ret =3D domain_kill(d);=0A- = }=0A- break;=0A+ if ( ret =3D=3D -ERESTART )=0A+ = ret =3D hypercall_create_continuation(=0A+ __HYPERVISOR_domc= tl, "h", u_domctl);=0A+ break;=0A =0A case XEN_DOMCTL_setnodeaff= inity:=0A {=0A --=__PartF7C2754D.2__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__PartF7C2754D.2__=--