From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tim Deegan Subject: Re: HYBRID: max_mapped_pfn in ept_set_entry() Date: Thu, 29 Mar 2012 10:56:14 +0100 Message-ID: <20120329095614.GA72859@ocelot.phlegethon.org> References: <20120328170810.332f0b93@mantra.us.oracle.com> <1333013354.18810.54.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1333013354.18810.54.camel@zakaz.uk.xensource.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: Ian Campbell Cc: "Xen-devel@lists.xensource.com" , Keir Fraser , "Tim Deegan (3P)" , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org At 10:29 +0100 on 29 Mar (1333016954), Ian Campbell wrote: > On Thu, 2012-03-29 at 01:08 +0100, Mukesh Rathor wrote: > > I'm trying to figure the right thing to do here. Should I just change > > the "gfn > p2m->max_mapped_pfn" in ept_get_entry() to check for > > INVALID_MFN? I really shouldn't be adjusting max_mapped_pfn for MMIO > > pages, right? > > I'm no expert on the p2m side of things but ept_get_entry says: > /* This pfn is higher than the highest the p2m map currently holds */ > if ( gfn > p2m->max_mapped_pfn ) > goto out; > > which suggests to me that this is just an optimisation (skipping a > lookup which can never succeed) and therefore it is appropriate to > update max_mapped_pfn. After all a 1-1 mapped pfn is still a pfn. Yes, you should adjust max_mapped_pfn, in ept_set_entry() and in p2m_set_entry() (p2m-pt.c) so we don't get the same bug reappearing on AMD. Instead of checking mfn_valid(), they should check (p2mt != p2m_invalid && p2mt != p2m_mmio_dm). > Other places, like ept_walk_table seem to make a similar optimisation. > > Unless there is some reason to assume that these functions will never be > passed an MMIO pfn? No - it's just that this check predates anything other than RAM and emulated MMIO. Tim.