libibverbs: add ARM64 memory barrier macros
PATCH 1/1 libibverbs: add ARM64 memory barrier macros
The default generic barriers are not correct for ARM64. This results in data corruption. The correct macros are lifted from the linux kernel.
---
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(-)
include/infiniband/arch.h +9 -0
@@ -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.
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
Quoted 1 line
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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 4 lines
Quoted 1 line
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
Quoted 1 line
since they come from the Linux kernel.
I guess so.
Quoted 1 line
I know that there are a lot of people that will not use a GPL library, since
it could
Quoted 2 lines
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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 10 lines
Quoted 1 line
Does this mean that the code you want to add to libibverbs will be tainted
with GPL
Quoted 1 line
since they come from the Linux kernel.
I guess so.
Quoted 1 line
I know that there are a lot of people that will not use a GPL library, since
it could
Quoted 2 lines
taint their applications with GPL if they
link to that library. I thought that is why LGPL was invented to prevent
such
Quoted 5 lines
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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 17 lines · Steve Wise
Quoted 10 lines
Quoted 1 line
Does this mean that the code you want to add to libibverbs will be tainted
with GPL
Quoted 1 line
since they come from the Linux kernel.
I guess so.
Quoted 1 line
I know that there are a lot of people that will not use a GPL library, since
it could
Quoted 2 lines
taint their applications with GPL if they
link to that library. I thought that is why LGPL was invented to preventsuch
Quoted 5 lines
tainting.
I could utilize the code from FreeBSD. Does that allow me to submit this to libibverbs under the dual GPL/BSD license?
Quoted 5 lines
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.
Signature · 2 lines
Doug Ledford <[email protected]> GPG KeyID: 0E572FDD
Quoted 1 line
Quoted 1 line
Quoted 1 line
I could utilize the code from FreeBSD. Does that allow me to submit this
to
Quoted 9 lines
Quoted 8 lines
Quoted 2 lines
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?
Quoted 9 lines
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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html