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

Ankur Arora ankur.a.arora at oracle.com
Wed Feb 11 15:13:14 PST 2026


Catalin Marinas <catalin.marinas at arm.com> writes:

> On Sun, Feb 08, 2026 at 06:31:45PM -0800, Ankur Arora wrote:
>> 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/

Oh that looks painful. Thanks for linking it.

> 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).

Yeah will follow where that goes.

> The rest looks fine.

Great. Thanks!

--
ankur



More information about the linux-arm-kernel mailing list