[CRIU][PATCH 2/3] s390/zdtm: Also support z900 (debian)

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

 



Debian is compiled for z900 - therefore we can't use the "laa"
instruction.

Fix this and replace "laa" by the older "cs" (compare and swap) loop.

Signed-off-by: Michael Holzheu <holzheu@xxxxxxxxxxxxxxxxxx>
---
 test/zdtm/lib/arch/s390/include/asm/atomic.h | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/test/zdtm/lib/arch/s390/include/asm/atomic.h b/test/zdtm/lib/arch/s390/include/asm/atomic.h
index 9cf7236..b7c4b2c 100644
--- a/test/zdtm/lib/arch/s390/include/asm/atomic.h
+++ b/test/zdtm/lib/arch/s390/include/asm/atomic.h
@@ -5,24 +5,26 @@
 
 typedef uint32_t atomic_t;
 
-#define __ATOMIC_OP(op_name, op_type, op_string, op_barrier)		\
+#define __ATOMIC_OP(op_name, op_type, op_string)			\
 static inline op_type op_name(op_type val, op_type *ptr)		\
 {									\
-	op_type old;							\
+	op_type old, new;						\
 									\
 	asm volatile(							\
-		op_string "	%[old],%[val],%[ptr]\n"			\
-		op_barrier						\
-		: [old] "=d" (old), [ptr] "+Q" (*ptr)			\
-		: [val] "d" (val) : "cc", "memory");			\
+		"0:	lr	%[new],%[old]\n"			\
+		op_string "	%[new],%[val]\n"			\
+		"	cs	%[old],%[new],%[ptr]\n"			\
+		"	jl	0b"					\
+		: [old] "=d" (old), [new] "=&d" (new), [ptr] "+Q" (*ptr)\
+		: [val] "d" (val), "0" (*ptr) : "cc", "memory");	\
 	return old;							\
-}									\
+}
 
 #define __ATOMIC_OPS(op_name, op_type, op_string)			\
-	__ATOMIC_OP(op_name, op_type, op_string, "\n")			\
-	__ATOMIC_OP(op_name##_barrier, op_type, op_string, "bcr 14,0\n")
+	__ATOMIC_OP(op_name, op_type, op_string)			\
+	__ATOMIC_OP(op_name##_barrier, op_type, op_string)
 
-__ATOMIC_OPS(__atomic_add, uint32_t, "laa")
+__ATOMIC_OPS(__atomic_add, uint32_t, "ar")
 
 #undef __ATOMIC_OPS
 #undef __ATOMIC_OP
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-s390" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux