* Cannot get shared page in domU @ 2011-11-10 4:15 Xin Jin 2011-11-10 5:09 ` Daniel Castro 0 siblings, 1 reply; 5+ messages in thread From: Xin Jin @ 2011-11-10 4:15 UTC (permalink / raw) To: xen-devel [-- Attachment #1.1: Type: text/plain, Size: 755 bytes --] Hi, I cannot get a shared page in domU. In a domU, I used the folloing code to grant a page to another domU. share_mem = (share_mem_desp *) __get_free_page(GFP_KERNEL); share_mem->gref = gnttab_grant_foreign_access(domid_remote, virt_to_mfn(share_mem), 0); In another domU, I used the folloing code to get the shared page. share_vmarea = alloc_vm_area(PAGE_SIZE); gnttab_set_map_op( &map_op, (unsigned long)share_vmarea->addr, GNTMAP_host_map, gref, domid_remote ); HYPERVISOR_grant_table_op( GNTTABOP_map_grant_ref, &map_op, 1 ); While using the exactly same code to get the shared page in dom0, it woks all well. But it cannot work in domU. I use Xen 4.1.1 and fedora 14 ( linux 3.1.0 both for dom0 and domU ). Can anyone help me? Thanks! -- Xin [-- Attachment #1.2: Type: text/html, Size: 1015 bytes --] [-- Attachment #2: Type: text/plain, Size: 138 bytes --] _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Cannot get shared page in domU 2011-11-10 4:15 Cannot get shared page in domU Xin Jin @ 2011-11-10 5:09 ` Daniel Castro 2011-11-10 15:54 ` Xin Jin 0 siblings, 1 reply; 5+ messages in thread From: Daniel Castro @ 2011-11-10 5:09 UTC (permalink / raw) To: Xin Jin; +Cc: xen-devel On Thu, Nov 10, 2011 at 1:15 PM, Xin Jin <jxinpku@gmail.com> wrote: > Hi, I cannot get a shared page in domU. > In a domU, I used the folloing code to grant a page to another domU. > share_mem = (share_mem_desp *) __get_free_page(GFP_KERNEL); > share_mem->gref = gnttab_grant_foreign_access(domid_remote, > virt_to_mfn(share_mem), 0); > In another domU, I used the folloing code to get the shared page. > share_vmarea = alloc_vm_area(PAGE_SIZE); > gnttab_set_map_op( &map_op, (unsigned long)share_vmarea->addr, > GNTMAP_host_map, gref, domid_remote ); > HYPERVISOR_grant_table_op( GNTTABOP_map_grant_ref, &map_op, 1 ); > While using the exactly same code to get the shared page in dom0, it woks > all well. But it cannot work in domU. > I use Xen 4.1.1 and fedora 14 ( linux 3.1.0 both for dom0 and domU ). > Can anyone help me? On the interface struct when you issue the hypercall you need to specify the domid that can use the gref. Maybe the default is domid 0. The struct grant_entry_v1 has member domid for the foreign guest, check that value. > Thanks! > -- Xin > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel > > -- +-=====---------------------------+ | +---------------------------------+ | This space intentionally blank for notetaking. | | | Daniel Castro, | | | | Consultant/Programmer.| | | | U Andes | +-------------------------------------+ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Cannot get shared page in domU 2011-11-10 5:09 ` Daniel Castro @ 2011-11-10 15:54 ` Xin Jin 2011-11-10 22:21 ` Konrad Rzeszutek Wilk 0 siblings, 1 reply; 5+ messages in thread From: Xin Jin @ 2011-11-10 15:54 UTC (permalink / raw) To: Daniel Castro; +Cc: xen-devel [-- Attachment #1.1: Type: text/plain, Size: 1941 bytes --] In share_mem->gref = gnttab_grant_foreign_access(domid_remote, virt_to_mfn(share_mem), 0); I have explicitly specified the domid that can use the gref as "domid_remote". What else can be wrong? On Thu, Nov 10, 2011 at 12:09 AM, Daniel Castro <evil.dani@gmail.com> wrote: > On Thu, Nov 10, 2011 at 1:15 PM, Xin Jin <jxinpku@gmail.com> wrote: > > Hi, I cannot get a shared page in domU. > > In a domU, I used the folloing code to grant a page to another domU. > > share_mem = (share_mem_desp *) __get_free_page(GFP_KERNEL); > > share_mem->gref = gnttab_grant_foreign_access(domid_remote, > > virt_to_mfn(share_mem), 0); > > In another domU, I used the folloing code to get the shared page. > > share_vmarea = alloc_vm_area(PAGE_SIZE); > > gnttab_set_map_op( &map_op, (unsigned long)share_vmarea->addr, > > GNTMAP_host_map, gref, domid_remote ); > > HYPERVISOR_grant_table_op( GNTTABOP_map_grant_ref, &map_op, 1 ); > > While using the exactly same code to get the shared page in dom0, it woks > > all well. But it cannot work in domU. > > I use Xen 4.1.1 and fedora 14 ( linux 3.1.0 both for dom0 and domU ). > > Can anyone help me? > On the interface struct when you issue the hypercall you need to > specify the domid that can use the gref. Maybe the default is domid 0. > The struct grant_entry_v1 has member domid for the foreign guest, > check that value. > > > Thanks! > > -- Xin > > > > > > _______________________________________________ > > Xen-devel mailing list > > Xen-devel@lists.xensource.com > > http://lists.xensource.com/xen-devel > > > > > > > > -- > +-=====---------------------------+ > | +---------------------------------+ | This space intentionally blank > for notetaking. > | | | Daniel Castro, | > | | | Consultant/Programmer.| > | | | U Andes | > +-------------------------------------+ > -- Xin JIN PhD student Department of Computer Science Princeton University [-- Attachment #1.2: Type: text/html, Size: 2808 bytes --] [-- Attachment #2: Type: text/plain, Size: 138 bytes --] _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Cannot get shared page in domU 2011-11-10 15:54 ` Xin Jin @ 2011-11-10 22:21 ` Konrad Rzeszutek Wilk 2011-11-11 1:02 ` Xin Jin 0 siblings, 1 reply; 5+ messages in thread From: Konrad Rzeszutek Wilk @ 2011-11-10 22:21 UTC (permalink / raw) To: Xin Jin; +Cc: Daniel Castro, xen-devel On Thu, Nov 10, 2011 at 10:54:23AM -0500, Xin Jin wrote: > In > > share_mem->gref = > gnttab_grant_foreign_access(domid_remote, virt_to_mfn(share_mem), 0); Huh? There are four parameters for that function. When you setup your map_op, are you setting GNTMAP_application_map | GNTMAP_contains_pte ? Or are using GNTMAP_host_map Did you look in the 3.1 linux kerne in the gntdev.c driver? Or the other drivers? Can you use grant-alloc for your code (which can setup shared memory segements between guests) instead of doing this in the kernel? > > I have explicitly specified the domid that can use the gref as > "domid_remote". > > What else can be wrong? > > On Thu, Nov 10, 2011 at 12:09 AM, Daniel Castro <evil.dani@gmail.com> wrote: > > > On Thu, Nov 10, 2011 at 1:15 PM, Xin Jin <jxinpku@gmail.com> wrote: > > > Hi, I cannot get a shared page in domU. > > > In a domU, I used the folloing code to grant a page to another domU. > > > share_mem = (share_mem_desp *) __get_free_page(GFP_KERNEL); > > > share_mem->gref = gnttab_grant_foreign_access(domid_remote, > > > virt_to_mfn(share_mem), 0); > > > In another domU, I used the folloing code to get the shared page. > > > share_vmarea = alloc_vm_area(PAGE_SIZE); > > > gnttab_set_map_op( &map_op, (unsigned long)share_vmarea->addr, > > > GNTMAP_host_map, gref, domid_remote ); > > > HYPERVISOR_grant_table_op( GNTTABOP_map_grant_ref, &map_op, 1 ); > > > While using the exactly same code to get the shared page in dom0, it woks > > > all well. But it cannot work in domU. > > > I use Xen 4.1.1 and fedora 14 ( linux 3.1.0 both for dom0 and domU ). > > > Can anyone help me? > > On the interface struct when you issue the hypercall you need to > > specify the domid that can use the gref. Maybe the default is domid 0. > > The struct grant_entry_v1 has member domid for the foreign guest, > > check that value. > > > > > Thanks! > > > -- Xin > > > > > > > > > _______________________________________________ > > > Xen-devel mailing list > > > Xen-devel@lists.xensource.com > > > http://lists.xensource.com/xen-devel > > > > > > > > > > > > > > -- > > +-=====---------------------------+ > > | +---------------------------------+ | This space intentionally blank > > for notetaking. > > | | | Daniel Castro, | > > | | | Consultant/Programmer.| > > | | | U Andes | > > +-------------------------------------+ > > > > > > -- > Xin JIN > PhD student > Department of Computer Science > Princeton University > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Cannot get shared page in domU 2011-11-10 22:21 ` Konrad Rzeszutek Wilk @ 2011-11-11 1:02 ` Xin Jin 0 siblings, 0 replies; 5+ messages in thread From: Xin Jin @ 2011-11-11 1:02 UTC (permalink / raw) To: Konrad Rzeszutek Wilk; +Cc: Daniel Castro, xen-devel [-- Attachment #1.1: Type: text/plain, Size: 4313 bytes --] On Thu, Nov 10, 2011 at 5:21 PM, Konrad Rzeszutek Wilk < konrad.wilk@oracle.com> wrote: > On Thu, Nov 10, 2011 at 10:54:23AM -0500, Xin Jin wrote: > > In > > > > share_mem->gref = > > gnttab_grant_foreign_access(domid_remote, virt_to_mfn(share_mem), 0); > > Huh? There are four parameters for that function. > The function I use is int gnttab_grant_foreign_access(domid_t domid, unsigned long frame, int readonly); It only has 3 parameters. The function void gnttab_grant_foreign_access_ref(grant_ref_t ref, domid_t domid, unsigned long frame, int readonly); has 4 papameters. > > When you setup your map_op, are you setting > GNTMAP_application_map | GNTMAP_contains_pte > ? > Or are using GNTMAP_host_map > I use GNTMAP_host_map to get the grant page as following. share_vmarea = alloc_vm_area(PAGE_SIZE); gnttab_set_map_op( &map_op, (unsigned long)share_vmarea->addr, GNTMAP_host_map, gref, domid_remote ); HYPERVISOR_grant_table_op( GNTTABOP_map_grant_ref, &map_op, 1 ); > Did you look in the 3.1 linux kerne in the gntdev.c driver? Or the other > drivers? > Can you use grant-alloc for your code (which can setup shared memory > segements between guests) instead of doing this in the kernel? > > I'm writing a kernel driver module, which tries to communicate between domUs through shared memory. I only want to use grant table, and do not want to involve Xen event channel. When I did as the code above, the code works well in dom0. It means dom0 can use the following hypercall "share_vmarea = alloc_vm_area(PAGE_SIZE); gnttab_set_map_op( &map_op, (unsigned long)share_vmarea->addr, GNTMAP_host_map, gref, domid_remote ); HYPERVISOR_grant_table_op( GNTTABOP_map_grant_ref, &map_op, 1 );" to get the grant page successfully. But when I use the same code in domU, it cause errors in kernel "unable to request kernel paging request at ffffc900000da00c". (I used the right remote_domid to specify which domain to grant the page to.) Do you know what's wrong? How can I get it right? > > > > I have explicitly specified the domid that can use the gref as > > "domid_remote". > > > > What else can be wrong? > > > > On Thu, Nov 10, 2011 at 12:09 AM, Daniel Castro <evil.dani@gmail.com> > wrote: > > > > > On Thu, Nov 10, 2011 at 1:15 PM, Xin Jin <jxinpku@gmail.com> wrote: > > > > Hi, I cannot get a shared page in domU. > > > > In a domU, I used the folloing code to grant a page to another domU. > > > > share_mem = (share_mem_desp *) __get_free_page(GFP_KERNEL); > > > > share_mem->gref = gnttab_grant_foreign_access(domid_remote, > > > > virt_to_mfn(share_mem), 0); > > > > In another domU, I used the folloing code to get the shared page. > > > > share_vmarea = alloc_vm_area(PAGE_SIZE); > > > > gnttab_set_map_op( &map_op, (unsigned long)share_vmarea->addr, > > > > GNTMAP_host_map, gref, domid_remote ); > > > > HYPERVISOR_grant_table_op( GNTTABOP_map_grant_ref, &map_op, 1 ); > > > > While using the exactly same code to get the shared page in dom0, it > woks > > > > all well. But it cannot work in domU. > > > > I use Xen 4.1.1 and fedora 14 ( linux 3.1.0 both for dom0 and domU ). > > > > Can anyone help me? > > > On the interface struct when you issue the hypercall you need to > > > specify the domid that can use the gref. Maybe the default is domid 0. > > > The struct grant_entry_v1 has member domid for the foreign guest, > > > check that value. > > > > > > > Thanks! > > > > -- Xin > > > > > > > > > > > > _______________________________________________ > > > > Xen-devel mailing list > > > > Xen-devel@lists.xensource.com > > > > http://lists.xensource.com/xen-devel > > > > > > > > > > > > > > > > > > > > -- > > > +-=====---------------------------+ > > > | +---------------------------------+ | This space intentionally blank > > > for notetaking. > > > | | | Daniel Castro, | > > > | | | Consultant/Programmer.| > > > | | | U Andes | > > > +-------------------------------------+ > > > > > > > > > > > -- > > Xin JIN > > PhD student > > Department of Computer Science > > Princeton University > > > _______________________________________________ > > Xen-devel mailing list > > Xen-devel@lists.xensource.com > > http://lists.xensource.com/xen-devel > > -- Xin JIN PhD student Department of Computer Science Princeton University [-- Attachment #1.2: Type: text/html, Size: 7297 bytes --] [-- Attachment #2: Type: text/plain, Size: 138 bytes --] _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-11-11 1:02 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-11-10 4:15 Cannot get shared page in domU Xin Jin 2011-11-10 5:09 ` Daniel Castro 2011-11-10 15:54 ` Xin Jin 2011-11-10 22:21 ` Konrad Rzeszutek Wilk 2011-11-11 1:02 ` Xin Jin
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.