[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] 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(). With ticket locks unlocking needs to be atomic in order to avoid very rare races when someone tries to get the lock while the lock holder is just releasing it. 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..0ef6a60e69 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
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |