WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] Share Memory Between DomainU and Domain0

To: "JungHyun.Kim" <jhkim@xxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] Share Memory Between DomainU and Domain0
From: "M.A. Williamson" <maw48@xxxxxxxxx>
Date: 28 Dec 2006 03:19:03 +0000
Cc: Xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Wed, 27 Dec 2006 19:18:54 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <001801c71a18$0f076a70$2d163f50$@kaist.ac.kr>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <001801c71a18$0f076a70$2d163f50$@kaist.ac.kr>
Reply-to: mark.williamson@xxxxxxxxxxxx
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Hi there!

Have you made any progress with this? I've made some comments inline below...

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)

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.

OK. Make sure your dom0 and domU are *definitely* using the same version of the block drivers, and that both kernels are compiled to use your modified request structure. Otherwise things will get very confused. If you're using two kernels, make sure you rebuild them both.

How does dom0 know what the domU's pfn is in order to queue it in responses?

But I encountered Kernel Panic as DomU booted up.
<snip>

Question :

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

That shouldn't be necessary.

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

Are you trying to implement a shared buffer cache or something similar? Could you possibly post your entire diff vs the standard block drivers so that I can take a look at everything in context? I've written some similar code to this but would like to look through a full diff if possible.

Cheers,
Mark

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

<Prev in Thread] Current Thread [Next in Thread>