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

[Xen-devel] [PATCH] Add FreeBSD mappings guest heuristics.



Hello,

This patch adds FreeBSD mappings heuristics to allow faster page promotion.

Also, remove code for unsync va heuristic, not needed anymore.

I admit the guest heuristic are getting too long, but this can be fixed in the future.

Gianluca

Signed-off-by: Gianluca Guida <gianluca.guida@xxxxxxxxxxxxx>

diff -r 5274aa966231 xen/arch/x86/mm/shadow/common.c
--- a/xen/arch/x86/mm/shadow/common.c   Fri Sep 26 11:12:29 2008 +0100
+++ b/xen/arch/x86/mm/shadow/common.c   Fri Sep 26 14:27:11 2008 +0100
@@ -2343,9 +2343,6 @@ int sh_remove_write_access(struct vcpu *
                 return 1;                                               \
             }                                                           \
         } while (0)
-
-        if ( level == 0 && fault_addr )
-            GUESS(fault_addr, 6);
         
         if ( v->arch.paging.mode->guest_levels == 2 )
         {
@@ -2357,6 +2354,10 @@ int sh_remove_write_access(struct vcpu *
             if ((gfn = mfn_to_gfn(v->domain, gmfn)) < 0x38000 ) 
                 GUESS(0xC0000000UL + (gfn << PAGE_SHIFT), 4);
 
+            /* FreeBSD: Linear map at 0xBFC00000 */
+            if ( level == 1 )
+                GUESS(0xBFC00000UL 
+                      + ((fault_addr & VADDR_MASK) >> 10), 6);
         }
         else if ( v->arch.paging.mode->guest_levels == 3 )
         {
@@ -2370,6 +2371,15 @@ int sh_remove_write_access(struct vcpu *
             /* Linux lowmem: first 896MB is mapped 1-to-1 above 0xC0000000 */
             if ((gfn = mfn_to_gfn(v->domain, gmfn)) < 0x38000 ) 
                 GUESS(0xC0000000UL + (gfn << PAGE_SHIFT), 4);
+            
+            /* FreeBSD PAE: Linear map at 0xBF800000 */
+            switch ( level )
+            {
+            case 1: GUESS(0xBF800000UL
+                          + ((fault_addr & VADDR_MASK) >> 9), 6); break;
+            case 2: GUESS(0xBFDFC000UL
+                          + ((fault_addr & VADDR_MASK) >> 18), 6); break;
+            }
         }
 #if CONFIG_PAGING_LEVELS >= 4
         else if ( v->arch.paging.mode->guest_levels == 4 )
@@ -2392,11 +2402,25 @@ int sh_remove_write_access(struct vcpu *
             GUESS(0xffff880000000000UL + (gfn << PAGE_SHIFT), 4);
             GUESS(0xffff810000000000UL + (gfn << PAGE_SHIFT), 4);
             GUESS(0x0000010000000000UL + (gfn << PAGE_SHIFT), 4);
+
             /*
              * 64bit Solaris kernel page map at
              * kpm_vbase; 0xfffffe0000000000UL
              */
             GUESS(0xfffffe0000000000UL + (gfn << PAGE_SHIFT), 4);
+ 
+             /* FreeBSD 64bit: linear map 0xffff800000000000 */
+             switch ( level )
+             {
+             case 1: GUESS(0xffff800000000000
+                           + ((fault_addr & VADDR_MASK) >> 9), 6); break;
+             case 2: GUESS(0xffff804000000000UL
+                           + ((fault_addr & VADDR_MASK) >> 18), 6); break;
+             case 3: GUESS(0xffff804020000000UL
+                           + ((fault_addr & VADDR_MASK) >> 27), 6); break;
+             }
+             /* FreeBSD 64bit: direct map at 0xffffff0000000000 */
+             GUESS(0xffffff0000000000 + (gfn << PAGE_SHIFT), 6);
         }
 #endif /* CONFIG_PAGING_LEVELS >= 4 */
 
diff -r 5274aa966231 xen/include/asm-x86/perfc_defn.h
--- a/xen/include/asm-x86/perfc_defn.h  Fri Sep 26 11:12:29 2008 +0100
+++ b/xen/include/asm-x86/perfc_defn.h  Fri Sep 26 14:27:11 2008 +0100
@@ -80,7 +80,7 @@ PERFCOUNTER(shadow_writeable_h_3,  "shad
 PERFCOUNTER(shadow_writeable_h_3,  "shadow writeable: 64b w2k3")
 PERFCOUNTER(shadow_writeable_h_4,  "shadow writeable: linux low/solaris")
 PERFCOUNTER(shadow_writeable_h_5,  "shadow writeable: linux high")
-PERFCOUNTER(shadow_writeable_h_6,  "shadow writeable: unsync va")
+PERFCOUNTER(shadow_writeable_h_6,  "shadow writeable: FreeBSD")
 PERFCOUNTER(shadow_writeable_h_7,  "shadow writeable: sl1p")
 PERFCOUNTER(shadow_writeable_h_8,  "shadow writeable: sl1p failed")
 PERFCOUNTER(shadow_writeable_bf,   "shadow writeable brute-force")
_______________________________________________
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®.