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

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



# HG changeset patch
# User Keir Fraser <keir@xxxxxxxxxxxxx>
# Date 1192783509 -3600
# Node ID 16de1090aa7e8d3087ed427811d78dba07665509
# Parent  0696d1ad7f1491c190df397337179207570bbdba
Fix ptep_get_and_clear() on init_mm pte that is not mapped into
current address space.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
linux-2.6.18-xen changeset:   265:7837d0ec57bce4578c17018ca1ef1ded64fe1dd3
linux-2.6.18-xen date:        Thu Oct 18 16:18:48 2007 +0100

Fix ptep_get_and_clear(): atomic operation required on user ptes to
get correct snapshot of A/D bits.

Error pointed out by Jan Beulich.

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
linux-2.6.18-xen changeset:   266:8302e7fad91e9620ef5160c4b54d22d7b97666c8
linux-2.6.18-xen date:        Fri Oct 19 09:21:05 2007 +0100
---
 linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-2level.h |    5 
++---
 linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-3level.h |    6 
+++---
 linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/pgtable.h      |    5 
++---
 3 files changed, 7 insertions(+), 9 deletions(-)

diff -r 0696d1ad7f14 -r 16de1090aa7e 
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-2level.h
--- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-2level.h       
Fri Oct 19 09:43:46 2007 +0100
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-2level.h       
Fri Oct 19 09:45:09 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 != &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 0696d1ad7f14 -r 16de1090aa7e 
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-3level.h
--- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-3level.h       
Fri Oct 19 09:43:46 2007 +0100
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-3level.h       
Fri Oct 19 09:45:09 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 != &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 0696d1ad7f14 -r 16de1090aa7e 
linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/pgtable.h
--- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/pgtable.h    Fri Oct 
19 09:43:46 2007 +0100
+++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/pgtable.h    Fri Oct 
19 09:45:09 2007 +0100
@@ -286,10 +286,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;
 }

_______________________________________________
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®.