# HG changeset patch
# User George Dunlap <dunlapg@xxxxxxxxx>
# Date 1168974252 18000
# Node ID fd2667419c53ce2555c799acf3e84dd25912bcb5
# Parent 895d873a00b47cb7b0edf3d0b6a42f47a3f4854c
[XEN] Fix early-unshadow detection for 3- or 4-level guest pagetables.
Early-unshadow will unshadow whenever 2 zero values are written
to the same page; for PAE, one PTE takes 2 writes. Only check
for the early unshadow when writing the low half of the PTE.
---
xen/arch/x86/mm/shadow/multi.c | 4 ++--
xen/arch/x86/mm/shadow/private.h | 5 +++++
2 files changed, 7 insertions(+), 2 deletions(-)
diff -r 895d873a00b4 -r fd2667419c53 xen/arch/x86/mm/shadow/multi.c
--- a/xen/arch/x86/mm/shadow/multi.c Tue Jan 16 10:02:50 2007 +0000
+++ b/xen/arch/x86/mm/shadow/multi.c Tue Jan 16 14:04:12 2007 -0500
@@ -3944,7 +3944,7 @@ sh_x86_emulate_write(struct vcpu *v, uns
if ( !skip ) sh_validate_guest_pt_write(v, mfn, addr, bytes);
/* If we are writing zeros to this page, might want to unshadow */
- if ( likely(bytes >= 4) && (*(u32 *)addr == 0) )
+ if ( likely(bytes >= 4) && (*(u32 *)addr == 0) && is_lo_pte(vaddr) )
check_for_early_unshadow(v, mfn);
sh_unmap_domain_page(addr);
@@ -3996,7 +3996,7 @@ sh_x86_emulate_cmpxchg(struct vcpu *v, u
vaddr, prev, old, new, *(unsigned long *)addr, bytes);
/* If we are writing zeros to this page, might want to unshadow */
- if ( likely(bytes >= 4) && (*(u32 *)addr == 0) )
+ if ( likely(bytes >= 4) && (*(u32 *)addr == 0) && is_lo_pte(vaddr) )
check_for_early_unshadow(v, mfn);
sh_unmap_domain_page(addr);
diff -r 895d873a00b4 -r fd2667419c53 xen/arch/x86/mm/shadow/private.h
--- a/xen/arch/x86/mm/shadow/private.h Tue Jan 16 10:02:50 2007 +0000
+++ b/xen/arch/x86/mm/shadow/private.h Tue Jan 16 14:04:12 2007 -0500
@@ -427,6 +427,11 @@ extern int sh_remove_write_access(struct
#undef mfn_valid
#define mfn_valid(_mfn) (mfn_x(_mfn) < max_page)
+#if GUEST_PAGING_LEVELS >= 3
+# define is_lo_pte(_vaddr) (((_vaddr)&0x4)==0)
+#else
+# define is_lo_pte(_vaddr) (1)
+#endif
static inline int
sh_mfn_is_a_page_table(mfn_t gmfn)
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|