Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756391Ab0LPPYv (ORCPT ); Thu, 16 Dec 2010 10:24:51 -0500 Received: from smtp.ctxuk.citrix.com ([62.200.22.115]:60069 "EHLO SMTP.EU.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756182Ab0LPPYu (ORCPT ); Thu, 16 Dec 2010 10:24:50 -0500 X-IronPort-AV: E=Sophos;i="4.59,355,1288569600"; d="scan'208";a="3385270" Date: Thu, 16 Dec 2010 15:25:14 +0000 From: Stefano Stabellini X-X-Sender: sstabellini@kaball-desktop To: Jeremy Fitzhardinge CC: Stefano Stabellini , "linux-kernel@vger.kernel.org" , "xen-devel@lists.xensource.com" , Jeremy Fitzhardinge , Konrad Rzeszutek Wilk Subject: Re: [Xen-devel] [PATCH 08/11] xen p2m: transparently change the p2m mappings in the m2p override In-Reply-To: <4D095102.6010505@goop.org> Message-ID: References: <1292420446-3348-8-git-send-email-stefano.stabellini@eu.citrix.com> <4D095102.6010505@goop.org> User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1798 Lines: 46 On Wed, 15 Dec 2010, Jeremy Fitzhardinge wrote: > On 12/15/2010 05:40 AM, stefano.stabellini@eu.citrix.com wrote: > > From: Stefano Stabellini > > > > In m2p_add_override store the original mfn into page->index and then > > change the p2m mapping, setting mfns as FOREIGN_FRAME. > > > > In m2p_remove_override restore the original mapping. > > > > Signed-off-by: Stefano Stabellini > > --- > > arch/x86/xen/p2m.c | 4 ++++ > > 1 files changed, 4 insertions(+), 0 deletions(-) > > > > diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c > > index 8db19d5..7dde8e4 100644 > > --- a/arch/x86/xen/p2m.c > > +++ b/arch/x86/xen/p2m.c > > @@ -407,8 +407,11 @@ static unsigned long mfn_hash(unsigned long mfn) > > void m2p_add_override(unsigned long mfn, struct page *page) > > { > > unsigned long flags; > > + unsigned long pfn = page_to_pfn(page); > > page->private = mfn; > > + page->index = pfn_to_mfn(pfn); > > Is there any risk that a page being used for a granted mfn will end up > getting xen_create_contiguous_region() applied to it via the DMA API? > That would be messy... I don't think so because AFAIK xen_create_contiguous_region is only called: - by xen_swiotlb_fixup on xen_io_tlb_start (+ offset) that has been allocated using alloc_bootmem; - by xen_swiotlb_alloc_coherent on memory allocated using __get_free_pages. if in the future xen_create_contiguous_region will be called on other memory ranges then maybe, but at the moment there are no problems. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/