From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mukesh Rathor Subject: Re: [V9 PATCH 6/8] pvh dom0: Add and remove foreign pages Date: Mon, 21 Apr 2014 17:19:13 -0700 Message-ID: <20140421171913.1fd36658@mantra.us.oracle.com> References: <1397607172-32065-1-git-send-email-mukesh.rathor@oracle.com> <1397607172-32065-7-git-send-email-mukesh.rathor@oracle.com> <534EC5430200007800009ADD@nat28.tlf.novell.com> <20140416183742.50a98472@mantra.us.oracle.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 1WcOQp-00058s-Rq for xen-devel@lists.xenproject.org; Tue, 22 Apr 2014 00:19:28 +0000 In-Reply-To: <20140416183742.50a98472@mantra.us.oracle.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: George.Dunlap@eu.citrix.com, tim@xen.org, eddie.dong@intel.com, keir.xen@gmail.com, jun.nakajima@intel.com, xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org On Wed, 16 Apr 2014 18:37:42 -0700 Mukesh Rathor wrote: > On Wed, 16 Apr 2014 17:00:35 +0100 > "Jan Beulich" wrote: > ............ > > > > + goto out; > > > + > > > + rc = xsm_map_gmfn_foreign(XSM_TARGET, tdom, fdom); > > > + if ( rc ) > > > + goto out; > > > + > > > + /* following will take a refcnt on the mfn */ > > > + page = get_page_from_gfn(fdom, fgfn, &p2mt, P2M_ALLOC); > > > + if ( !page || !p2m_is_valid(p2mt) ) > > > > Is this really p2m_is_valid() (i.e. including various types apart > > from p2m_ram_rw)? > > Hmm.. let me check again in case of HVM guest coming up on PVH dom0, > if there are use cases of non-ram types. Otherwise, it could be just > p2m_is_ram. Ok, following is the change I'm going to make in the next version for above comment: diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index 67aa5f6..8d3eb95 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -1799,7 +1799,7 @@ int p2m_add_foreign(struct domain *tdom, unsigned long fgf /* following will take a refcnt on the mfn */ page = get_page_from_gfn(fdom, fgfn, &p2mt, P2M_ALLOC); - if ( !page || !p2m_is_valid(p2mt) ) + if ( !page || !p2m_is_strict_ram(p2mt) ) { if ( page ) put_page(page); diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h index 47604da..e0bf6dc 100644 --- a/xen/include/asm-x86/p2m.h +++ b/xen/include/asm-x86/p2m.h @@ -165,6 +165,7 @@ typedef unsigned int p2m_query_t; /* Useful predicates */ +#define p2m_is_strict_ram(_t) (p2m_to_mask(_t) & p2m_to_mask(p2m_ram_rw)) #define p2m_is_ram(_t) (p2m_to_mask(_t) & P2M_RAM_TYPES) #define p2m_is_hole(_t) (p2m_to_mask(_t) & P2M_HOLE_TYPES) #define p2m_is_mmio(_t) (p2m_to_mask(_t) & P2M_MMIO_TYPES) Lmk if you've issues with introducing p2m_is_strict_ram. In that case, we can just use p2m_is_ram. thanks Mukesh