Hi, I am writing a kermel module in DomU, and this module grants a page of memory to Dom0. Then in Dom0 I try to grant_map it with xc_gnttab_map_grant_ref() But this function requires a flag, and I don''t know which option to give it. I tried with either GNTMAP_application_map or GTF_reading|GTF_writing, but I always got this error: ERROR: do_gnttab_op: HYPERVISOR_grant_table_op failed: -1 Anybody please tell me how to use xc_gnttab_map_grant_ref() properly in Dom0''s userspace? Many thanks. Hieu _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
King, Steven R
2005-Nov-03 21:21 UTC
RE: [Xen-devel] Question on xc_gnttab_map_grant_ref()
I''ve been looking at xc_gnttab stuff lately too and the current implementation is incomplete. For example, I don''t see a way to acquire a grant reference from user space, so the xc_gnttab functions taking a reference are unusable. IMO, grant references are kernel level implementation details that should not be exposed to user-mode anyway. Instead, user-mode needs IOCTLs to share pages with a remote domain and to map those shared pages within the remote end. If the kernel implements this functionality with grant tables, then great; in the future it may do something else. I hope to have a patch to offer for this eventually. -steve -----Original Message----- From: xen-devel-bounces@lists.xensource.com [mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of NAHieu Sent: Thursday, November 03, 2005 4:53 AM To: xen-devel Subject: [Xen-devel] Question on xc_gnttab_map_grant_ref() Hi, I am writing a kermel module in DomU, and this module grants a page of memory to Dom0. Then in Dom0 I try to grant_map it with xc_gnttab_map_grant_ref() But this function requires a flag, and I don''t know which option to give it. I tried with either GNTMAP_application_map or GTF_reading|GTF_writing, but I always got this error: ERROR: do_gnttab_op: HYPERVISOR_grant_table_op failed: -1 Anybody please tell me how to use xc_gnttab_map_grant_ref() properly in Dom0''s userspace? Many thanks. Hieu _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Christopher Clark
2005-Nov-03 22:59 UTC
Re: [Xen-devel] Question on xc_gnttab_map_grant_ref()
The implementation is indeed incomplete and I agree that grant references are not the correct interface for the kernel to expose to user space. MarkW''s mmap work-in-progress ought be far more suitable. The main use of xc_gnttab stuff has been for debugging new clients using the grant tables -- it''s been handy to modify and read them from userspace to figure out what''s going on, but clearly this isn''t something you''d want in a production kernel, which is why it''s disabled. Christopher On 11/3/05, King, Steven R <steven.r.king@intel.com> wrote:> > I''ve been looking at xc_gnttab stuff lately too and the current > implementation is incomplete. For example, I don''t see a way to acquire > a grant reference from user space, so the xc_gnttab functions taking a > reference are unusable. > > IMO, grant references are kernel level implementation details that > should not be exposed to user-mode anyway. Instead, user-mode needs > IOCTLs to share pages with a remote domain and to map those shared pages > within the remote end. If the kernel implements this functionality with > grant tables, then great; in the future it may do something else. I > hope to have a patch to offer for this eventually. > > -steve > > > -----Original Message----- > From: xen-devel-bounces@lists.xensource.com > [mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of NAHieu > Sent: Thursday, November 03, 2005 4:53 AM > To: xen-devel > Subject: [Xen-devel] Question on xc_gnttab_map_grant_ref() > > Hi, > > I am writing a kermel module in DomU, and this module grants a page of > memory to Dom0. Then in Dom0 I try to grant_map it with > xc_gnttab_map_grant_ref() > > But this function requires a flag, and I don''t know which option to give > it. I tried with either GNTMAP_application_map or > GTF_reading|GTF_writing, but I always got this error: > > ERROR: do_gnttab_op: HYPERVISOR_grant_table_op failed: -1 > > Anybody please tell me how to use xc_gnttab_map_grant_ref() properly in > Dom0''s userspace? > > > Many thanks. > Hieu > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Mark Williamson
2005-Nov-03 23:22 UTC
Re: [Xen-devel] Question on xc_gnttab_map_grant_ref()
To expand: I''m working towards a shared-memory NFS-style filesystem for Xen guests. This will allow high-performance data sharing within one host. This leverages direct memory sharing to maximise performance and make better use of the available RAM. A bonus feature of this direct sharing approach is that applications running in different domains on the same host should be able to share memory by both using a simple mmap() call. This avoids us having to introduce any new wacky semantics / exotic character devices; sharing should work similarly to the case of two applications in one domain. Cheers, Mark On Thursday 03 November 2005 22:59, Christopher Clark wrote:> The implementation is indeed incomplete and I agree that grant references > are not the correct interface for the kernel to expose to user space. > MarkW''s mmap work-in-progress ought be far more suitable. > > The main use of xc_gnttab stuff has been for debugging new clients using > the grant tables -- it''s been handy to modify and read them from userspace > to figure out what''s going on, but clearly this isn''t something you''d want > in a production kernel, which is why it''s disabled. > > Christopher > > On 11/3/05, King, Steven R <steven.r.king@intel.com> wrote: > > I''ve been looking at xc_gnttab stuff lately too and the current > > implementation is incomplete. For example, I don''t see a way to acquire > > a grant reference from user space, so the xc_gnttab functions taking a > > reference are unusable. > > > > IMO, grant references are kernel level implementation details that > > should not be exposed to user-mode anyway. Instead, user-mode needs > > IOCTLs to share pages with a remote domain and to map those shared pages > > within the remote end. If the kernel implements this functionality with > > grant tables, then great; in the future it may do something else. I > > hope to have a patch to offer for this eventually. > > > > -steve > > > > > > -----Original Message----- > > From: xen-devel-bounces@lists.xensource.com > > [mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of NAHieu > > Sent: Thursday, November 03, 2005 4:53 AM > > To: xen-devel > > Subject: [Xen-devel] Question on xc_gnttab_map_grant_ref() > > > > Hi, > > > > I am writing a kermel module in DomU, and this module grants a page of > > memory to Dom0. Then in Dom0 I try to grant_map it with > > xc_gnttab_map_grant_ref() > > > > But this function requires a flag, and I don''t know which option to give > > it. I tried with either GNTMAP_application_map or > > GTF_reading|GTF_writing, but I always got this error: > > > > ERROR: do_gnttab_op: HYPERVISOR_grant_table_op failed: -1 > > > > Anybody please tell me how to use xc_gnttab_map_grant_ref() properly in > > Dom0''s userspace? > > > > > > Many thanks. > > Hieu > > > > _______________________________________________ > > Xen-devel mailing list > > Xen-devel@lists.xensource.com > > http://lists.xensource.com/xen-devel > > > > _______________________________________________ > > Xen-devel mailing list > > Xen-devel@lists.xensource.com > > http://lists.xensource.com/xen-devel_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel