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] [PATCH] Paging and memory sharing for HVM guests

To: Dan Magenheimer <dan.magenheimer@xxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] Paging and memory sharing for HVM guests
From: Patrick Colp <pjcolp@xxxxxxxxx>
Date: Wed, 16 Dec 2009 16:00:22 -0800
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx, Keir Fraser <keir.fraser@xxxxxxxxxxxxx>, Grzegorz Milos <gm281@xxxxxxxxx>, Andrew Peace <Andrew.Peace@xxxxxxxxxxxxx>
Delivery-date: Wed, 16 Dec 2009 16:00:54 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <e694a260-5f70-40f1-9136-40e7b1a077f7@default>
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/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <e694a260-5f70-40f1-9136-40e7b1a077f7@default>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.23 (X11/20090817)
Oops! I've attached the missing patch.

The easiest way to apply them is to use a mercurial patch queue, but simply applying them in order of the series file works too. Did the patches that failed fail before or after this missing one? If after, then try again with this patch and see if there are still any problems. If before, which patches?

The queue was refreshed against revision 20683, pulled yesterday morning.


Patrick


Dan Magenheimer wrote:
Hi Gregor and Patrick --

Congrats!

Could you provide instructions on how to apply them
to xen-unstable tip?  I tried applying them using
"patch -p1" in the order given in the file "series"
and most applied but I got a handful of failed hunks
and even one patch file missing altogether
(...pfec_page_paged.patch).

(Just xen patches, no Linux patches tried yet.)

Thanks,
Dan

-----Original Message-----
From: Grzegorz Milos [mailto:gm281@xxxxxxxxx]
Sent: Wednesday, December 16, 2009 4:15 PM
To: xen-devel@xxxxxxxxxxxxxxxxxxx; Patrick Colp; Andrew Peace; Keir
Fraser
Subject: [Xen-devel] [PATCH] Paging and memory sharing for HVM guests


The series of 46 patches attached to this email contain the initial
implementation of memory paging and sharing for Xen. Patrick Colp
leads the work on the pager, and I am mostly responsible for memory
sharing. We would be grateful for any comments/suggestions you might
have. Individual patches are labeled with comments describing their
purpose and a sign-off footnote. Of course we are happy to discuss
them in more detail, as required. Assuming that there are no major
objections against including them in the mainstream xen-unstable tree,
we would like to move future development to that tree.

Thanks
Patrick & Gregor


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
hap_gva_to_gfn paging support. Return PFEC_page_paged when a paged
out page is found. Ensure top-level page table page and l1 entry
are paged in. If an intermediary page table page is paged out,
propogate error to caller.

Signed-off-by: Patrick Colp <Patrick.Colp@xxxxxxxxxx>

diff -r 5c370b75a5b7 xen/arch/x86/mm/hap/guest_walk.c
--- a/xen/arch/x86/mm/hap/guest_walk.c  Wed Oct 14 10:33:40 2009 -0700
+++ b/xen/arch/x86/mm/hap/guest_walk.c  Wed Oct 14 10:33:44 2009 -0700
@@ -46,6 +46,14 @@
     /* Get the top-level table's MFN */
     cr3 = v->arch.hvm_vcpu.guest_cr[3];
     top_mfn = gfn_to_mfn(v->domain, _gfn(cr3 >> PAGE_SHIFT), &p2mt);
+    if ( p2m_is_paging(p2mt) )
+    {
+//        if ( p2m_is_paged(p2mt) )
+            p2m_mem_paging_populate(v->domain, cr3 >> PAGE_SHIFT);
+
+        pfec[0] = PFEC_page_paged;
+        return INVALID_GFN;
+    }
     if ( !p2m_is_ram(p2mt) )
     {
         pfec[0] &= ~PFEC_page_present;
@@ -62,12 +70,28 @@
     unmap_domain_page(top_map);
 
     /* Interpret the answer */
-    if ( missing == 0 ) 
-        return gfn_x(guest_l1e_get_gfn(gw.l1e));
-    
+    if ( missing == 0 )
+    {
+        gfn_t gfn = guest_l1e_get_gfn(gw.l1e);
+        gfn_to_mfn(v->domain, gfn, &p2mt);
+        if ( p2m_is_paging(p2mt) )
+        {
+//            if ( p2m_is_paged(p2mt) )
+                p2m_mem_paging_populate(v->domain, gfn_x(gfn));
+
+            pfec[0] = PFEC_page_paged;
+            return INVALID_GFN;
+        }
+
+        return gfn_x(gfn);
+    }
+
     if ( missing & _PAGE_PRESENT )
         pfec[0] &= ~PFEC_page_present;
-    
+
+    if ( missing & _PAGE_PAGED )
+        pfec[0] = PFEC_page_paged;
+
     return INVALID_GFN;
 }
 
diff -r 5c370b75a5b7 xen/include/asm-x86/processor.h
--- a/xen/include/asm-x86/processor.h   Wed Oct 14 10:33:40 2009 -0700
+++ b/xen/include/asm-x86/processor.h   Wed Oct 14 10:33:44 2009 -0700
@@ -132,6 +132,7 @@
 #define PFEC_user_mode      (1U<<2)
 #define PFEC_reserved_bit   (1U<<3)
 #define PFEC_insn_fetch     (1U<<4)
+#define PFEC_page_paged     (1U<<5)
 
 #ifndef __ASSEMBLY__
 
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel