From: Mukesh Rathor Subject: Re: [V9 PATCH 6/8] pvh dom0: Add and remove foreign pages Date: Tue, 22 Apr 2014 17:28:13 -0700 Message-ID: <20140422172813.001e1de8@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> <20140421171913.1fd36658@mantra.us.oracle.com> <5356364D020000780000A8EF@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Wcl32-0000U4-2j for xen-devel@lists.xenproject.org; Wed, 23 Apr 2014 00:28:24 +0000 In-Reply-To: <5356364D020000780000A8EF@nat28.tlf.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: 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 Tue, 22 Apr 2014 08:28:45 +0100 "Jan Beulich" wrote: > >>> On 22.04.14 at 02:19, wrote: > > On Wed, 16 Apr 2014 18:37:42 -0700 > > Mukesh Rathor wrote: > > > >> On Wed, 16 Apr 2014 17:00:35 +0100 > >> "Jan Beulich" wrote: > >> ............ > > /* 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)) > > Not sure - this now precludes mapping log-dirty or r/o pages, i.e. I > think you went from too relaxed to too strict. I think the question > needs answering in a more abstract fashion first, i.e. without code > written immediately: Which pages absolutely need to be foreign- > mappable and which ones can safely get foreign-mapped. My first > thought would be P2M_RAM_TYPES & ~P2M_HOLE_TYPES, with > P2M_HOLE_TYPES contained in P2M_RAM_TYPES generating a kind > of -EAGAIN notification while triggering the re-creation of the page > (which already is an indication that instead of P2M_HOLE_TYPES it > might well need to be P2M_PAGING_TYPES). The current use case is p2m_ram_rw, my approach would be start with minimum and add more as needed when features like migration, passthru, etc are added. My understanding of the various p2m types is limited, so I am at your mercy here to advise what types to anticipate. IMO, just checking for P2M_RAM_TYPES might suffice, I can additionally add check to make sure it's not P2M_HOLE_TYPES. Please lmk. thanks mukesh