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

[Xen-changelog] [xen-unstable] x86 shadow: Add FreeBSD mappings guest heuristics.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1222439631 -3600
# Node ID 840c0c3c185ae2b0baeceba7caf2f420a44f116d
# Parent  19b0a4f91712ed2ae4d5a7276ff7412edfe95593
x86 shadow: Add FreeBSD mappings guest heuristics.

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

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

Signed-off-by: Gianluca Guida <gianluca.guida@xxxxxxxxxxxxx>
---
 xen/arch/x86/mm/shadow/common.c  |   30 +++++++++++++++++++++++++++---
 xen/include/asm-x86/perfc_defn.h |    2 +-
 2 files changed, 28 insertions(+), 4 deletions(-)

diff -r 19b0a4f91712 -r 840c0c3c185a xen/arch/x86/mm/shadow/common.c
--- a/xen/arch/x86/mm/shadow/common.c   Fri Sep 26 14:05:41 2008 +0100
+++ b/xen/arch/x86/mm/shadow/common.c   Fri Sep 26 15:33:51 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 19b0a4f91712 -r 840c0c3c185a xen/include/asm-x86/perfc_defn.h
--- a/xen/include/asm-x86/perfc_defn.h  Fri Sep 26 14:05:41 2008 +0100
+++ b/xen/include/asm-x86/perfc_defn.h  Fri Sep 26 15:33:51 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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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