Grant tables from dom0 userspace?
I agree user-mode mappings would be a very useful addition to Xen.
*** However ***
Following much of Andrew's work in my own driver, I've tried to create general purpose user-mode mappings based on grant tables. The results are unsatisfactory. You'll encounter some tricky domain crashes that have been discussed already on this list. I've hacked around many of the problems, such as implicit unmapping of grant references, but others remain. Some of the issues have no resolution in the grant table architecture.
If you have something working now, I'd stick with it.
IMHO, before user-mode mappings can be robustly supported, we'll have to leave grant tables for a fresh approach.
-steve
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Cihula, Joseph
Sent: Thursday, March 09, 2006 10:25 AM
To: Keir Fraser; Jacob Gorm Hansen
Cc: Andrew Warfield; xen-devel Devel
Subject: RE: [Xen-devel] Grant tables from dom0 userspace?
(Combining w/ Christopher's reply:)
I would add my support to providing this as a common service to userspace (as opposed to just creating a solution that works for your project).
Using xc_foreign_mapping interfaces may work for dom0 code but it requires the domain to be privileged and does not have fine-grained permissions (i.e. if you can map something then you can map anything). Grant tables are a much better, from a security POV, solution to sharing memory.
Joseph Cihula
(Linux) Software Security Architect
Open Source Technology Center
Intel Corp.
*** These opinions are not necessarily those of my employer ***
Quoted 7 lines · Keir Fraser
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_foreignmapping interfaces.
Quoted 4 lines · Christopher Clark
Grant tables aren't the right interface for use from userspace, which is why
tools/libxc/xc_gnttab.cwas removed. You should probably just write a kernel module to do the mapping for you using grant tables and
Quoted 15 lines
then expose a custom interface to userspace from the module to trigger
the mapping as you need.
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.cbut that seems to be gone now.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 4 lines · Steven R
Following much of Andrew's work in my own driver, I've tried to create general purpose user-mode mappings based on grant tables. The results are unsatisfactory. You'll encounter some tricky domain crashes that have been discussed already on this list.
With due respect, just because you haven't got it working correctly yet does not mean it can't be done. It's working okay in the blktap driver after all.
-- Keir
Hi Steven,
Quoted 4 lines
I've hacked around many of
the problems, such as implicit unmapping of grant references, but others remain. Some of the issues have no resolution in the grant table architecture.
It would be quite useful to know what specific problems you have
encountered in this effort as insight for future versions of the code.
The main problem that I have encountered in user-level foreign page
mappings is (as discussed previously) that Linux is a bit hasty in blowing away user virtual memory areas, and doesn't provide a good mechanism to safely unmap the pages. The kernel has all the information it needs to do the right thing though, and I think this should be reasonably fixed in the future -- i don't see a compelling reason for Xen to do extra book-keeping to cover for something that the OS could just as easily do. Especially for something like cross-VM mappings, which don't exist in the non-virtualized system. Are there implicit unmapping problems that you thing would remain unsolved if, for instance, there was a vm area destructor early enough to allow the OS to properly unmap active grants?
When you say, "others remain," can you provide a little more detail?
thanks!
a.