From: Mukesh Rathor Subject: Re: [RFC PATCH 13/16]: PVH xen: introduce p2m_map_foreign Date: Thu, 31 Jan 2013 18:38:24 -0800 Message-ID: <20130131183824.3af5e6a0@mantra.us.oracle.com> References: <20130111180944.4ff10c8f@mantra.us.oracle.com> <20130124171815.GM20551@ocelot.phlegethon.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20130124171815.GM20551@ocelot.phlegethon.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Tim Deegan Cc: "Xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org On Thu, 24 Jan 2013 17:18:15 +0000 Tim Deegan wrote: > At 18:09 -0800 on 11 Jan (1357927784), Mukesh Rathor wrote: > > @@ -584,6 +584,11 @@ guest_physmap_add_entry(struct domain *d > > { > > ASSERT(mfn_valid(omfn)); > > set_gpfn_from_mfn(mfn_x(omfn), INVALID_M2P_ENTRY); > > + > > + /* Because PVH domU uses kmalloc for grant pfn, we > > need to save > > + * and restore the old mfn */ > > + if (is_pvh_domain(d) && p2m_is_grant(t)) > > + free_domheap_page(mfn_to_page(omfn)); > > I think you'll need to explain this in more detail. The comment > assumes that the guest is running linux, which is worrying. And in > any case you can't just free_domheap_page() the guest's memory! What > if another domain has a reference to it? Ok, I fixed linux side so instead of kmalloc it uses ballooning to get pfn space for the grant table. That means there should not be an omfn here. If there is, I think I should just fail the operation, ie, guest_physmap_add_entry(), right? thanks, Mukesh