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


[Xen-devel] Mapping another domain's user memory

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] Mapping another domain's user memory
From: Michael Abd-El-Malek <mabdelmalek@xxxxxxx>
Date: Thu, 31 Jan 2008 09:57:20 -0500
Delivery-date: Thu, 31 Jan 2008 06:58:05 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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

Is it possible to map another domain's user-level memory into a different domain's kernel? (For clarity, let the source domain be the one with the user-space pages that a destination domain wants to write to.)

I tried to do that by first getting a grant for the user-space memory in the source domain as follows:

        page_start = user_buf;
        buffer_mfn = virt_to_mfn(page_start);
gnttab_grant_foreign_access_ref(grant_ref, info->dev->otherend_id, buffer_mfn, 0);

But the virt_to_mfn call asserted, in include/asm-x86_64/mach-xen/asm/ maddr.h:pfn_to_mfn.
The assertion that failed was: BUG_ON(end_pfn && pfn >= end_pfn);

So a few questions:
1) is it even possible to map a domain's user-space page into another domain? 2) for the above code snippet to work, must I install some mappings in the source domain first? 3) does the blktap driver do something similar? I tried looking at the blktap driver, because it looked like it might help. But I'm new to the Xen memory management code so it was a bit difficult to follow. 4) I looked at fs/filemap.c:file_read_actor and how it calls kmap before calling __copy_to_user. Would calling kmap help? __copy_to_user is a bit of a mystery to me (granted, no pun intended, I didn't dig deep enough into the assembly code to understand what it's doing.)
5) any other suggestions?


Xen-devel mailing list

<Prev in Thread] Current Thread [Next in Thread>