Linux-Block Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] Add arm64 memory barriers support
@ 2019-08-09  2:40 Jackie Liu
  2019-08-09  3:37 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Jackie Liu @ 2019-08-09  2:40 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, Jackie Liu

making liburing on arm64 platform failed. let's support it.

root@Kylin:/# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux buster/sid"

root@Kylin:/# gcc -v
gcc version 8.2.0 (Debian 8.2.0-20)

root@Kylin:~/liburing# make
make[1]: Entering directory '/root/liburing/src'
cc -g -fomit-frame-pointer -O2 -Wall -Iinclude/ -c -o setup.ol setup.c
In file included from include/liburing.h:14,
                 from setup.c:10:
include/liburing.h: In function 'io_uring_cq_advance':
include/liburing/barrier.h:73:2: warning: implicit declaration of function 'smp_mb'; did you mean 'smp_wmb'? [-Wimplicit-function-declaration]
  smp_mb();    \
  ^~~~~~
include/liburing.h:111:3: note: in expansion of macro 'smp_store_release'
   smp_store_release(cq->khead, *cq->khead + nr);
   ^~~~~~~~~~~~~~~~~

Signed-off-by: Jackie Liu <liuyun01@kylinos.cn>
---
 src/include/liburing/barrier.h | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/include/liburing/barrier.h b/src/include/liburing/barrier.h
index 98be9e5..b98193b 100644
--- a/src/include/liburing/barrier.h
+++ b/src/include/liburing/barrier.h
@@ -56,7 +56,20 @@ do {						\
 	barrier();				\
 	___p1;					\
 })
-#else /* defined(__x86_64__) || defined(__i386__) */
+
+#elif defined(__aarch64__)
+/* Adapted from arch/arm64/include/asm/barrier.h */
+#define dmb(opt)	asm volatile("dmb " #opt : : : "memory")
+#define dsb(opt)	asm volatile("dsb " #opt : : : "memory")
+
+#define mb()		dsb(sy)
+#define rmb()		dsb(ld)
+#define wmb()		dsb(st)
+#define smp_mb()	dmb(ish)
+#define smp_rmb()	dmb(ishld)
+#define smp_wmb()	dmb(ishst)
+
+#else /* defined(__x86_64__) || defined(__i386__) || defined(__aarch64__) */
 /*
  * Add arch appropriate definitions. Be safe and use full barriers for
  * archs we don't have support for.
-- 
2.7.4




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

* Re: [PATCH] Add arm64 memory barriers support
  2019-08-09  2:40 [PATCH] Add arm64 memory barriers support Jackie Liu
@ 2019-08-09  3:37 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2019-08-09  3:37 UTC (permalink / raw)
  To: Jackie Liu; +Cc: linux-block

On 8/8/19 7:40 PM, Jackie Liu wrote:
> making liburing on arm64 platform failed. let's support it.
> 
> root@Kylin:/# cat /etc/os-release
> PRETTY_NAME="Debian GNU/Linux buster/sid"
> 
> root@Kylin:/# gcc -v
> gcc version 8.2.0 (Debian 8.2.0-20)
> 
> root@Kylin:~/liburing# make
> make[1]: Entering directory '/root/liburing/src'
> cc -g -fomit-frame-pointer -O2 -Wall -Iinclude/ -c -o setup.ol setup.c
> In file included from include/liburing.h:14,
>                   from setup.c:10:
> include/liburing.h: In function 'io_uring_cq_advance':
> include/liburing/barrier.h:73:2: warning: implicit declaration of function 'smp_mb'; did you mean 'smp_wmb'? [-Wimplicit-function-declaration]
>    smp_mb();    \
>    ^~~~~~
> include/liburing.h:111:3: note: in expansion of macro 'smp_store_release'
>     smp_store_release(cq->khead, *cq->khead + nr);
>     ^~~~~~~~~~~~~~~~~

Applied, thanks.

-- 
Jens Axboe


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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-09  2:40 [PATCH] Add arm64 memory barriers support Jackie Liu
2019-08-09  3:37 ` Jens Axboe

Linux-Block Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-block/0 linux-block/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-block linux-block/ https://lore.kernel.org/linux-block \
		linux-block@vger.kernel.org linux-block@archiver.kernel.org
	public-inbox-index linux-block


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-block


AGPL code for this site: git clone https://public-inbox.org/ public-inbox