18 messages in com.xensource.lists.xen-develRe: [Xen-devel] Vanilla Linux and has...
FromSent OnAttachments
Michael Abd-El-Malek20 Apr 2008 14:18 
Jeremy Fitzhardinge21 Apr 2008 04:46 
Mark McLoughlin21 Apr 2008 09:36.patch
Keir Fraser21 Apr 2008 10:52 
Michael Abd-El-Malek21 Apr 2008 10:59 
Michael Abd-El-Malek21 Apr 2008 11:10 
Michael Abd-El-Malek21 Apr 2008 11:16 
Keir Fraser21 Apr 2008 11:29 
Jeremy Fitzhardinge24 Apr 2008 17:17 
Keir Fraser24 Apr 2008 23:01 
Michael Abd-El-Malek25 Apr 2008 10:11 
Jeremy Fitzhardinge25 Apr 2008 11:21 
Michael Abd-El-Malek25 Apr 2008 11:30 
Jeremy Fitzhardinge25 Apr 2008 15:33 
Jeremy Fitzhardinge25 Apr 2008 17:13 
Michael Abd-El-Malek29 Apr 2008 09:39 
Jeremy Fitzhardinge29 Apr 2008 10:31 
Michael Abd-El-Malek30 Apr 2008 09:30 
Subject:Re: [Xen-devel] Vanilla Linux and has_foreign_mapping
From:Keir Fraser (keir@eu.citrix.com)
Date:04/21/2008 11:29:48 AM
List:com.xensource.lists.xen-devel

On 21/4/08 19:17, "Michael Abd-El-Malek" <mabd@cmu.edu> 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