All of lore.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

* RE: [PATCH] libibverbs: add ARM64 memory barrier macros
       [not found] ` <20160520163207.B99DCE0B9D-/5N3P9jjx0xzbRFIqnYvSA@public.gmane.org>
@ 2016-05-20 16:39   ` Woodruff, Robert J
       [not found]     ` <9C6B67F36DCAFC479B1CF6A967258A8C7DDBB201-8oqHQFITsIFqS6EAlXoojrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Woodruff, Robert J @ 2016-05-20 16:39 UTC (permalink / raw)
  To: Steve Wise, 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.

Does this mean that the code you want to add to libibverbs will be tainted with GPL since they come from the Linux kernel.
I know that there are a lot of people that will not use a GPL library, since it could taint their applications with GPL if they 
link to that library. I thought that is why LGPL was invented to prevent such tainting. 
--
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] 6+ messages in thread

* RE: [PATCH] libibverbs: add ARM64 memory barrier macros
       [not found]     ` <9C6B67F36DCAFC479B1CF6A967258A8C7DDBB201-8oqHQFITsIFqS6EAlXoojrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2016-05-20 18:37       ` Steve Wise
  2016-05-20 18:46         ` Steve Wise
  0 siblings, 1 reply; 6+ messages in thread
From: Steve Wise @ 2016-05-20 18:37 UTC (permalink / raw)
  To: 'Woodruff, Robert J', 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.
> 
> Does this mean that the code you want to add to libibverbs will be tainted
with GPL
> since they come from the Linux kernel.

I guess so.

> I know that there are a lot of people that will not use a GPL library, since
it could
> taint their applications with GPL if they
> link to that library. I thought that is why LGPL was invented to prevent such
tainting.

I could utilize the code from FreeBSD.  Does that allow me to submit this to
libibverbs under the dual GPL/BSD license?

/*
 * Options for DMB and DSB:
 *      oshld   Outer Shareable, load
 *      oshst   Outer Shareable, store
 *      osh     Outer Shareable, all
 *      nshld   Non-shareable, load
 *      nshst   Non-shareable, store
 *      nsh     Non-shareable, all
 *      ishld   Inner Shareable, load
 *      ishst   Inner Shareable, store
 *      ish     Inner Shareable, all
 *      ld      Full system, load
 *      st      Full system, store
 *      sy      Full system, all
 */
#define dsb(opt)        __asm __volatile("dsb " __STRING(opt) : : : "memory")
#define dmb(opt)        __asm __volatile("dmb " __STRING(opt) : : : "memory")

#define mb()    dmb(sy) /* Full system memory barrier all */
#define wmb()   dmb(st) /* Full system memory barrier store */
#define rmb()   dmb(ld) /* Full system memory barrier load */



--
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] 6+ messages in thread

* RE: [PATCH] libibverbs: add ARM64 memory barrier macros
  2016-05-20 18:37       ` Steve Wise
@ 2016-05-20 18:46         ` Steve Wise
  2016-05-20 20:17           ` Doug Ledford
  0 siblings, 1 reply; 6+ messages in thread
From: Steve Wise @ 2016-05-20 18:46 UTC (permalink / raw)
  To: 'Woodruff, Robert J', dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

> > Does this mean that the code you want to add to libibverbs will be tainted
> with GPL
> > since they come from the Linux kernel.
> 
> I guess so.
> 
> > I know that there are a lot of people that will not use a GPL library, since
> it could
> > taint their applications with GPL if they
> > link to that library. I thought that is why LGPL was invented to prevent
such
> tainting.
> 
> I could utilize the code from FreeBSD.  Does that allow me to submit this to
> libibverbs under the dual GPL/BSD license?
> 

I think I can just re-implement these services myself based published works
describing the memory barrier assembly for ARM (like the document Jason
referenced earlier).  That will avoid any tainting.

Doug: Will that work?





--
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] 6+ messages in thread

* Re: [PATCH] libibverbs: add ARM64 memory barrier macros
  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>
  0 siblings, 1 reply; 6+ messages in thread
From: Doug Ledford @ 2016-05-20 20:17 UTC (permalink / raw)
  To: Steve Wise, 'Woodruff Robert J'; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

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

On 05/20/2016 02:46 PM, Steve Wise wrote:
>>> Does this mean that the code you want to add to libibverbs will be tainted
>> with GPL
>>> since they come from the Linux kernel.
>>
>> I guess so.
>>
>>> I know that there are a lot of people that will not use a GPL library, since
>> it could
>>> taint their applications with GPL if they
>>> link to that library. I thought that is why LGPL was invented to prevent
> such
>> tainting.
>>
>> I could utilize the code from FreeBSD.  Does that allow me to submit this to
>> libibverbs under the dual GPL/BSD license?
>>
> 
> I think I can just re-implement these services myself based published works
> describing the memory barrier assembly for ARM (like the document Jason
> referenced earlier).  That will avoid any tainting.
> 
> Doug: Will that work?

Either way works actually.  IANAL, but I've been told this multiple
times and will relay my possibly flawed memory of the legal issue.  The
original patch, even though lifted from the linux kernel, is likely to
fall under the scope of "operationally defined" code.  In other words,
the specific patch you wrote and the thing it implemented is so rigidly
defined by what it does, that there really is little to no room for any
different expression of the code.  When there is no room for different
expressions, the code is not copyrightable.


-- 
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] 6+ messages in thread

* RE: [PATCH] libibverbs: add ARM64 memory barrier macros
       [not found]             ` <2dc25c9c-748c-098c-f7a1-5d6e59504308-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2016-05-20 20:20               ` Steve Wise
  0 siblings, 0 replies; 6+ messages in thread
From: Steve Wise @ 2016-05-20 20:20 UTC (permalink / raw)
  To: 'Doug Ledford', 'Woodruff Robert J'
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

> >> I could utilize the code from FreeBSD.  Does that allow me to submit this
to
> >> libibverbs under the dual GPL/BSD license?
> >>
> >
> > I think I can just re-implement these services myself based published works
> > describing the memory barrier assembly for ARM (like the document Jason
> > referenced earlier).  That will avoid any tainting.
> >
> > Doug: Will that work?
> 
> Either way works actually.  IANAL, but I've been told this multiple
> times and will relay my possibly flawed memory of the legal issue.  The
> original patch, even though lifted from the linux kernel, is likely to
> fall under the scope of "operationally defined" code.  In other words,
> the specific patch you wrote and the thing it implemented is so rigidly
> defined by what it does, that there really is little to no room for any
> different expression of the code.  When there is no room for different
> expressions, the code is not copyrightable.
> 

That makes too much sense... ;)


--
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] 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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.