[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] Sharing Memory between userspace of dom0 and userspace of domU

  • To: xen-devel@xxxxxxxxxxxxxxxxxxx
  • From: "Kareem Dana" <kareem.dana@xxxxxxxxx>
  • Date: Sun, 17 Feb 2008 18:54:57 -0500
  • Delivery-date: Sun, 17 Feb 2008 15:55:22 -0800
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=ZU9j3NjSdYn6mHrc7cU1CS+vifvzY7cc/OV1o3zIbNsjH9JGRWX0jA4Fi14ve//1O6xQL28iIWrgvxFhICk6XsW1gvjS7P5oUWvoLo7cC+2QCs3GYBYgne1NGfyqTt1WZmI2ejaARFuFhr4sQuxHplLbK0wz4gk8M5uPuIA3MpY=
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

I'm trying to better understand how xen shares memory between domains.
Ultimately what I would like to do is share memory between a userspace
tool in dom0 and a userspace application running in domU. Is that
currently possible?

The two methods for sharing memory that I found were grant tables and
using xc_map_foreign_range(). Grant tables seem to be just for kernel
space? I found xc_gnttab_map_grant_ref and other xc_gnttab_ userspace
API, but that requires a grant reference and I don't see a way to
generate or even get a grant reference from userspace.

Second, I tried xc_map_foreign_range() from my dom0 userspace program.
I started up a userspace program in domU and told it to malloc several
bytes of memory and print out the virtual address returned by malloc.
It wrote the string "hello" to the memory location and then just sat
in a loop. Then I started up a userspace program in dom0 and ran
xc_translate_foreign_address on the given virtual address and used
that as my MFN for xc_map_foreign_range. No errors were returned but
the memory mapped to dom0 is just garbage compared to "hello". When I
specify an arbitrary virtual address for xc_translate_foreign_address,
it generally gives me an error saying that address is not valid. So I
assume I'm doing something right, but I must be missing something.
What am I doing wrong with this?

If none of these methods are supposed to be used in this manner, is
there any way to share memory between user programs in different
domains like I'm trying to do?

Kareem Dana

Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.