public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] libibverbs: add ARM64 memory barrier macros
       [not found] ` <cover.1465310573.git.root-6HSsQxwzXLRrcEM49+0neVaTQe2KTcn/@public.gmane.org>
@ 2016-06-07 14:42   ` Steve Wise
  2016-06-07 14:42   ` [PATCH 2/2] Fail compiles if no platform specific memory barriers exist Steve Wise
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Steve Wise @ 2016-06-07 14:42 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 based on the ARM Compiler
Toolchain Assembler Reference documenation.

Signed-off-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
---
 include/infiniband/arch.h |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/include/infiniband/arch.h b/include/infiniband/arch.h
index bc1738a..c31dd0a 100644
--- a/include/infiniband/arch.h
+++ b/include/infiniband/arch.h
@@ -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.
-- 
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] 5+ messages in thread

* [PATCH 2/2] Fail compiles if no platform specific memory barriers exist
       [not found] ` <cover.1465310573.git.root-6HSsQxwzXLRrcEM49+0neVaTQe2KTcn/@public.gmane.org>
  2016-06-07 14:42   ` [PATCH 1/2] libibverbs: add ARM64 memory barrier macros Steve Wise
@ 2016-06-07 14:42   ` Steve Wise
  2016-06-07 16:04   ` [PATCH v3 0/2] libibverbs memory barrier fixes Steve Wise
  2016-06-23 14:53   ` [PATCH REPOST " Doug Ledford
  3 siblings, 0 replies; 5+ messages in thread
From: Steve Wise @ 2016-06-07 14:42 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

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.

Signed-off-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
---
 include/infiniband/arch.h |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/include/infiniband/arch.h b/include/infiniband/arch.h
index c31dd0a..e35ecf0 100644
--- a/include/infiniband/arch.h
+++ b/include/infiniband/arch.h
@@ -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
 
-- 
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] 5+ messages in thread

* [PATCH v3 0/2] libibverbs memory barrier fixes
@ 2016-06-07 14:42 root
       [not found] ` <cover.1465310573.git.root-6HSsQxwzXLRrcEM49+0neVaTQe2KTcn/@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: root @ 2016-06-07 14:42 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* RE: [PATCH v3 0/2] libibverbs memory barrier fixes
       [not found] ` <cover.1465310573.git.root-6HSsQxwzXLRrcEM49+0neVaTQe2KTcn/@public.gmane.org>
  2016-06-07 14:42   ` [PATCH 1/2] libibverbs: add ARM64 memory barrier macros Steve Wise
  2016-06-07 14:42   ` [PATCH 2/2] Fail compiles if no platform specific memory barriers exist Steve Wise
@ 2016-06-07 16:04   ` Steve Wise
  2016-06-23 14:53   ` [PATCH REPOST " Doug Ledford
  3 siblings, 0 replies; 5+ messages in thread
From: Steve Wise @ 2016-06-07 16:04 UTC (permalink / raw)
  To: 'root', dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

hmm, root-6HSsQxwzXLRrcEM49+0nea2raWmgRF17@public.gmane.org oops. :)



> -----Original Message-----
> From: linux-rdma-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org [mailto:linux-rdma-
> owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org] On Behalf Of root
> Sent: Tuesday, June 07, 2016 9:43 AM
> To: dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
> Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> 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
> 
>  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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> 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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH REPOST v3 0/2] libibverbs memory barrier fixes
       [not found] ` <cover.1465310573.git.root-6HSsQxwzXLRrcEM49+0neVaTQe2KTcn/@public.gmane.org>
                     ` (2 preceding siblings ...)
  2016-06-07 16:04   ` [PATCH v3 0/2] libibverbs memory barrier fixes Steve Wise
@ 2016-06-23 14:53   ` Doug Ledford
  3 siblings, 0 replies; 5+ messages in thread
From: Doug Ledford @ 2016-06-23 14:53 UTC (permalink / raw)
  To: Steve Wise; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 799 bytes --]

On 06/07/2016 10:42 AM, Steve Wise wrote:
> 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(-)
> 

Thanks, applied.

-- 
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
              GPG KeyID: 0E572FDD



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]

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

end of thread, other threads:[~2016-06-23 14:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-07 14:42 [PATCH v3 0/2] libibverbs memory barrier fixes root
     [not found] ` <cover.1465310573.git.root-6HSsQxwzXLRrcEM49+0neVaTQe2KTcn/@public.gmane.org>
2016-06-07 14:42   ` [PATCH 1/2] libibverbs: add ARM64 memory barrier macros Steve Wise
2016-06-07 14:42   ` [PATCH 2/2] Fail compiles if no platform specific memory barriers exist Steve Wise
2016-06-07 16:04   ` [PATCH v3 0/2] libibverbs memory barrier fixes Steve Wise
2016-06-23 14:53   ` [PATCH REPOST " Doug Ledford

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