[GIT PULL] Add two-byte cmpxchg emulation function for v7.4
From: Paul E. McKenney
Date: Fri Oct 16 2026 - 23:51:49 EST
Hello, Linus,
When the v7.4 merge window opens, please pull this two-byte cmpxchg
emulation:
git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git tags/cmpxchg-emu.2026.10.12b
# HEAD: 558ccc91ddf98d58ae726ed7ccaf5838f284084f: xtensa: Emulate two-byte cmpxchg (2026-10-12 16:36:53 -0700)
----------------------------------------------------------------
Add emulation of two-byte cmpxchg()
These commits add a cmpxchg_emu_u16() function that emulates two-byte
cmpxchg() in terms of four-byte cmpxchg() for architectures not having
native instructions for this purpose. They also make use of this
cmpxchg_emu_u16() function in those architectures, namely sh, arc, csky,
and xtensa. This permits use of two-byte cmpxchg() in common code.
However, it sadly does not permit easy implementation of all algorithms
needing on two-byte atomic operations because there are some systems still
supported by Linux that do not have native two-byte store instructions.
There is reason to believe that these systems will soon no longer be
supported by Linux.
----------------------------------------------------------------
Bradley Morgan (5):
lib: Add two-byte cmpxchg emulation function
sh: Emulate two-byte cmpxchg
ARC: Emulate two-byte cmpxchg
csky: Emulate two-byte cmpxchg
xtensa: Emulate two-byte cmpxchg
arch/arc/include/asm/cmpxchg.h | 3 +++
arch/csky/include/asm/cmpxchg.h | 9 +++++++++
arch/sh/include/asm/cmpxchg.h | 2 ++
arch/xtensa/include/asm/cmpxchg.h | 1 +
include/linux/cmpxchg-emu.h | 4 +++-
lib/cmpxchg-emu.c | 38 ++++++++++++++++++++++++++++++++++----
6 files changed, 52 insertions(+), 5 deletions(-)