From: Tim Deegan Subject: Re: [PATCH v2] x86/p2m-pt: tighten conditions of IOMMU mapping updates Date: Fri, 2 Oct 2015 13:19:36 +0100 Message-ID: <20151002121936.GB81113@deinos.phlegethon.org> References: <560D261D02000078000A760A@prv-mh.provo.novell.com> <560D5C68.10109@citrix.com> <560E40E902000078000D9FFD@prv-mh.provo.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 1ZhzJO-0004KO-Qy for xen-devel@lists.xenproject.org; Fri, 02 Oct 2015 12:19:42 +0000 Content-Disposition: inline In-Reply-To: <560E40E902000078000D9FFD@prv-mh.provo.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, andrew.cooper3@citrix.com, wei.liu2@citrix.com, george.dunlap@citrix.com, xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org At 01:31 -0600 on 02 Oct (1443749497), Jan Beulich wrote: > >>> George Dunlap 10/01/15 6:16 PM >>> > >On 01/10/15 11:25, Jan Beulich wrote: > >> TBD: As already mentioned on the large-page-MMIO-mapping patch, there > >> is an apparent inconsistency with PoD handling: 2M mappings get > >> valid entries created, while 4k mappings don't. It would seem to > >> me that the 4k case needs changing, even if today this may only > >> be a latent bug. Question of course is why we don't rely on > >> p2m_type_to_flags() doing its job properly and instead special > >> case certain P2M types. > > > >The inconsistency in the conditionals there is a bit strange; but I'm > >pretty sure that in the 2MB case it is (at the moment) superfluous, > >because at the moment it seems that when setting a page with type > >p2m_populate_on_demand, it's always passing in _mfn(0), which is valid. > > > >(It used to pass a magic MFN, but Tim Deegan switched it to _mfn(0) at > >some point without comment.) > > Perhaps just because the magic MFN didn't always work? Tim? > To me it looks wrong to pass anything other than INVALID_MFN > there. Hmm, I really didn't explain that at all, did I? :( ISTR some more discussion about this, but it doesn't seem to have been on the list. I suspect I wanted to change it to INVALID_MFN but got tangled up in code that treated that as an error without checking the p2m type -- the p2m type stuff was not in use everywhere at that point. I'd agree that using P2M_INVALID and fixing any confused callers is the right thing to do. Cheers, Tim.