]> git.baikalelectronics.ru Git - kernel.git/commit
tools: add smp_* barrier variants to include infrastructure
authorDaniel Borkmann <daniel@iogearbox.net>
Tue, 9 Apr 2019 09:44:46 +0000 (11:44 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 11 Apr 2019 21:45:50 +0000 (14:45 -0700)
commit83d0fee04704fe5059c16ea5bcb5394c3fa86f53
tree460753960398fedf6a942e734c59e5b07d0c00f7
parent39fbb64cc80d7f3ea18ef654024cff721c6e1f60
tools: add smp_* barrier variants to include infrastructure

Add the definition for smp_rmb(), smp_wmb(), and smp_mb() to the
tools include infrastructure: this patch adds the implementation
for x86-64 and arm64, and have it fall back as currently is for
other archs which do not have it implemented at this point. The
x86-64 one uses lock + add combination for smp_mb() with address
below red zone.

This is on top of 290d600f6595 ("tools, perf: add and use optimized
ring_buffer_{read_head, write_tail} helpers"), which didn't touch
smp_* barrier implementations. Magnus recently rightfully reported
however that the latter on x86-64 still wrongly falls back to sfence,
lfence and mfence respectively, thus fix that for applications under
tools making use of these to avoid such ugly surprises. The main
header under tools (include/asm/barrier.h) will in that case not
select the fallback implementation.

Reported-by: Magnus Karlsson <magnus.karlsson@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/arch/arm64/include/asm/barrier.h
tools/arch/x86/include/asm/barrier.h