locking/atomic: Add generic support for sync_try_cmpxchg() and its fallback
authorUros Bizjak <ubizjak@gmail.com>
Mon, 25 Sep 2023 14:50:23 +0000 (16:50 +0200)
committerIngo Molnar <mingo@kernel.org>
Mon, 9 Oct 2023 16:14:15 +0000 (18:14 +0200)
commite01cc1e8c2ad73cebb980878ede5584e0f2688f7
treeee93283bb168d049096a9415bfee8efd99efabe1
parentfdb8b7a1af31d69ee1c8ddc02926cb409eaaecc3
locking/atomic: Add generic support for sync_try_cmpxchg() and its fallback

Provide the generic sync_try_cmpxchg() function from the
raw_ prefixed version, also adding explicit instrumentation.

The patch amends existing scripts to generate sync_try_cmpxchg()
locking primitive and its raw_sync_try_cmpxchg() fallback, while
leaving existing macros from the try_cmpxchg() family unchanged.

The target can define its own arch_sync_try_cmpxchg() to override the
generic version of raw_sync_try_cmpxchg(). This allows the target
to generate more optimal assembly than the generic version.

Additionally, the patch renames two scripts to better reflect
whet they really do.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Will Deacon <will@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Boqun Feng <boqun.feng@gmail.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
include/linux/atomic/atomic-arch-fallback.h
include/linux/atomic/atomic-instrumented.h
scripts/atomic/gen-atomic-fallback.sh
scripts/atomic/gen-atomic-instrumented.sh