Skip to contentSkip to conversation

Grant tables from dom0 userspace?

DISCUSSION Jacob Gorm Hansen 5 participants 5 messages Mar 9, 2006

lore
Share & tools
lore
#0 lore raw

hi,

I would like to share some pages between my domU graphics frontend device, and the backend which runs in userspace in dom0. Right now I am doing this with my own scheme, but presumably grant tables would be the correct solution.

Is it possible to use grant tables from dom0 userspace? There used to be a file called tools/libxc/xc_gnttab.c but that seems to be gone now.

Jacob

#1 lore raw

Hey

Grant tables aren't the right interface for use from userspace, which is why tools/libxc/xc_gnttab.c was removed. You should probably just write a kernel module to do the mapping for you using grant tables and then expose a custom interface to userspace from the module to trigger the mapping as you need.

Christopher

Quoted 18 lines · Jacob Gorm Hansen

hi,

I would like to share some pages between my domU graphics frontend device, and the backend which runs in userspace in dom0. Right now I am doing this with my own scheme, but presumably grant tables would be the correct solution.

Is it possible to use grant tables from dom0 userspace? There used to be a file called tools/libxc/xc_gnttab.c but that seems to be gone now.

Jacob

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw
In reply to Jacob Gorm Hansen
Quoted 8 lines · Jacob Gorm Hansen

I would like to share some pages between my domU graphics frontend device, and the backend which runs in userspace in dom0. Right now I am doing this with my own scheme, but presumably grant tables would be the correct solution.

Is it possible to use grant tables from dom0 userspace? There used to be a file called tools/libxc/xc_gnttab.c but that seems to be gone now.

I think blktap gives an example how to do this, but it might be specific to aio right now. You could probably use some of the same hooks to provide a device file that you could mmap(), passing grant refs to map. I cc'ed Andy Warfield in case he has any ideas...

The only other supported mechanism is the xc_foreign mapping interfaces.

-- Keir

#3 lore raw
Quoted 4 lines

I think blktap gives an example how to do this, but it might be specific to aio right now. You could probably use some of the same hooks to provide a device file that you could mmap(), passing grant refs to map. I cc'ed Andy Warfield in case he has any ideas...

The blktap code in unstable is a bit out of date at the moment, but should have sufficient examples to do what you want. Because of AIO, the code in there arranges for parallel user and kernel mappings, and then annotates the vm area so that get_user_pages can find the appropriate page_struct when AIO requests are decoded down into BIOs. If you just want to mmap some memory from another domain into user through a char device, then you can trim a lot of that code out.

In linux/drivers/xen/blktap/blktap.c:

dispatch_rw_block_io() -- decodes a batch of block requests, and maps the grants to kernel and user. As I say, you should be able to leave out all the kernel mappings and vm area updates.

blktap_read_ufe_ring() -- does the associated unmappings.

There's a bunch of code at the top to set up the device node and manage the mmap area.

The code is a bit dated, but maybe it's helpful...

a.

#4 lore raw
In reply to Jacob Gorm Hansen
Quoted 9 lines · Jacob Gorm Hansen

I would like to share some pages between my domU graphics frontend device, and the backend which runs in userspace in dom0. Right now I am doing this with my own scheme, but presumably grant tables would be the correct solution.

Is it possible to use grant tables from dom0 userspace? There used to be a file called tools/libxc/xc_gnttab.c but that seems to be gone now.

Rusty did a userspace block driver you may also want to look at. He was publishing bundles here: http://ozlabs.org/~rusty/xen/bundles/

See also his mail on the subject, titled "[BUNDLE] Testing a simpler inter-domain transport" and later "[BUNDLE] Xen Share w/ block device".

Signature · 2 lines
Hollis Blanchard
IBM Linux Technology Center