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

[Xen-changelog] [xen-unstable] x86: Define pte_{read, write}[_atomic] in terms of atomic_readN



# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1292528195 0
# Node ID 1cc551716430e296423c95c9c1bb16071c4c3e6c
# Parent  aa33ab320f7e5978cc2158dbcd5da6002afc4b55
x86: Define pte_{read,write}[_atomic] in terms of atomic_readN

Signed-off-by: Keir Fraser <keir@xxxxxxx>
---
 xen/include/asm-x86/x86_32/page.h |   14 +++++---------
 xen/include/asm-x86/x86_64/page.h |    6 +++---
 2 files changed, 8 insertions(+), 12 deletions(-)

diff -r aa33ab320f7e -r 1cc551716430 xen/include/asm-x86/x86_32/page.h
--- a/xen/include/asm-x86/x86_32/page.h Thu Dec 16 19:29:08 2010 +0000
+++ b/xen/include/asm-x86/x86_32/page.h Thu Dec 16 19:36:35 2010 +0000
@@ -84,19 +84,15 @@ extern unsigned int PAGE_HYPERVISOR_NOCA
 
 #endif
 
-#define pte_read_atomic(ptep) cmpxchg(ptep, 0, 0)
-#define pte_write_atomic(ptep, pte) do {                      \
-    intpte_t __pte = *(ptep), __npte;                         \
-    while ( (__npte = cmpxchg(ptep, __pte, (pte))) != __pte ) \
-        __pte = __npte;                                       \
-} while ( 0 )
+#define pte_read_atomic(ptep)       atomic_read64(ptep)
+#define pte_write_atomic(ptep, pte) atomic_write64(ptep, pte)
 #define pte_write(ptep, pte) do {                             \
     u32 *__ptep_words = (u32 *)(ptep);                        \
-    __ptep_words[0] = 0;                                      \
+    atomic_write32(&__ptep_words[0], 0);                      \
     wmb();                                                    \
-    __ptep_words[1] = (pte) >> 32;                            \
+    atomic_write32(&__ptep_words[1], (pte) >> 32);            \
     wmb();                                                    \
-    __ptep_words[0] = (pte) >>  0;                            \
+    atomic_write32(&__ptep_words[0], (pte) >>  0);            \
 } while ( 0 )
 
 /* root table */
diff -r aa33ab320f7e -r 1cc551716430 xen/include/asm-x86/x86_64/page.h
--- a/xen/include/asm-x86/x86_64/page.h Thu Dec 16 19:29:08 2010 +0000
+++ b/xen/include/asm-x86/x86_64/page.h Thu Dec 16 19:36:35 2010 +0000
@@ -113,9 +113,9 @@ typedef l4_pgentry_t root_pgentry_t;
 
 #endif /* !__ASSEMBLY__ */
 
-#define pte_read_atomic(ptep)       (*(ptep))
-#define pte_write_atomic(ptep, pte) (*(ptep) = (pte))
-#define pte_write(ptep, pte)        (*(ptep) = (pte))
+#define pte_read_atomic(ptep)       atomic_read64(ptep)
+#define pte_write_atomic(ptep, pte) atomic_write64(ptep, pte)
+#define pte_write(ptep, pte)        atomic_write64(ptep, pte)
 
 /* Given a virtual address, get an entry offset into a linear page table. */
 #define l1_linear_offset(_a) (((_a) & VADDR_MASK) >> L1_PAGETABLE_SHIFT)

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