diff options
author | Tim Deegan <Tim.Deegan@citrix.com> | 2012-03-07 09:22:58 +0000 |
---|---|---|
committer | Tim Deegan <Tim.Deegan@citrix.com> | 2012-03-07 09:22:58 +0000 |
commit | 21fb307747b358e43fe9a97a83f06e96552435d8 (patch) | |
tree | c476bb9d00eb6068efb238e56da910ceaf67258a | |
parent | 59cabad54a0e95d44cef3c1898b21bd9439efd86 (diff) | |
download | xen-21fb307747b358e43fe9a97a83f06e96552435d8.tar.gz xen-21fb307747b358e43fe9a97a83f06e96552435d8.tar.bz2 xen-21fb307747b358e43fe9a97a83f06e96552435d8.zip |
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
-rw-r--r-- | xen/arch/x86/mm/shadow/multi.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c index b5dd391faa..37cbc3d087 100644 --- a/xen/arch/x86/mm/shadow/multi.c +++ b/xen/arch/x86/mm/shadow/multi.c @@ -4943,11 +4943,14 @@ static void emulate_unmap_dest(struct vcpu *v, ASSERT(mfn_valid(sh_ctxt->mfn1)); /* If we are writing lots of PTE-aligned zeros, might want to unshadow */ - if ( likely(bytes >= 4) - && (*(u32 *)addr == 0) - && ((unsigned long) addr & ((sizeof (guest_intpte_t)) - 1)) == 0 ) - check_for_early_unshadow(v, sh_ctxt->mfn1); - else + if ( likely(bytes >= 4) && (*(u32 *)addr == 0) ) + { + if ( ((unsigned long) addr & ((sizeof (guest_intpte_t)) - 1)) == 0 ) + check_for_early_unshadow(v, sh_ctxt->mfn1); + /* Don't reset the heuristic if we're writing zeros at non-aligned + * addresses, otherwise it doesn't catch REP MOVSD on PAE guests */ + } + else reset_early_unshadow(v); /* We can avoid re-verifying the page contents after the write if: |