public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libibverbs: add ARM64 memory barrier macros
@ 2016-05-18 21:16 Steve Wise
       [not found] ` <20160520163207.B99DCE0B9D-/5N3P9jjx0xzbRFIqnYvSA@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Steve Wise @ 2016-05-18 21:16 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

The default generic barriers are not correct for ARM64. This results in
data corruption.  The correct macros are lifted from the linux kernel.

Signed-off-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
---

Changes since RFC:

no change to the patch - just productive discussion about these barrier
implementations.  I propose we proceed to add this patch since it resolves
a data corruption bug.
---
 include/infiniband/arch.h |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/include/infiniband/arch.h b/include/infiniband/arch.h
index bc1738a..71f02f8 100644
--- a/include/infiniband/arch.h
+++ b/include/infiniband/arch.h
@@ -122,6 +122,15 @@ static inline uint64_t ntohll(uint64_t x) { return x; }
 #define wmb()	mb()					/* for s390x */
 #define wc_wmb() wmb()					/* for s390x */
 
+#elif defined(__aarch64__)
+
+#define dsb(opt)	asm volatile("dsb " #opt : : : "memory")
+
+#define mb()	dsb(sy)
+#define rmb()	dsb(ld)
+#define wmb()	dsb(st)
+#define wc_wmb() wmb()
+
 #else
 
 #warning No architecture specific defines found.  Using generic implementation.
-- 
1.7.1

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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-05-20 20:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-18 21:16 [PATCH] libibverbs: add ARM64 memory barrier macros Steve Wise
     [not found] ` <20160520163207.B99DCE0B9D-/5N3P9jjx0xzbRFIqnYvSA@public.gmane.org>
2016-05-20 16:39   ` Woodruff, Robert J
     [not found]     ` <9C6B67F36DCAFC479B1CF6A967258A8C7DDBB201-8oqHQFITsIFqS6EAlXoojrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2016-05-20 18:37       ` Steve Wise
2016-05-20 18:46         ` Steve Wise
2016-05-20 20:17           ` Doug Ledford
     [not found]             ` <2dc25c9c-748c-098c-f7a1-5d6e59504308-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-20 20:20               ` Steve Wise

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox