Messages in this thread | | | Date | Wed, 1 May 2024 15:58:14 -0700 | From | "Paul E. McKenney" <> | Subject | [PATCH v2 cmpxchg 0/8] Provide emulation for one--byte cmpxchg() |
| |
Hello!
This v2 series provides emulation functions for one-byte cmpxchg, and uses it for those architectures not supporting this in hardware. The emulation is in terms of the fully ordered four-byte cmpxchg() that is supplied by all of these architectures. This was tested by making x86 forget that it can do one-byte cmpxchg() natively:
f0183ab28489 ("EXP arch/x86: Test one-byte cmpxchg emulation")
This commit is local to -rcu and is of course not intended for mainline.
If accepted, RCU Tasks will use this capability in place of the current rcu_trc_cmpxchg_need_qs() open-coding of this emulation.
The patches are as follows:
1. sparc32: make __cmpxchg_u32() return u32, courtesy of Al Viro.
2. sparc32: make the first argument of __cmpxchg_u64() volatile u64 *, courtesy of Al Viro.
3. sparc32: unify __cmpxchg_u{32,64}, courtesy of Al Viro.
4. sparc32: add __cmpxchg_u{8,16}() and teach __cmpxchg() to handle those sizes, courtesy of Al Viro.
5. parisc: __cmpxchg_u32(): lift conversion into the callers, courtesy of Al Viro.
6. parisc: unify implementations of __cmpxchg_u{8,32,64}, courtesy of Al Viro.
7. parisc: add missing export of __cmpxchg_u8(), courtesy of Al Viro.
8. parisc: add u16 support to cmpxchg(), courtesy of Al Viro.
9. lib: Add one-byte emulation function.
10. ARC: Emulate one-byte cmpxchg.
11. csky: Emulate one-byte cmpxchg.
12. sh: Emulate one-byte cmpxchg.
13. xtensa: Emulate one-byte cmpxchg.
Changes since v2:
o Dropped riscv patch in favor of alternative patch that provides native support.
o Fixed yet more casting bugs spotted by kernel test robot and by Geert Uytterhoeven.
Changes since v1:
o Add native support for sparc32 and parisc, courtesy of Al Viro.
o Remove two-byte emulation due to architectures that still do not support two-byte load and store instructions, per Arnd Bergmann feedback. (Yes, there are a few systems out there that do not even support one-byte load instructions, but these are slated for removal anyway.)
o Fix numerous casting bugs spotted by kernel test robot.
o Fix SPDX header. "//" for .c files and "/*" for .h files. I am sure that there is a good reason for this. ;-)
Thanx, Paul
------------------------------------------------------------------------
arch/parisc/include/asm/cmpxchg.h | 19 +++++------- arch/parisc/kernel/parisc_ksyms.c | 1 arch/parisc/lib/bitops.c | 52 +++++++++++----------------------- arch/sparc/include/asm/cmpxchg_32.h | 18 +++++------ arch/sparc/lib/atomic32.c | 47 +++++++++++++----------------- b/arch/Kconfig | 3 + b/arch/arc/Kconfig | 1 b/arch/arc/include/asm/cmpxchg.h | 33 +++++++++++++++------ b/arch/csky/Kconfig | 1 b/arch/csky/include/asm/cmpxchg.h | 10 ++++++ b/arch/parisc/include/asm/cmpxchg.h | 3 - b/arch/parisc/kernel/parisc_ksyms.c | 1 b/arch/parisc/lib/bitops.c | 6 +-- b/arch/sh/Kconfig | 1 b/arch/sh/include/asm/cmpxchg.h | 3 + b/arch/sparc/include/asm/cmpxchg_32.h | 4 +- b/arch/sparc/lib/atomic32.c | 4 +- b/arch/xtensa/Kconfig | 1 b/arch/xtensa/include/asm/cmpxchg.h | 2 + b/include/linux/cmpxchg-emu.h | 15 +++++++++ b/lib/Makefile | 1 b/lib/cmpxchg-emu.c | 45 +++++++++++++++++++++++++++++ 22 files changed, 172 insertions(+), 99 deletions(-)
| |