xcp-1.6-updates/xen-4.1.hg

changeset 23249:b5051d40e1cc

x86/mm/shadow: adjust early-unshadow heuristic for PAE guests.

PAE guests have 8-byte PTEs but tend to clear memory with 4-byte
writes.
This means that when zeroing a former pagetable every second 4-byte
write is unaligned and so the consecutive-zeroes --> unshadow
heuristic never kicks in. Adjust the heuristic not to reset when
a write is >= 4 bytes and writing zero but not PTE-aligned.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
xen-unstable changeset: 23554:c91255b2f0a0
xen-unstable date: Mon Jun 20 13:16:14 2011 +0100
author Tim Deegan <Tim.Deegan@citrix.com>
date Wed Mar 07 09:22:58 2012 +0000 (2012-03-07)
parents b0bf2fc4eff9
children a168569a7659
files xen/arch/x86/mm/shadow/multi.c
line diff
     1.1 --- a/xen/arch/x86/mm/shadow/multi.c	Wed Mar 07 08:43:28 2012 +0000
     1.2 +++ b/xen/arch/x86/mm/shadow/multi.c	Wed Mar 07 09:22:58 2012 +0000
     1.3 @@ -4943,11 +4943,14 @@ static void emulate_unmap_dest(struct vc
     1.4      ASSERT(mfn_valid(sh_ctxt->mfn1));
     1.5  
     1.6      /* If we are writing lots of PTE-aligned zeros, might want to unshadow */
     1.7 -    if ( likely(bytes >= 4)
     1.8 -         && (*(u32 *)addr == 0)
     1.9 -         && ((unsigned long) addr & ((sizeof (guest_intpte_t)) - 1)) == 0 )
    1.10 -        check_for_early_unshadow(v, sh_ctxt->mfn1);
    1.11 -    else
    1.12 +    if ( likely(bytes >= 4) && (*(u32 *)addr == 0) )
    1.13 +    {
    1.14 +        if ( ((unsigned long) addr & ((sizeof (guest_intpte_t)) - 1)) == 0 )
    1.15 +            check_for_early_unshadow(v, sh_ctxt->mfn1);
    1.16 +        /* Don't reset the heuristic if we're writing zeros at non-aligned 
    1.17 +         * addresses, otherwise it doesn't catch REP MOVSD on PAE guests */
    1.18 +    }
    1.19 +    else 
    1.20          reset_early_unshadow(v);
    1.21  
    1.22      /* We can avoid re-verifying the page contents after the write if: