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] Mapping another domain's user memory

To: "Michael Abd-El-Malek" <mabdelmalek@xxxxxxx>
Subject: Re: [Xen-devel] Mapping another domain's user memory
From: "Derek Murray" <derek.murray@xxxxxxxxx>
Date: Thu, 31 Jan 2008 16:16:32 +0000
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Wed, 06 Feb 2008 02:39:50 -0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=zFzSvuUXeqqVvgYTjyKWsb9GMa88g34MDBrXRsllee4=; b=o/Ic9Qj66OjCjtTSB6Z12PHJhTvD4uYT82HAjWAfGxIHJfgLRgLo6DqqxzAkowUs2694JaZDPO1XhgDfdcQpaPLKhAildqrLMLw/xMOaI+CgIVgvhVPv959zY5WTLJ6OEgh19koFVjS9xE9uwrMUVyioXtKeTYymrSZbFWJ8Bko=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=jKqYuusjAA/nn+u15Ejrk1hu8BABgjo0oa7vXJY5/xTEWGbU+3klVMDWjpZHCrrtjFxFMz5m3H2I7mlElaxJBReKITsY06/7OC1hP1Wcqhene4BBQltUIDdgr7rThUaTHe40e+c0gS6uvUPNIcQzciBt40k90gAAurZ4u2mQGEM=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <EB906B8E-C730-4856-B8C1-8BDB4FEB3BB0@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>
References: <EB906B8E-C730-4856-B8C1-8BDB4FEB3BB0@xxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Hi Mike,

On Jan 31, 2008 2:57 PM, Michael Abd-El-Malek <mabdelmalek@xxxxxxx> wrote:
> 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);

You have another problem here, because virt_to_mfn (and virt_to_page
etc.) operate on kernel virtual addresses, where converting to a
physical address effectively just involves subtracting an offset. User
virtual addresses are handled differently, and you'll have to walk the
page table to find the PTE and from that obtain an MFN.

To respond to Daniel's point, from my reading of the code, the grant
table entry takes a "GMFN", which is equivalent to an MFN on PV guests
without shadow translation. Therefore it shouldn't be necessary to
translate this to a pseudo-physical frame number.

> So a few questions:
> 1) is it even possible to map a domain's user-space page into another
> domain?

I don't see any problem in principle, though you'll have to make sure
that the page is locked in memory.

> 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.

blktap maps memory that was granted by another domain's kernel (in the
blkfront driver) into user-space. Therefore, on the destination side,
this is probably more complicated than you need. However, if you did
want to map the grant into user-space, you could use gntdev, which
employs the same mechanism as blktap.


Derek Murray.

Xen-devel mailing list

<Prev in Thread] Current Thread [Next in Thread>
  • Re: [Xen-devel] Mapping another domain's user memory, Derek Murray <=