From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH v4 4/9] xen: introduce XEN_DOMCTL_devour Date: Thu, 04 Dec 2014 10:52:34 +0000 Message-ID: <54803CF2.8080009@linaro.org> References: <1417626981-8432-1-git-send-email-vkuznets@redhat.com> <1417626981-8432-5-git-send-email-vkuznets@redhat.com> <547FAFDD.8010005@linaro.org> <5480351F.3050907@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" 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 1XwU1V-0005Uz-ME for xen-devel@lists.xenproject.org; Thu, 04 Dec 2014 10:52:37 +0000 Received: by mail-wg0-f46.google.com with SMTP id a1so13985009wgh.5 for ; Thu, 04 Dec 2014 02:52:36 -0800 (PST) In-Reply-To: <5480351F.3050907@citrix.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: David Vrabel , Vitaly Kuznetsov , xen-devel@lists.xenproject.org Cc: Andrew Jones , Keir Fraser , Ian Campbell , Stefano Stabellini , Andrew Cooper , Ian Jackson , Tim Deegan , Jan Beulich , Wei Liu List-Id: xen-devel@lists.xenproject.org On 04/12/2014 10:19, David Vrabel wrote: > On 04/12/14 00:50, Julien Grall wrote: >> Hi Vitaly, >> >> On 03/12/2014 17:16, Vitaly Kuznetsov wrote: >>> New operation sets the 'recipient' domain which will recieve all >> >> s/recieve/receive/ >> >>> memory pages from a particular domain and kills the original domain. >>> >>> Signed-off-by: Vitaly Kuznetsov >>> --- >>> @@ -1764,13 +1765,32 @@ void free_domheap_pages(struct page_info *pg, >>> unsigned int order) >> >> [..] >> >>> + else >>> + { >>> + mfn = page_to_mfn(pg); >>> + gmfn = mfn_to_gmfn(d, mfn); >>> + >>> + page_set_owner(pg, NULL); >>> + if ( assign_pages(d->recipient, pg, order, 0) ) >>> + /* assign_pages reports the error by itself */ >>> + goto out; >>> + >>> + if ( guest_physmap_add_page(d->recipient, gmfn, mfn, >>> order) ) >> >> On ARM, mfn_to_gmfn will always return the mfn. This would result to add >> a 1:1 mapping in the recipient domain. >> >> But ... only DOM0 has its memory mapped 1:1. So this code may blow up >> the P2M of the recipient domain. >> >> I'm not an x86 expert, but this may also happen when the recipient >> domain is using translated page mode (i.e HVM/PVHM). > > mfn_to_gmfn() does the correct thing on x86 as it does a m2p lookup. Is it because machine_to_phys_mapping caches the translation for dying domain? -- Julien Grall