ia64/xen-unstable

changeset 18556:840c0c3c185a

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@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Sep 26 15:33:51 2008 +0100 (2008-09-26)
parents 19b0a4f91712
children 1420a6649cfa
files xen/arch/x86/mm/shadow/common.c xen/include/asm-x86/perfc_defn.h
line diff
     1.1 --- a/xen/arch/x86/mm/shadow/common.c	Fri Sep 26 14:05:41 2008 +0100
     1.2 +++ b/xen/arch/x86/mm/shadow/common.c	Fri Sep 26 15:33:51 2008 +0100
     1.3 @@ -2343,9 +2343,6 @@ int sh_remove_write_access(struct vcpu *
     1.4                  return 1;                                               \
     1.5              }                                                           \
     1.6          } while (0)
     1.7 -
     1.8 -        if ( level == 0 && fault_addr )
     1.9 -            GUESS(fault_addr, 6);
    1.10          
    1.11          if ( v->arch.paging.mode->guest_levels == 2 )
    1.12          {
    1.13 @@ -2357,6 +2354,10 @@ int sh_remove_write_access(struct vcpu *
    1.14              if ((gfn = mfn_to_gfn(v->domain, gmfn)) < 0x38000 ) 
    1.15                  GUESS(0xC0000000UL + (gfn << PAGE_SHIFT), 4);
    1.16  
    1.17 +            /* FreeBSD: Linear map at 0xBFC00000 */
    1.18 +            if ( level == 1 )
    1.19 +                GUESS(0xBFC00000UL 
    1.20 +                      + ((fault_addr & VADDR_MASK) >> 10), 6);
    1.21          }
    1.22          else if ( v->arch.paging.mode->guest_levels == 3 )
    1.23          {
    1.24 @@ -2370,6 +2371,15 @@ int sh_remove_write_access(struct vcpu *
    1.25              /* Linux lowmem: first 896MB is mapped 1-to-1 above 0xC0000000 */
    1.26              if ((gfn = mfn_to_gfn(v->domain, gmfn)) < 0x38000 ) 
    1.27                  GUESS(0xC0000000UL + (gfn << PAGE_SHIFT), 4);
    1.28 +            
    1.29 +            /* FreeBSD PAE: Linear map at 0xBF800000 */
    1.30 +            switch ( level )
    1.31 +            {
    1.32 +            case 1: GUESS(0xBF800000UL
    1.33 +                          + ((fault_addr & VADDR_MASK) >> 9), 6); break;
    1.34 +            case 2: GUESS(0xBFDFC000UL
    1.35 +                          + ((fault_addr & VADDR_MASK) >> 18), 6); break;
    1.36 +            }
    1.37          }
    1.38  #if CONFIG_PAGING_LEVELS >= 4
    1.39          else if ( v->arch.paging.mode->guest_levels == 4 )
    1.40 @@ -2392,11 +2402,25 @@ int sh_remove_write_access(struct vcpu *
    1.41              GUESS(0xffff880000000000UL + (gfn << PAGE_SHIFT), 4);
    1.42              GUESS(0xffff810000000000UL + (gfn << PAGE_SHIFT), 4);
    1.43              GUESS(0x0000010000000000UL + (gfn << PAGE_SHIFT), 4);
    1.44 +
    1.45              /*
    1.46               * 64bit Solaris kernel page map at
    1.47               * kpm_vbase; 0xfffffe0000000000UL
    1.48               */
    1.49              GUESS(0xfffffe0000000000UL + (gfn << PAGE_SHIFT), 4);
    1.50 + 
    1.51 +             /* FreeBSD 64bit: linear map 0xffff800000000000 */
    1.52 +             switch ( level )
    1.53 +             {
    1.54 +             case 1: GUESS(0xffff800000000000
    1.55 +                           + ((fault_addr & VADDR_MASK) >> 9), 6); break;
    1.56 +             case 2: GUESS(0xffff804000000000UL
    1.57 +                           + ((fault_addr & VADDR_MASK) >> 18), 6); break;
    1.58 +             case 3: GUESS(0xffff804020000000UL
    1.59 +                           + ((fault_addr & VADDR_MASK) >> 27), 6); break;
    1.60 +             }
    1.61 +             /* FreeBSD 64bit: direct map at 0xffffff0000000000 */
    1.62 +             GUESS(0xffffff0000000000 + (gfn << PAGE_SHIFT), 6);
    1.63          }
    1.64  #endif /* CONFIG_PAGING_LEVELS >= 4 */
    1.65  
     2.1 --- a/xen/include/asm-x86/perfc_defn.h	Fri Sep 26 14:05:41 2008 +0100
     2.2 +++ b/xen/include/asm-x86/perfc_defn.h	Fri Sep 26 15:33:51 2008 +0100
     2.3 @@ -80,7 +80,7 @@ PERFCOUNTER(shadow_writeable_h_2,  "shad
     2.4  PERFCOUNTER(shadow_writeable_h_3,  "shadow writeable: 64b w2k3")
     2.5  PERFCOUNTER(shadow_writeable_h_4,  "shadow writeable: linux low/solaris")
     2.6  PERFCOUNTER(shadow_writeable_h_5,  "shadow writeable: linux high")
     2.7 -PERFCOUNTER(shadow_writeable_h_6,  "shadow writeable: unsync va")
     2.8 +PERFCOUNTER(shadow_writeable_h_6,  "shadow writeable: FreeBSD")
     2.9  PERFCOUNTER(shadow_writeable_h_7,  "shadow writeable: sl1p")
    2.10  PERFCOUNTER(shadow_writeable_h_8,  "shadow writeable: sl1p failed")
    2.11  PERFCOUNTER(shadow_writeable_bf,   "shadow writeable brute-force")