WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] Invalid P2M entries after gnttab unmap

To: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] Invalid P2M entries after gnttab unmap
From: Tim Deegan <Tim.Deegan@xxxxxxxxxx>
Date: Fri, 4 Mar 2011 17:02:36 +0000
Cc: Ian Campbell <Ian.Campbell@xxxxxxxxxxxxx>, xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Fri, 04 Mar 2011 09:03:29 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4D7114B3.9090206@xxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <4D7114B3.9090206@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.20 (2009-06-14)
Hi, 

At 16:34 +0000 on 04 Mar (1299256499), Daniel De Graaf wrote:
> When an HVM guest uses gnttab_map_grant_ref to map granted on top of valid
> GFNs, it appears that the original MFNs referred to by these GFNs are lost.

Yes.  The p2m table only holds one MFN for each PFN (and vice versa).
If you want to keep that memory you could move it somewhere else 
using XENMAPSPACE_gmfn, or just map your grant refs into an MMIO hole. 

> The unmap operation sets the p2m mapping of the GFN to INVALID_MFN.

There's nothing else it can set it to, really, if you take away the
thing that was there. 

> (and it appears that replace_grant_p2m_mapping will not accept valid MFNs).
> 
> Most of the time, this appears to be true in testing. However, I have
> noticed a few cases where the GFNs are valid following the unmap operation.

That seems like a bug. 

> This has happened when a large number of grants (1284) are being unmapped
> due to a domain shutdown;

Can you be more specific?  Do you mean that a domain that has mapped
grants into its p2m is shutting down in a controlled way, and is pulling
out all the grant mappings as it does so?  What hypercall does it use to
unmap the grants?

Cheers,

Tim.

> in this case, perhaps half of the unmapped GFNs
> will point to valid memory, and half will point to invalid memory. In this
> case, "invalid memory" discards writes and returns 0xFF on all reads; valid
> memory appears to be normal RAM.
> 
> There doesn't appear to be any documentation on the intended behavior here.
> >From the guest kernel's perspective, it makes the most sense for GFNs that
> pointed to RAM prior to the map operation to continue to point to RAM after
> the unmap operation - that is, the unmap fully undoes what the map did. The
> contents of the pages (and which exact MFN they point to) aren't important.
> 
> -- 
> Daniel De Graaf
> National Security Agency
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel

-- 
Tim Deegan <Tim.Deegan@xxxxxxxxxx>
Principal Software Engineer, Xen Platform Team
Citrix Systems UK Ltd.  (Company #02937203, SL9 0BG)

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel