mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
[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>
This commit is contained in:
1 parent
0becb32e43
commit
9c4e5c70be
3 files changed
+3
-52
No files matched your search
@@ -1315,55 +1315,6 @@ static int is_out_of_sync(struct vcpu *v, unsigned long va) /* __shadow_out_of_s
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define GPFN_TO_GPTEPAGE(_gpfn) ((_gpfn) / (PAGE_SIZE / sizeof(guest_l1_pgentry_t)))
|
||||
static inline unsigned long
|
||||
predict_writable_pte_page(struct domain *d, unsigned long gpfn)
|
||||
{
|
||||
return __shadow_status(d, GPFN_TO_GPTEPAGE(gpfn), PGT_writable_pred);
|
||||
}
|
||||
|
||||
static inline void
|
||||
increase_writable_pte_prediction(struct domain *d, unsigned long gpfn, unsigned long prediction)
|
||||
{
|
||||
unsigned long score = prediction & PGT_score_mask;
|
||||
int create = (score == 0);
|
||||
|
||||
// saturating addition
|
||||
score = (score + (1u << PGT_score_shift)) & PGT_score_mask;
|
||||
score = score ? score : PGT_score_mask;
|
||||
|
||||
prediction = (prediction & PGT_mfn_mask) | score;
|
||||
|
||||
//printk("increase gpfn=%lx pred=%lx create=%d\n", gpfn, prediction, create);
|
||||
set_shadow_status(d, GPFN_TO_GPTEPAGE(gpfn), 0, prediction, PGT_writable_pred, 0);
|
||||
|
||||
if ( create )
|
||||
perfc_incr(writable_pte_predictions);
|
||||
}
|
||||
|
||||
static inline void
|
||||
decrease_writable_pte_prediction(struct domain *d, unsigned long gpfn, unsigned long prediction)
|
||||
{
|
||||
unsigned long score = prediction & PGT_score_mask;
|
||||
ASSERT(score);
|
||||
|
||||
// divide score by 2... We don't like bad predictions.
|
||||
//
|
||||
score = (score >> 1) & PGT_score_mask;
|
||||
|
||||
prediction = (prediction & PGT_mfn_mask) | score;
|
||||
|
||||
//printk("decrease gpfn=%lx pred=%lx score=%lx\n", gpfn, prediction, score);
|
||||
|
||||
if ( score )
|
||||
set_shadow_status(d, GPFN_TO_GPTEPAGE(gpfn), 0, prediction, PGT_writable_pred, 0);
|
||||
else
|
||||
{
|
||||
delete_shadow_status(d, GPFN_TO_GPTEPAGE(gpfn), 0, PGT_writable_pred, 0);
|
||||
perfc_decr(writable_pte_predictions);
|
||||
}
|
||||
}
|
||||
|
||||
static int fix_entry(
|
||||
struct domain *d,
|
||||
l1_pgentry_t *pt, u32 *found, int is_l1_shadow, u32 max_refs_to_find)
|
||||
|
||||
@@ -749,7 +749,7 @@ void free_shadow_page(unsigned long smfn)
|
||||
unsigned long mfn;
|
||||
mfn = __shadow_status(d, gpfn, PGT_fl1_shadow);
|
||||
if ( !mfn )
|
||||
gpfn |= (1UL << 63);
|
||||
gpfn |= PGT_high_mfn_nx;
|
||||
}
|
||||
#endif
|
||||
#if CONFIG_PAGING_LEVELS >= 3
|
||||
|
||||
@@ -101,17 +101,17 @@ struct page_info
|
||||
#ifdef __x86_64__
|
||||
#define PGT_high_mfn_shift 52
|
||||
#define PGT_high_mfn_mask (0xfffUL << PGT_high_mfn_shift)
|
||||
#define PGT_mfn_mask (((1U<<23)-1) | PGT_high_mfn_mask)
|
||||
#define PGT_mfn_mask (((1U<<27)-1) | PGT_high_mfn_mask)
|
||||
#define PGT_high_mfn_nx (0x800UL << PGT_high_mfn_shift)
|
||||
#else
|
||||
/* 23-bit mfn mask for shadow types: good for up to 32GB RAM. */
|
||||
#define PGT_mfn_mask ((1U<<23)-1)
|
||||
/* NX for PAE xen is not supported yet */
|
||||
#define PGT_high_mfn_nx (1ULL << 63)
|
||||
#endif
|
||||
|
||||
#define PGT_score_shift 23
|
||||
#define PGT_score_mask (((1U<<4)-1)<<PGT_score_shift)
|
||||
#endif
|
||||
|
||||
/* Cleared when the owning guest 'frees' this page. */
|
||||
#define _PGC_allocated 31
|
||||
|
||||