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

[Xen-devel] Share Memory Between DomainU and Domain0


  • To: <Xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: "JungHyun.Kim" <jhkim@xxxxxxxxxxxxxxxxxx>
  • Date: Fri, 8 Dec 2006 00:55:03 +0900
  • Delivery-date: Thu, 07 Dec 2006 07:57:24 -0800
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>
  • Thread-index: AccaGA6EnPI2mkLeQFaWLv0aVfDITw==

Hi.

 

I want to share some pages between Dom0 and DomU.

But I have some problems with it.

 

The sharing scenario is like that.

 

1.     Dom0 grants access permission of pages to DomU  using “gnttab_grant_foreign_access_ref()”

2.     Dom0 passes “Machine Page Numbers” and “Ref” to DomU through I/O Ring

3.     DomU install granted pages. (Change original mfn to new mfn of Dom0)

A.     map.host_addr = mfn_to_virt(pfn_to_mfn(DomU’s PFN));

B.      HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref,&map,count)

C.      Set_phys_to_machine(DomU’s PFN, Dom0’s MFN)

 

 

They are being done in “blkback.c” and “blkfront.c”.

 

The source code is

 

In blkback.c

           dom0_cache_vaddr = get_zeroed_page(GFP_KERNEL);

           dom0_cache_mfn[i] = pfn_to_mfn(__pa(dom0_cache_vaddr) >> PAGE_SHIFT);

share_ref = gnttab_claim_grant_reference(&share_ref_head);

           BUG_ON(share_ref == -ENOSPC);

           share_ref = gnttab_grant_foreign_access( req_domid, dom0_cache_mfn[i], 1);

 

In blkfront.c

           bret = RING_GET_RESPONSE(&info->ring, i);

           map.host_addr = mfn_to_virt(pfn_to_mfn(bret->map_pfn_mfn[j].pfn));

for(j < 0 ; j < number_of_pages ;j++){

                      map.dom = (domid_t) 0;

                      map.ref = bret->map_pfn_mfn[j].ref;

                      map.flags = ( GNTMAP_host_map | GNTMAP_readonly);

                                         

                      ret = HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref,&map,1);

                      BUG_ON(ret);

set_phys_to_machine(

                                bret->map_pfn_mfn[j].pfn,

                                FOREIGN_FRAME((bret->map_pfn_mfn[j].mfn)));

           }

 

For the sharing, I modified response struct. So it has grant ref, Dom0’s MFN and DomU’s PFN now.

 

But I encountered Kernel Panic as DomU booted up.

 

Message :

Unable to handle kernel paging request at virtual address c0cff000

 printing eip:

c0148bc1

*pde = ma 1d639067 pa 0116a067

*pte = ma 0db4f061 pa 10b4f061

 

Question :

1.     Should I update Page table with “HYPERVISOR_mmu_update” in DomU although I call “HYPERVISOR_grant_table_op”??

2.     Anyone can advice to me about this problem? (Anything about the kernel panic message or mistakes in source code)

 

Thank you very much. :-)

 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

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