WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-4.0-testing] x86: Define pte_{read, write}[_atomic]

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-4.0-testing] x86: Define pte_{read, write}[_atomic] in terms of atomic_readN
From: "Xen patchbot-4.0-testing" <patchbot-4.0-testing@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 23 Dec 2010 11:35:24 -0800
Delivery-date: Thu, 23 Dec 2010 11:37:31 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1292530427 0
# Node ID 4cf3919db1b5b8d04f43887b389dbf9d4191feee
# Parent  d11341841f449d4ec51ebcf720d28bab957ccdfe
x86: Define pte_{read,write}[_atomic] in terms of atomic_readN

Signed-off-by: Keir Fraser <keir@xxxxxxx>
xen-unstable changeset:   22565:1cc551716430
xen-unstable date:        Thu Dec 16 19:36:35 2010 +0000
---
 xen/include/asm-x86/x86_32/page.h |   18 +++++-------------
 xen/include/asm-x86/x86_64/page.h |    6 +++---
 2 files changed, 8 insertions(+), 16 deletions(-)

diff -r d11341841f44 -r 4cf3919db1b5 xen/include/asm-x86/x86_32/page.h
--- a/xen/include/asm-x86/x86_32/page.h Thu Dec 16 20:10:32 2010 +0000
+++ b/xen/include/asm-x86/x86_32/page.h Thu Dec 16 20:13:47 2010 +0000
@@ -79,23 +79,15 @@ extern unsigned int PAGE_HYPERVISOR_NOCA
 
 #endif
 
-#define pte_read_atomic(ptep) ({                              \
-    intpte_t __pte = *(ptep), __npte;                         \
-    while ( (__npte = cmpxchg(ptep, __pte, __pte)) != __pte ) \
-        __pte = __npte;                                       \
-    __pte; })
-#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 d11341841f44 -r 4cf3919db1b5 xen/include/asm-x86/x86_64/page.h
--- a/xen/include/asm-x86/x86_64/page.h Thu Dec 16 20:10:32 2010 +0000
+++ b/xen/include/asm-x86/x86_64/page.h Thu Dec 16 20:13:47 2010 +0000
@@ -99,9 +99,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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-4.0-testing] x86: Define pte_{read, write}[_atomic] in terms of atomic_readN, Xen patchbot-4.0-testing <=