ia64/xen-unstable

changeset 11159:716ef8e8bddc

[HVM] Fix the issue that the HVM 64bit guest cannot boot with 32G memory.
It enlarges the PGT_mfn_mask to support 27bit, and also remove the
score stuff on x86-64.

Signed-off-by: Jun Nakajima <jun.nakajima@intel.com>
Signed-off-by: Xiaohui Xin <xiaohui.xin@intel.com>
author kfraser@localhost.localdomain
date Wed Aug 16 11:58:48 2006 +0100 (2006-08-16)
parents b127e557ee74
children ff124973a28a
files xen/arch/x86/shadow.c xen/arch/x86/shadow_public.c xen/include/asm-x86/mm.h
line diff
     1.1 --- a/xen/arch/x86/shadow.c	Wed Aug 16 11:55:26 2006 +0100
     1.2 +++ b/xen/arch/x86/shadow.c	Wed Aug 16 11:58:48 2006 +0100
     1.3 @@ -1315,55 +1315,6 @@ static int is_out_of_sync(struct vcpu *v
     1.4      return 0;
     1.5  }
     1.6  
     1.7 -#define GPFN_TO_GPTEPAGE(_gpfn) ((_gpfn) / (PAGE_SIZE / sizeof(guest_l1_pgentry_t)))
     1.8 -static inline unsigned long
     1.9 -predict_writable_pte_page(struct domain *d, unsigned long gpfn)
    1.10 -{
    1.11 -    return __shadow_status(d, GPFN_TO_GPTEPAGE(gpfn), PGT_writable_pred);
    1.12 -}
    1.13 -
    1.14 -static inline void
    1.15 -increase_writable_pte_prediction(struct domain *d, unsigned long gpfn, unsigned long prediction)
    1.16 -{
    1.17 -    unsigned long score = prediction & PGT_score_mask;
    1.18 -    int create = (score == 0);
    1.19 -
    1.20 -    // saturating addition
    1.21 -    score = (score + (1u << PGT_score_shift)) & PGT_score_mask;
    1.22 -    score = score ? score : PGT_score_mask;
    1.23 -
    1.24 -    prediction = (prediction & PGT_mfn_mask) | score;
    1.25 -
    1.26 -    //printk("increase gpfn=%lx pred=%lx create=%d\n", gpfn, prediction, create);
    1.27 -    set_shadow_status(d, GPFN_TO_GPTEPAGE(gpfn), 0, prediction, PGT_writable_pred, 0);
    1.28 -
    1.29 -    if ( create )
    1.30 -        perfc_incr(writable_pte_predictions);
    1.31 -}
    1.32 -
    1.33 -static inline void
    1.34 -decrease_writable_pte_prediction(struct domain *d, unsigned long gpfn, unsigned long prediction)
    1.35 -{
    1.36 -    unsigned long score = prediction & PGT_score_mask;
    1.37 -    ASSERT(score);
    1.38 -
    1.39 -    // divide score by 2...  We don't like bad predictions.
    1.40 -    //
    1.41 -    score = (score >> 1) & PGT_score_mask;
    1.42 -
    1.43 -    prediction = (prediction & PGT_mfn_mask) | score;
    1.44 -
    1.45 -    //printk("decrease gpfn=%lx pred=%lx score=%lx\n", gpfn, prediction, score);
    1.46 -
    1.47 -    if ( score )
    1.48 -        set_shadow_status(d, GPFN_TO_GPTEPAGE(gpfn), 0, prediction, PGT_writable_pred, 0);
    1.49 -    else
    1.50 -    {
    1.51 -        delete_shadow_status(d, GPFN_TO_GPTEPAGE(gpfn), 0, PGT_writable_pred, 0);
    1.52 -        perfc_decr(writable_pte_predictions);
    1.53 -    }
    1.54 -}
    1.55 -
    1.56  static int fix_entry(
    1.57      struct domain *d,
    1.58      l1_pgentry_t *pt, u32 *found, int is_l1_shadow, u32 max_refs_to_find)
     2.1 --- a/xen/arch/x86/shadow_public.c	Wed Aug 16 11:55:26 2006 +0100
     2.2 +++ b/xen/arch/x86/shadow_public.c	Wed Aug 16 11:58:48 2006 +0100
     2.3 @@ -749,7 +749,7 @@ void free_shadow_page(unsigned long smfn
     2.4          unsigned long mfn;
     2.5          mfn = __shadow_status(d, gpfn, PGT_fl1_shadow);
     2.6          if ( !mfn )
     2.7 -            gpfn |= (1UL << 63);
     2.8 +            gpfn |= PGT_high_mfn_nx;
     2.9      }
    2.10  #endif
    2.11  #if CONFIG_PAGING_LEVELS >= 3
     3.1 --- a/xen/include/asm-x86/mm.h	Wed Aug 16 11:55:26 2006 +0100
     3.2 +++ b/xen/include/asm-x86/mm.h	Wed Aug 16 11:58:48 2006 +0100
     3.3 @@ -101,17 +101,17 @@ struct page_info
     3.4  #ifdef __x86_64__
     3.5  #define PGT_high_mfn_shift  52
     3.6  #define PGT_high_mfn_mask   (0xfffUL << PGT_high_mfn_shift)
     3.7 -#define PGT_mfn_mask        (((1U<<23)-1) | PGT_high_mfn_mask)
     3.8 +#define PGT_mfn_mask        (((1U<<27)-1) | PGT_high_mfn_mask)
     3.9  #define PGT_high_mfn_nx     (0x800UL << PGT_high_mfn_shift)
    3.10  #else
    3.11   /* 23-bit mfn mask for shadow types: good for up to 32GB RAM. */
    3.12  #define PGT_mfn_mask        ((1U<<23)-1)
    3.13   /* NX for PAE xen is not supported yet */
    3.14  #define PGT_high_mfn_nx     (1ULL << 63)
    3.15 -#endif
    3.16  
    3.17  #define PGT_score_shift     23
    3.18  #define PGT_score_mask      (((1U<<4)-1)<<PGT_score_shift)
    3.19 +#endif
    3.20  
    3.21   /* Cleared when the owning guest 'frees' this page. */
    3.22  #define _PGC_allocated      31