From: Ian Campbell Subject: Re: [PATCH v2] xen/arm: p2m: Correctly flush TLB in create_p2m_entries Date: Thu, 16 Jan 2014 10:46:49 +0000 Message-ID: <1389869209.6697.0.camel@kazak.uk.xensource.com> References: <1389285240-7116-1-git-send-email-julien.grall@linaro.org> <1389713316.12434.91.camel@kazak.uk.xensource.com> <20140116101001.GA56618@deinos.phlegethon.org> 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 1W3kTO-00032P-Q8 for xen-devel@lists.xenproject.org; Thu, 16 Jan 2014 10:46:54 +0000 In-Reply-To: <20140116101001.GA56618@deinos.phlegethon.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Tim Deegan Cc: Keir Fraser , patches@linaro.org, Julien Grall , stefano.stabellini@citrix.com, Jan Beulich , xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org On Thu, 2014-01-16 at 11:10 +0100, Tim Deegan wrote: > At 15:28 +0000 on 14 Jan (1389709716), Ian Campbell wrote: > > On Thu, 2014-01-09 at 16:34 +0000, Julien Grall wrote: > > > Except grant-table (I can't find {get,put}_page for grant-table code???), > > > > I think they are in __gnttab_map_grant_ref, within __get_paged_frame or > > through page_get_owner_and_reference. > > > > and on unmap it is in__gnttab_unmap_common_complete. > > > > It's a bit of a complex maze though so I'm not entirely sure, perhaps > > Tim, Keir or Jan can confirm that a grant mapping always takes a > > reference on the mapped page (it seems like PV x86 ought to be relying > > on this for safety anyhow). > > Not claiming to understand it completely, but I agree with your analysis. Thanks. > > I think the flush in alloc_heap_pages would also serve as a backstop, > > wouldn't it? > > Not entirely -- if the grant mapping didn't take a ref, then the page > could be freed and reassigned with the grant mapping still in place -- > the TLB flush doesn't help if the PTE is still there. :) True, but I think we agree that grant mappings do (and must) take refs, Phew! Likewise on ARM we reference count foreign mappings so this is ok wrt this sort of thing too. I actually forgot I'd asked this question and was waiting for feedback -- so the patch is already in, good thing it is all fine! Ian.