diff options
Diffstat (limited to 'trunk/2.6.22/20039_265-ptep_get_and_clear.patch1')
-rw-r--r-- | trunk/2.6.22/20039_265-ptep_get_and_clear.patch1 | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/trunk/2.6.22/20039_265-ptep_get_and_clear.patch1 b/trunk/2.6.22/20039_265-ptep_get_and_clear.patch1 new file mode 100644 index 0000000..b7cf4fa --- /dev/null +++ b/trunk/2.6.22/20039_265-ptep_get_and_clear.patch1 @@ -0,0 +1,74 @@ +# HG changeset 265+266 patch +# User Keir Fraser <keir@xensource.com> +# Date 1192720728 -3600 +# Node ID 7837d0ec57bce4578c17018ca1ef1ded64fe1dd3 +# Parent 3116d92146522ae5989b40e1915d0baf6daa1008 +Subject: Fix ptep_get_and_clear() on init_mm pte that is not mapped into +current address space. +Signed-off-by: Keir Fraser <keir@xensource.com> + +Fix ptep_get_and_clear(): atomic operation required on user ptes to +get correct snapshot of A/D bits. + +Signed-off-by: Keir Fraser <keir@xensource.com> + +Acked-by: jbeulich@novell.com + +Index: 10.3-2007-10-22/include/asm-i386/mach-xen/asm/pgtable-2level.h +=================================================================== +--- 10.3-2007-10-22.orig/include/asm-i386/mach-xen/asm/pgtable-2level.h 2007-10-22 13:48:12.000000000 +0200 ++++ 10.3-2007-10-22/include/asm-i386/mach-xen/asm/pgtable-2level.h 2007-10-22 13:52:04.000000000 +0200 +@@ -42,10 +42,9 @@ static inline pte_t ptep_get_and_clear(s + { + pte_t pte = *ptep; + if (!pte_none(pte)) { +- if (mm != &init_mm) ++ if ((mm != &init_mm) || ++ HYPERVISOR_update_va_mapping(addr, __pte(0), 0)) + pte = __pte_ma(xchg(&ptep->pte_low, 0)); +- else +- HYPERVISOR_update_va_mapping(addr, __pte(0), 0); + } + return pte; + } +Index: 10.3-2007-10-22/include/asm-i386/mach-xen/asm/pgtable-3level.h +=================================================================== +--- 10.3-2007-10-22.orig/include/asm-i386/mach-xen/asm/pgtable-3level.h 2007-10-22 13:48:12.000000000 +0200 ++++ 10.3-2007-10-22/include/asm-i386/mach-xen/asm/pgtable-3level.h 2007-10-22 13:52:04.000000000 +0200 +@@ -125,7 +125,8 @@ static inline pte_t ptep_get_and_clear(s + { + pte_t pte = *ptep; + if (!pte_none(pte)) { +- if (mm != &init_mm) { ++ if ((mm != &init_mm) || ++ HYPERVISOR_update_va_mapping(addr, __pte(0), 0)) { + uint64_t val = pte_val_ma(pte); + if (__cmpxchg64(ptep, val, 0) != val) { + /* xchg acts as a barrier before the setting of the high bits */ +@@ -133,8 +134,7 @@ static inline pte_t ptep_get_and_clear(s + pte.pte_high = ptep->pte_high; + ptep->pte_high = 0; + } +- } else +- HYPERVISOR_update_va_mapping(addr, __pte(0), 0); ++ } + } + return pte; + } +Index: 10.3-2007-10-22/include/asm-x86_64/mach-xen/asm/pgtable.h +=================================================================== +--- 10.3-2007-10-22.orig/include/asm-x86_64/mach-xen/asm/pgtable.h 2007-10-22 13:48:12.000000000 +0200 ++++ 10.3-2007-10-22/include/asm-x86_64/mach-xen/asm/pgtable.h 2007-10-22 13:52:04.000000000 +0200 +@@ -282,10 +282,9 @@ static inline pte_t ptep_get_and_clear(s + { + pte_t pte = *ptep; + if (!pte_none(pte)) { +- if (mm != &init_mm) ++ if ((mm != &init_mm) || ++ HYPERVISOR_update_va_mapping(addr, __pte(0), 0)) + pte = __pte_ma(xchg(&ptep->pte, 0)); +- else +- HYPERVISOR_update_va_mapping(addr, __pte(0), 0); + } + return pte; + } |