[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [linux-2.6.18-xen] Fix ptep_get_and_clear() on init_mm pte that is not mapped into



# HG changeset patch
# User Keir Fraser <keir@xxxxxxxxxxxxx>
# Date 1192720728 -3600
# Node ID 7837d0ec57bce4578c17018ca1ef1ded64fe1dd3
# Parent  3116d92146522ae5989b40e1915d0baf6daa1008
Fix ptep_get_and_clear() on init_mm pte that is not mapped into
current address space.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 include/asm-i386/mach-xen/asm/pgtable-2level.h |    5 ++---
 include/asm-i386/mach-xen/asm/pgtable-3level.h |    6 +++---
 include/asm-x86_64/mach-xen/asm/pgtable.h      |    5 ++---
 3 files changed, 7 insertions(+), 9 deletions(-)

diff -r 3116d9214652 -r 7837d0ec57bc 
include/asm-i386/mach-xen/asm/pgtable-2level.h
--- a/include/asm-i386/mach-xen/asm/pgtable-2level.h    Thu Oct 18 11:18:55 
2007 +0100
+++ b/include/asm-i386/mach-xen/asm/pgtable-2level.h    Thu Oct 18 16:18:48 
2007 +0100
@@ -44,10 +44,9 @@ static inline pte_t ptep_get_and_clear(s
 {
        pte_t pte = *ptep;
        if (!pte_none(pte)) {
-               if (mm != &init_mm)
+               if ((mm != current->mm && 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;
 }
diff -r 3116d9214652 -r 7837d0ec57bc 
include/asm-i386/mach-xen/asm/pgtable-3level.h
--- a/include/asm-i386/mach-xen/asm/pgtable-3level.h    Thu Oct 18 11:18:55 
2007 +0100
+++ b/include/asm-i386/mach-xen/asm/pgtable-3level.h    Thu Oct 18 16:18:48 
2007 +0100
@@ -128,7 +128,8 @@ static inline pte_t ptep_get_and_clear(s
 {
        pte_t pte = *ptep;
        if (!pte_none(pte)) {
-               if (mm != &init_mm) {
+               if ((mm != current->mm && mm != &init_mm) ||
+                   HYPERVISOR_update_va_mapping(addr, __pte(0), 0)) {
                        uint64_t val = __pte_val(pte);
                        if (__cmpxchg64(ptep, val, 0) != val) {
                                /* xchg acts as a barrier before the setting of 
the high bits */
@@ -136,8 +137,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;
 }
diff -r 3116d9214652 -r 7837d0ec57bc include/asm-x86_64/mach-xen/asm/pgtable.h
--- a/include/asm-x86_64/mach-xen/asm/pgtable.h Thu Oct 18 11:18:55 2007 +0100
+++ b/include/asm-x86_64/mach-xen/asm/pgtable.h Thu Oct 18 16:18:48 2007 +0100
@@ -285,10 +285,9 @@ static inline pte_t ptep_get_and_clear(s
 {
        pte_t pte = *ptep;
        if (!pte_none(pte)) {
-               if (mm != &init_mm)
+               if ((mm != current->mm && 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;
 }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.