From: Tim Deegan Subject: Re: Xen-unstable-staging: Xen BUG at iommu_map.c:455 Date: Tue, 5 May 2015 16:17:11 +0100 Message-ID: <20150505151711.GC31485@deinos.phlegethon.org> References: <1189087521.20150411192519@eikelenboom.it> <55295B7D.4020107@citrix.com> <4810067032.20150411194249@eikelenboom.it> <55296730.30802@citrix.com> <1468678653.20150411213342@eikelenboom.it> <55298278.2080406@citrix.com> <1698372572.20150411230533@eikelenboom.it> <55299391.4030900@citrix.com> <20150416092830.GD13443@deinos.phlegethon.org> <5548F96E0200007800076C7F@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Ypeb7-00008m-KI for xen-devel@lists.xenproject.org; Tue, 05 May 2015 15:17:25 +0000 Content-Disposition: inline In-Reply-To: <5548F96E0200007800076C7F@mail.emea.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: Andrew Cooper , Paul Durrant , xen-devel , Sander Eikelenboom List-Id: xen-devel@lists.xenproject.org At 16:10 +0100 on 05 May (1430842206), Jan Beulich wrote: > >>> On 16.04.15 at 11:28, wrote: > > At 22:35 +0100 on 11 Apr (1428791713), Andrew Cooper wrote: > >> I am not certain that it is the correct way to fix the issue, nor that > >> the ioreq server code is the only way to trigger it. There are several > >> ways to shoot a gfn mapping from the guests physmap. > >> > >> At least we now understand why it happens. I will defer to others CC'd > >> on this thread for their opinions in the matter. > > > > The patch semes like a pretty good check to me, though I'm not > > convinced it's race-free. At the least I'd cache the m2p lookup so we > > use the same value for the checks and the map_page() call. > > Did you have a chance to look at the patch Sander meanwhile > successfully tested [1]? Just looked at it now. > I'm trying to understand where you see > possible races here, and hence whether anything else needs to > be done to that patch before formally submitting it. It caches the m2p mlookup, which I like, but there's still a race against concurrent p2m updates. > From what I > can tell (and assuming other code works correctly) the fact that > arch_iommu_populate_page_table() sets d->need_iommu to -1 > first thing should make sure that any subsequent changes to the > p2m get propagated to IOMMU code for setting up respective > mappings. Yes, but might they then be overridden by the previous mapping when this new code calls map_page()? This seems like a case where we should be using get_gfn()/put_gfn(). Cheers, Tim.