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

[Xen-devel] [PATCH v2] xen/x86: lock cacheline for add_sized()



add_sized() should use an atomic update of the memory word, as it is
used by spin_unlock().

Ticket locks are using a read-modify-write operation on parts of the
lockword for unlocking, while trying to lock is done by an atomic
update of the complete lockword. This requires the unlock operation to
be atomic, too, as otherwise the unlock might not write back the
correct data.

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
 xen/include/asm-x86/atomic.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/include/asm-x86/atomic.h b/xen/include/asm-x86/atomic.h
index 682bcf91b1..897f661191 100644
--- a/xen/include/asm-x86/atomic.h
+++ b/xen/include/asm-x86/atomic.h
@@ -21,7 +21,7 @@ static inline void name(volatile type *addr, type val) \
 #define build_add_sized(name, size, type, reg) \
     static inline void name(volatile type *addr, type val)              \
     {                                                                   \
-        asm volatile("add" size " %1,%0"                                \
+        asm volatile("lock add" size " %1,%0"                           \
                      : "=m" (*addr)                                     \
                      : reg (val));                                      \
     }
-- 
2.16.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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