From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH v5 4/9] xen: introduce XEN_DOMCTL_devour Date: Tue, 13 Jan 2015 12:26:39 +0000 Message-ID: <1421151999.19103.54.camel@citrix.com> References: <1418305541-5135-1-git-send-email-vkuznets@redhat.com> <1418305541-5135-5-git-send-email-vkuznets@redhat.com> <5492EB6A0200007800050AA5@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YB0Z3-00075H-4l for xen-devel@lists.xenproject.org; Tue, 13 Jan 2015 12:27:17 +0000 In-Reply-To: <5492EB6A0200007800050AA5@mail.emea.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: Olaf Hering , Wei Liu , Stefano Stabellini , Andrew Cooper , Julien Grall , Ian Jackson , Andrew Jones , Tim Deegan , David Vrabel , xen-devel@lists.xenproject.org, Vitaly Kuznetsov , Keir Fraser List-Id: xen-devel@lists.xenproject.org On Thu, 2014-12-18 at 13:57 +0000, Jan Beulich wrote: > >>> On 11.12.14 at 14:45, wrote: > > --- a/xen/common/domctl.c > > +++ b/xen/common/domctl.c > > @@ -1177,6 +1177,39 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) > > } > > break; > > > > + case XEN_DOMCTL_devour: > > + { > > + struct domain *recipient_dom; > > + > > + if ( !d->recipient ) > > + { > > + recipient_dom = get_domain_by_id(op->u.devour.recipient); > > + if ( recipient_dom == NULL ) > > + { > > + ret = -ESRCH; > > + break; > > + } > > + > > + if ( recipient_dom->tot_pages != 0 ) > > + { > > + put_domain(recipient_dom); > > + ret = -EINVAL; > > + break; > > + } > > + /* > > + * Make sure no allocation/remapping is ongoing and set is_dying > > + * flag to prevent such actions in future. > > + */ > > + spin_lock(&d->page_alloc_lock); > > + d->is_dying = DOMDYING_locked; > > + d->recipient = recipient_dom; > > Is d == recipient_dom a valid case (not leading to any issues)? I suspect not, due to the restriction that the recipient not have any domheap pages, if d didn't have any domheap pages this whole dance is a bit unnecessary. In any case it doesn't seem very useful, so it's much easier to just avoid the issue by outlawing it. Ian.