From: "JungHyun.Kim" Subject: Share Memory Between DomainU and Domain0 Date: Fri, 8 Dec 2006 00:55:03 +0900 Message-ID: <001801c71a18$0f076a70$2d163f50$@kaist.ac.kr> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1079406979==" Return-path: Content-Language: ko List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Mime-version: 1.0 Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org This is a multipart message in MIME format. --===============1079406979== Content-Type: multipart/alternative; boundary="----=_NextPart_000_0019_01C71A63.7EEF1270" Content-Language: ko This is a multipart message in MIME format. ------=_NextPart_000_0019_01C71A63.7EEF1270 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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. :-) ------=_NextPart_000_0019_01C71A63.7EEF1270 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

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 =3D mfn_to_virt(pfn_to_mfn(DomU’s PFN));

B.      HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref,&map,co= unt)

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 =3D get_zeroed_page(GFP_KERNEL);

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

share_ref =3D gnttab_claim_grant_reference(&share_ref_head);

          = BUG_ON(share_ref =3D=3D -ENOSPC);

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

 

In = blkfront.c

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

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

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

          =            map.dom =3D (domid_t) 0;

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

          =            map.flags =3D ( GNTMAP_host_map | GNTMAP_readonly);

          =             &= nbsp;           &n= bsp;      

          =            ret =3D = HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref,&map,1);<= /span>

          =            = BUG_ON(ret);

set_phys_to_machine(

          =            =            = bret->map_pfn_mfn[j].pfn,

          = =             &= nbsp;        = 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 =3D ma 1d639067 pa 0116a067

*pte =3D 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. = :-)

 

------=_NextPart_000_0019_01C71A63.7EEF1270-- --===============1079406979== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============1079406979==--