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-devel

[Xen-devel] [PATCH] i386: simplify pte_read_atomic()

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] i386: simplify pte_read_atomic()
From: "Jan Beulich" <JBeulich@xxxxxxxxxx>
Date: Fri, 29 Oct 2010 16:44:09 +0100
Delivery-date: Fri, 29 Oct 2010 08:52:26 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
There's no need for a loop here: if the value to be compared against
and the value to be stored are equal, cmpxchg{,8b} act just like a
load anyway.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

--- a/xen/include/asm-x86/x86_32/page.h
+++ b/xen/include/asm-x86/x86_32/page.h
@@ -84,11 +84,7 @@ 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_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 ) \



Attachment: i386-pte-read-atomic.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] i386: simplify pte_read_atomic(), Jan Beulich <=