Thread (14 messages) 14 messages, 2 authors, 2d ago

Re: [PATCH v3 06/11] selftests: Fix arm64 IO barriers to match kernel

From: Jason Gunthorpe <jgg@nvidia.com>
Date: 2026-07-17 00:36:24
Also in: kvm, linux-kselftest, linux-patches, linux-rdma, llvm

On Thu, Jul 16, 2026 at 04:22:10PM -0700, Nathan Chancellor wrote:
On Thu, Jul 16, 2026 at 02:03:22PM -0300, Jason Gunthorpe wrote:
quoted
The tools/include readl/writel MMIO accessors on arm64 use
inner-shareable barriers (dmb ish) while the kernel uses
outer-shareable (dmb osh).  Fix them to match.

Add __io_bw() and __io_ar() definitions matching the kernel's
arch/arm64/include/asm/io.h, including the dummy control dependency
in __io_ar() that orders MMIO reads against all subsequent
instructions.

Assisted-by: Claude:claude-opus-4.6
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
...
quoted
diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index f02cc8a2e4ae32..fdd22df9174b88 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -5,9 +5,14 @@ ifneq ($(filter %/,$(LLVM)),)
 LLVM_PREFIX := $(LLVM)
 else ifneq ($(filter -%,$(LLVM)),)
 LLVM_SUFFIX := $(LLVM)
+else ifneq ($(LLVM),1)
+$(error Invalid value for LLVM, see Documentation/kbuild/llvm.rst)
 endif
 
 CLANG := $(LLVM_PREFIX)clang$(LLVM_SUFFIX)
+LD := $(LLVM_PREFIX)ld.lld$(LLVM_SUFFIX)
+# Selftests link through $(CC), so point clang at the LLVM linker.
+LDFLAGS += --ld-path=$(LD)
 
 CLANG_TARGET_FLAGS_arm          := arm-linux-gnueabi
 CLANG_TARGET_FLAGS_arm64        := aarch64-linux-gnu
Was this hunk intended to be included in this change? It is not
mentioned anywhere. I assume this is the only reason that the LLVM folks
were CC'd on this series.
Er no, I can no longer remember what that was about, it wasn't in
v2. Actually I also see I forgot to delete this patch as Will
suggested in the first place.

Jason
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help