Thread (33 messages) 33 messages, 6 authors, 2026-02-18

Re: [PATCH v9 04/12] arm64: support WFET in smp_cond_load_relaxed_timeout()

From: Catalin Marinas <catalin.marinas@arm.com>
Date: 2026-02-11 17:11:30
Also in: bpf, linux-arch, linux-pm, lkml

On Sun, Feb 08, 2026 at 06:31:45PM -0800, Ankur Arora wrote:
quoted hunk ↗ jump to hunk
diff --git a/arch/arm64/include/asm/cmpxchg.h b/arch/arm64/include/asm/cmpxchg.h
index d7a540736741..dfb7d10a18be 100644
--- a/arch/arm64/include/asm/cmpxchg.h
+++ b/arch/arm64/include/asm/cmpxchg.h
@@ -12,6 +12,7 @@
 
 #include <asm/barrier.h>
 #include <asm/lse.h>
+#include <asm/delay-const.h>
 
 /*
  * We need separate acquire parameters for ll/sc and lse, since the full
@@ -208,9 +209,13 @@ __CMPXCHG_GEN(_mb)
 	__cmpxchg128((ptr), (o), (n));						\
 })
 
+/* Re-declared here to avoid include dependency. */
+extern u64 (*arch_timer_read_counter)(void);
We have a bug in udelay() because the above might read the physical
counter while WFET uses the virtual one. See this thread:

https://lore.kernel.org/all/ktosachvft2cgqd5qkukn275ugmhy6xrhxur4zqpdxlfr3qh5h@o3zrfnsq63od/ (local)

We could use __arch_counter_get_cntvct_stable() as in Marc's suggestion
for the udelay() fix (or just wait to see the outcome of the above
thread).

The rest looks fine.

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