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/
Home Products Support Community News


Re: [Xen-devel] Vanilla Linux and has_foreign_mapping

To: Michael Abd-El-Malek <mabdelmalek@xxxxxxx>
Subject: Re: [Xen-devel] Vanilla Linux and has_foreign_mapping
From: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Date: Mon, 21 Apr 2008 19:30:11 +0100
Cc: Mark McLoughlin <markmc@xxxxxxxxxx>, Jeremy Fitzhardinge <jeremy@xxxxxxxx>, xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>, Eduardo Habkost <ehabkost@xxxxxxxxxx>
Delivery-date: Mon, 21 Apr 2008 11:30:30 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <480CDA20.6080109@xxxxxxx>
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/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: Acij3buQ+f2wPg/QEd2FCAAWy6hiGQ==
Thread-topic: [Xen-devel] Vanilla Linux and has_foreign_mapping
User-agent: Microsoft-Entourage/
On 21/4/08 19:17, "Michael Abd-El-Malek" <mabdelmalek@xxxxxxx> wrote:

>> Yeah I'm in a similar situation as gntdev and blktap.
>> So on 2.6.25, which doesn't have has_foreign_mappings, you're suggesting
>> that I pin the pte pages that contain grant mappings.  How do I
>> accomplish that?  And on process exit, do I have to take any extra steps
>> to unpin the pte page, or will those pages be freed regardless of their
>> "pin status"?
> OK I took a quick look at the code.  On 2.6.25, xen_exit_mmap calls
> xen_pgd_unpin.  xen_pgd_unpin walks over a pgd and calls unpin_page on any
> pinned pages.  So it seems the current pgd_unpin code will not let us have any
> pte pages unpinned?

I'm not really familiar with the pv_ops code I'm afraid. But thinking about
this some more I've realised there's no way really to avoid making the
early-unpin logic aware of gntdev mappings. This is because if we do pin pte
pages, and require them to remain pinned across early-unpin, then
pgd_unpin() must not attempt to make those pte pages writable. That will
fail, because the pages are still pinned! You'd either need to handle the
failure to make the page writable, or have a per-page flag to indicate which
pte pages contain gntdev mappings. Frankly you may as well stick with the
per-mm-context has_foreign_mappings flag.

Is it a pain to add a pv_ops-subtype-specific flag to mm_context? If so you
could maintain a set datastructure instead, indicating which mm_contexts
contain foreign mappings.

 -- Keir

Xen-devel mailing list