samples/bpf: xdpsock: order memory on AArch64
authorBrian Brooks <brian.brooks@linaro.org>
Wed, 25 Jul 2018 21:08:19 +0000 (16:08 -0500)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 27 Jul 2018 01:49:02 +0000 (03:49 +0200)
Define u_smp_rmb() and u_smp_wmb() to respective barrier instructions.
This ensures the processor will order accesses to queue indices against
accesses to queue ring entries.

Signed-off-by: Brian Brooks <brian.brooks@linaro.org>
Acked-by: Björn Töpel <bjorn.topel@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
samples/bpf/xdpsock_user.c

index 5904b15..1e82f7c 100644 (file)
@@ -145,8 +145,13 @@ static void dump_stats(void);
        } while (0)
 
 #define barrier() __asm__ __volatile__("": : :"memory")
+#ifdef __aarch64__
+#define u_smp_rmb() __asm__ __volatile__("dmb ishld": : :"memory")
+#define u_smp_wmb() __asm__ __volatile__("dmb ishst": : :"memory")
+#else
 #define u_smp_rmb() barrier()
 #define u_smp_wmb() barrier()
+#endif
 #define likely(x) __builtin_expect(!!(x), 1)
 #define unlikely(x) __builtin_expect(!!(x), 0)