Skip to contentSkip to conversation

libibverbs memory barrier fixes

PATCH Applied root 3 participants 5 messages Jun 7, 2016 – Jun 23, 2016 1 message not in the archive InfiniBand

lore
Share & tools
lore

root

author
#0 lore raw

v3 cover libibverbs memory barrier fixes

This series implements ARM64 memory barrier support, and fails compiles if there is no platform implementation of the memory barriers.

Changes since V3:

white noise fix

parens around asm macros (checkpatch recommendation)

remove RFC tag

Changes since V2:

Implement the mb* macros from scratch

Retested changes on ARM64

Steve Wise (2):
libibverbs: add ARM64 memory barrier macros
Fail compiles if no platform specific memory barriers exist

 include/infiniband/arch.h |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): cover.1465310573.git.root-6HSsQxwzXLRrcEM49+0neVaTQe2KTcn/@public.gmane.org

#2 lore raw

PATCH 1/2 libibverbs: add ARM64 memory barrier macros

The default generic barriers are not correct for ARM64. This results in data corruption. The correct macros are based on the ARM Compiler Toolchain Assembler Reference documenation.

---
 include/infiniband/arch.h |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
include/infiniband/arch.h +8 -0
index bc1738a..c31dd0a 100644
@@ -122,6 +122,14 @@ static inline uint64_t ntohll(uint64_t x) { return x; }
 #define wmb()	mb()					/* for s390x */
 #define wc_wmb() wmb()					/* for s390x */
 
+#elif defined(__aarch64__)
+
+/* Perhaps dmb would be sufficient? Let us be conservative for now. */
+#define mb()	{ asm volatile("dsb sy" ::: "memory"); }
+#define rmb()	{ asm volatile("dsb ld" ::: "memory"); }
+#define wmb()	{ asm volatile("dsb st" ::: "memory"); }
+#define wc_wmb() wmb()
+
 #else
 
 #warning No architecture specific defines found.  Using generic implementation.
Signature · 6 lines
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw

PATCH 2/2 Fail compiles if no platform specific memory barriers exist

In reply to a message not in the archive

Currently there is a "generic" implementation for the memory barrier macros in arch.h. These turned out to be insuffient for ARM64 causing memory corruption problems when doing RDMA operations. So going forward, fail a compile on a platform w/o platform-specific memory barrier macros.

---
 include/infiniband/arch.h |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)
include/infiniband/arch.h +1 -6
index c31dd0a..e35ecf0 100644
@@ -132,12 +132,7 @@ static inline uint64_t ntohll(uint64_t x) { return x; }
 
 #else
 
-#warning No architecture specific defines found.  Using generic implementation.
-
-#define mb()	 asm volatile("" ::: "memory")
-#define rmb()	 mb()
-#define wmb()	 mb()
-#define wc_wmb() wmb()
+#error No architecture specific memory barrier defines found!
 
 #endif
 
Signature · 6 lines
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw
In reply to a message not in the archive

hmm, [email protected] oops. :)

Quoted 29 lines

-----Original Message-----
From: [email protected] [mailto:linux-rdma- [email protected]] On Behalf Of root
Sent: Tuesday, June 07, 2016 9:43 AM
To: [email protected]
Cc: [email protected]
Subject: [PATCH v3 0/2] libibverbs memory barrier fixes

This series implements ARM64 memory barrier support, and fails compiles if there is no platform implementation of the memory barriers.

Changes since V3:

white noise fix

parens around asm macros (checkpatch recommendation)

remove RFC tag

Changes since V2:

Implement the mb* macros from scratch

Retested changes on ARM64

Steve Wise (2):
libibverbs: add ARM64 memory barrier macros
Fail compiles if no platform specific memory barriers exist

Quoted 7 lines
 include/infiniband/arch.h |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Applied
#5 lore raw
In reply to a message not in the archive
Quoted 15 lines · Steve Wise

This series implements ARM64 memory barrier support, and fails compiles if there is no platform implementation of the memory barriers.

Changes since V3:

white noise fix

parens around asm macros (checkpatch recommendation)

remove RFC tag

Changes since V2:

Implement the mb* macros from scratch

Quoted 9 lines

Retested changes on ARM64

Steve Wise (2):
libibverbs: add ARM64 memory barrier macros
Fail compiles if no platform specific memory barriers exist

 include/infiniband/arch.h |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

Thanks, applied.

Signature · 2 lines
Doug Ledford <[email protected]>
              GPG KeyID: 0E572FDD