From e8ccc71e839be1e0b14b8fd283447e8dca62888b Mon Sep 17 00:00:00 2001 From: Darek Stojaczyk Date: Mon, 11 Feb 2019 09:25:21 +0100 Subject: [PATCH] barrier/x86: use lock+add for smp_mb() instead of mfence This follows smp_mb() implementation in the latest DPDK. Change-Id: I39f9259a0208579034e5ff39961a2c4b8b72975c Signed-off-by: Darek Stojaczyk Reviewed-on: https://review.gerrithub.io/c/444041 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- include/spdk/barrier.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/spdk/barrier.h b/include/spdk/barrier.h index cd670abf29..20a4cacd59 100644 --- a/include/spdk/barrier.h +++ b/include/spdk/barrier.h @@ -113,8 +113,10 @@ extern "C" { #define spdk_smp_mb() spdk_mb() #elif defined(__aarch64__) #define spdk_smp_mb() __asm volatile("dmb ish" ::: "memory") -#elif defined(__i386__) || defined(__x86_64__) -#define spdk_smp_mb() spdk_mb() +#elif defined(__x86_64__) +#define spdk_smp_mb() __asm volatile("lock addl $0, -128(%%rsp); " ::: "memory"); +#elif defined(__i386__) +#define spdk_smp_mb() __asm volatile("lock addl $0, -128(%%esp); " ::: "memory"); #else #define spdk_smp_mb() #error Unknown architecture