From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B212C35E936 for ; Thu, 23 Apr 2026 17:17:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776964646; cv=none; b=Ld62R9ijdywsitTfuzdFGlOAm+G+eNaXI0VdtDcNYpUxZG6RSJZXndZBi3idK3Oubk4fJxXeu6NNEj2jYIdsN9O+9yEEyleVQdT6xB5dtchbpXpEcf2G1MvoV9806FA2b9CAnvvNqyPlBuOr8LFyvCjTo2QLVc1aDu7yg05spHA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776964646; c=relaxed/simple; bh=mX3V3sjoF4F91q3ASPoXKIKkObGxwJ+y9a+6E68w9xA=; h=Date:To:From:Subject:Message-Id; b=VQ7HHqb3otW4nasC85AqErabPa/AcAUbgY/W7H5OXNJK0Zhb+rtVeW2FjabIqLiLcw7L3Jzvtb+sSdhU0p6NrL8eILeTSW7DqzdKF5ZlisAlji4EUiCaRta/54oZgbP/raPE1W5tIJUbrD2WyOEyAVKN551PVKO21CnmvEHg+/M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=x4FtX4yz; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="x4FtX4yz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5542BC2BCAF; Thu, 23 Apr 2026 17:17:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1776964646; bh=mX3V3sjoF4F91q3ASPoXKIKkObGxwJ+y9a+6E68w9xA=; h=Date:To:From:Subject:From; b=x4FtX4yzDA8uVU1jljGNy7PBPVZpH0XxWpzMyBAuqc0yk5PV2OvlYFHcxSXF/NCD1 oBkxIzKMcSf0Buf4JHjIj0YEMbSXkGzC1QmVcFynhxevyJYSA+UlCV/Coz0+KipGRG IZJfGH3RW180bGoNt8/dzwzVPtAAqADj2hUgkX10= Date: Thu, 23 Apr 2026 10:17:25 -0700 To: mm-commits@vger.kernel.org,will@kernel.org,rafael@kernel.org,peterz@infradead.org,mingo@kernel.org,memxor@gmail.com,mark.rutland@arm.com,konradybcio@kernel.org,harisokn@amazon.com,gary@garyguo.net,davidgow@google.com,daniel.lezcano@linaro.org,cl@linux.com,catalin.marinas@arm.com,boqun@kernel.org,boqun.feng@gmail.com,ast@kernel.org,arnd@arndb.de,andersson@kernel.org,ankur.a.arora@oracle.com,akpm@linux-foundation.org From: Andrew Morton Subject: + arm64-rqspinlock-remove-private-copy-of-smp_cond_load_acquire_timewait.patch added to mm-new branch Message-Id: <20260423171726.5542BC2BCAF@smtp.kernel.org> Precedence: bulk X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: The patch titled Subject: arm64: rqspinlock: remove private copy of smp_cond_load_acquire_timewait() has been added to the -mm mm-new branch. Its filename is arm64-rqspinlock-remove-private-copy-of-smp_cond_load_acquire_timewait.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/arm64-rqspinlock-remove-private-copy-of-smp_cond_load_acquire_timewait.patch This patch will later appear in the mm-new branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new. The mm-new branch of mm.git is not included in linux-next If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there most days ------------------------------------------------------ From: Ankur Arora Subject: arm64: rqspinlock: remove private copy of smp_cond_load_acquire_timewait() Date: Wed, 8 Apr 2026 17:55:29 +0530 In preparation for defining smp_cond_load_acquire_timeout(), remove the private copy. Lacking this, the rqspinlock code falls back to using smp_cond_load_acquire(). Link: https://lore.kernel.org/20260408122538.3610871-6-ankur.a.arora@oracle.com Signed-off-by: Ankur Arora Reviewed-by: Catalin Marinas Reviewed-by: Haris Okanovic Acked-by: Kumar Kartikeya Dwivedi Cc: Kumar Kartikeya Dwivedi Cc: Alexei Starovoitov Cc: Arnd Bergmann Cc: Bjorn Andersson Cc: Boqun Feng Cc: Boqun Feng Cc: Christoph Lameter Cc: Daniel Lezcano Cc: David Gow Cc: Gary Guo Cc: Ingo Molnar Cc: Konrad Dybcio Cc: Mark Rutland Cc: Peter Zijlstra Cc: Rafael J. Wysocki (Intel) Cc: Will Deacon Signed-off-by: Andrew Morton --- arch/arm64/include/asm/rqspinlock.h | 85 -------------------------- 1 file changed, 85 deletions(-) --- a/arch/arm64/include/asm/rqspinlock.h~arm64-rqspinlock-remove-private-copy-of-smp_cond_load_acquire_timewait +++ a/arch/arm64/include/asm/rqspinlock.h @@ -3,91 +3,6 @@ #define _ASM_RQSPINLOCK_H #include - -/* - * Hardcode res_smp_cond_load_acquire implementations for arm64 to a custom - * version based on [0]. In rqspinlock code, our conditional expression involves - * checking the value _and_ additionally a timeout. However, on arm64, the - * WFE-based implementation may never spin again if no stores occur to the - * locked byte in the lock word. As such, we may be stuck forever if - * event-stream based unblocking is not available on the platform for WFE spin - * loops (arch_timer_evtstrm_available). - * - * Once support for smp_cond_load_acquire_timewait [0] lands, we can drop this - * copy-paste. - * - * While we rely on the implementation to amortize the cost of sampling - * cond_expr for us, it will not happen when event stream support is - * unavailable, time_expr check is amortized. This is not the common case, and - * it would be difficult to fit our logic in the time_expr_ns >= time_limit_ns - * comparison, hence just let it be. In case of event-stream, the loop is woken - * up at microsecond granularity. - * - * [0]: https://lore.kernel.org/lkml/20250203214911.898276-1-ankur.a.arora@oracle.com - */ - -#ifndef smp_cond_load_acquire_timewait - -#define smp_cond_time_check_count 200 - -#define __smp_cond_load_relaxed_spinwait(ptr, cond_expr, time_expr_ns, \ - time_limit_ns) ({ \ - typeof(ptr) __PTR = (ptr); \ - __unqual_scalar_typeof(*ptr) VAL; \ - unsigned int __count = 0; \ - for (;;) { \ - VAL = READ_ONCE(*__PTR); \ - if (cond_expr) \ - break; \ - cpu_relax(); \ - if (__count++ < smp_cond_time_check_count) \ - continue; \ - if ((time_expr_ns) >= (time_limit_ns)) \ - break; \ - __count = 0; \ - } \ - (typeof(*ptr))VAL; \ -}) - -#define __smp_cond_load_acquire_timewait(ptr, cond_expr, \ - time_expr_ns, time_limit_ns) \ -({ \ - typeof(ptr) __PTR = (ptr); \ - __unqual_scalar_typeof(*ptr) VAL; \ - for (;;) { \ - VAL = smp_load_acquire(__PTR); \ - if (cond_expr) \ - break; \ - __cmpwait_relaxed(__PTR, VAL); \ - if ((time_expr_ns) >= (time_limit_ns)) \ - break; \ - } \ - (typeof(*ptr))VAL; \ -}) - -#define smp_cond_load_acquire_timewait(ptr, cond_expr, \ - time_expr_ns, time_limit_ns) \ -({ \ - __unqual_scalar_typeof(*ptr) _val; \ - int __wfe = arch_timer_evtstrm_available(); \ - \ - if (likely(__wfe)) { \ - _val = __smp_cond_load_acquire_timewait(ptr, cond_expr, \ - time_expr_ns, \ - time_limit_ns); \ - } else { \ - _val = __smp_cond_load_relaxed_spinwait(ptr, cond_expr, \ - time_expr_ns, \ - time_limit_ns); \ - smp_acquire__after_ctrl_dep(); \ - } \ - (typeof(*ptr))_val; \ -}) - -#endif - -#define res_smp_cond_load_acquire(v, c) smp_cond_load_acquire_timewait(v, c, 0, 1) - #include #endif /* _ASM_RQSPINLOCK_H */ _ Patches currently in -mm which might be from ankur.a.arora@oracle.com are asm-generic-barrier-add-smp_cond_load_relaxed_timeout.patch arm64-barrier-support-smp_cond_load_relaxed_timeout.patch arm64-delay-move-some-constants-out-to-a-separate-header.patch arm64-support-wfet-in-smp_cond_load_relaxed_timeout.patch arm64-rqspinlock-remove-private-copy-of-smp_cond_load_acquire_timewait.patch asm-generic-barrier-add-smp_cond_load_acquire_timeout.patch atomic-add-atomic_cond_read__timeout.patch locking-atomic-scripts-build-atomic_long_cond_read__timeout.patch bpf-rqspinlock-switch-check_timeout-to-a-clock-interface.patch bpf-rqspinlock-use-smp_cond_load_acquire_timeout.patch sched-add-need-resched-timed-wait-interface.patch cpuidle-poll_state-wait-for-need-resched-via-tif_need_resched_relaxed_wait.patch kunit-enable-testing-smp_cond_load_relaxed_timeout.patch kunit-add-tests-for-smp_cond_load_relaxed_timeout.patch