* [GIT PULL] Add two-byte cmpxchg emulation function for v7.4
@ 2026-10-17 3:51 Paul E. McKenney
2026-10-20 18:48 ` John Paul Adrian Glaubitz
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Paul E. McKenney @ 2026-10-17 3:51 UTC (permalink / raw)
To: torvalds; +Cc: linux-kernel, kernel-team, Bradley Morgan, Arnd Bergmann
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(-)
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [GIT PULL] Add two-byte cmpxchg emulation function for v7.4 2026-10-17 3:51 [GIT PULL] Add two-byte cmpxchg emulation function for v7.4 Paul E. McKenney @ 2026-10-20 18:48 ` John Paul Adrian Glaubitz 2026-10-20 18:54 ` Bradley Morgan 2026-10-20 19:14 ` Paul E. McKenney 2026-10-21 1:08 ` pr-tracker-bot 2026-10-23 11:26 ` Jan Engelhardt 2 siblings, 2 replies; 10+ messages in thread From: John Paul Adrian Glaubitz @ 2026-10-20 18:48 UTC (permalink / raw) To: paulmck, torvalds Cc: linux-kernel, kernel-team, Bradley Morgan, Arnd Bergmann Hi Paul, On Fri, 2026-10-16 at 20:51 -0700, Paul E. McKenney wrote: > 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. Since this paragraph has produced a headline today [1], would you mind clarifying what you meant here? What architectures are you talking about? Thanks, Adrian > [1] https://www.phoronix.com/news/Linux-7.4-Two-Byte-CMPXCHG -- .''`. John Paul Adrian Glaubitz : :' : Debian Developer `. `' Physicist `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [GIT PULL] Add two-byte cmpxchg emulation function for v7.4 2026-10-20 18:48 ` John Paul Adrian Glaubitz @ 2026-10-20 18:54 ` Bradley Morgan 2026-10-20 19:21 ` Paul E. McKenney 2026-10-20 19:14 ` Paul E. McKenney 1 sibling, 1 reply; 10+ messages in thread From: Bradley Morgan @ 2026-10-20 18:54 UTC (permalink / raw) To: John Paul Adrian Glaubitz, paulmck, torvalds Cc: linux-kernel, kernel-team, Arnd Bergmann On 20 October 2026 19:48:32 BST, John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> wrote: >Hi Paul, > >On Fri, 2026-10-16 at 20:51 -0700, Paul E. McKenney wrote: >> 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. > >Since this paragraph has produced a headline today [1], would you mind >clarifying what you meant here? What architectures are you talking about? > >Thanks, >Adrian > >> [1] https://www.phoronix.com/news/Linux-7.4-Two-Byte-CMPXCHG Annoyingly my name isn't on there :( But I'm happy it IS a headline :) > > --- Thanks! https://lore.kernel.org/all/EE579805-42F2-4C58-B752-F28779EEB717@grrlz.net/ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [GIT PULL] Add two-byte cmpxchg emulation function for v7.4 2026-10-20 18:54 ` Bradley Morgan @ 2026-10-20 19:21 ` Paul E. McKenney 2026-10-20 19:26 ` Bradley Morgan 0 siblings, 1 reply; 10+ messages in thread From: Paul E. McKenney @ 2026-10-20 19:21 UTC (permalink / raw) To: Bradley Morgan Cc: John Paul Adrian Glaubitz, torvalds, linux-kernel, kernel-team, Arnd Bergmann On Tue, Oct 20, 2026 at 07:54:38PM +0100, Bradley Morgan wrote: > On 20 October 2026 19:48:32 BST, John Paul Adrian Glaubitz > <glaubitz@physik.fu-berlin.de> wrote: > >Hi Paul, > > > >On Fri, 2026-10-16 at 20:51 -0700, Paul E. McKenney wrote: > >> 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. > > > >Since this paragraph has produced a headline today [1], would you mind > >clarifying what you meant here? What architectures are you talking about? > > > >Thanks, > >Adrian > > > >> [1] https://www.phoronix.com/news/Linux-7.4-Two-Byte-CMPXCHG > > Annoyingly my name isn't on there :( But your name is prominently mentioned in the pull request linked to by the article. > But I'm happy it IS a headline :) Me, I am a bit surprised that this made Phoronix, especially given that Linus hasn't pulled it yet. Perhaps there is someone out there who, like a number of the commenters, got confused and read "architecture" when both the article and the pull request said "system". ;-) Thanx, Paul ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [GIT PULL] Add two-byte cmpxchg emulation function for v7.4 2026-10-20 19:21 ` Paul E. McKenney @ 2026-10-20 19:26 ` Bradley Morgan 0 siblings, 0 replies; 10+ messages in thread From: Bradley Morgan @ 2026-10-20 19:26 UTC (permalink / raw) To: paulmck, Paul E. McKenney Cc: John Paul Adrian Glaubitz, torvalds, linux-kernel, kernel-team, Arnd Bergmann On 20 October 2026 20:21:31 BST, "Paul E. McKenney" <paulmck@kernel.org> wrote: >On Tue, Oct 20, 2026 at 07:54:38PM +0100, Bradley Morgan wrote: >> On 20 October 2026 19:48:32 BST, John Paul Adrian Glaubitz >> <glaubitz@physik.fu-berlin.de> wrote: >> >Hi Paul, >> > >> >On Fri, 2026-10-16 at 20:51 -0700, Paul E. McKenney wrote: >> >> 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. >> > >> >Since this paragraph has produced a headline today [1], would you mind >> >clarifying what you meant here? What architectures are you talking >about? >> > >> >Thanks, >> >Adrian >> > >> >> [1] https://www.phoronix.com/news/Linux-7.4-Two-Byte-CMPXCHG >> >> Annoyingly my name isn't on there :( > >But your name is prominently mentioned in the pull request linked to by >the >article. I bet they saw Bradley Morgan and went, ^W^W^W^W^W^W^W^W^Wmeh, Paul is more famous let's involve him and not the guy who made the patches^W^W^W^W^W^W^W^W^W^W > >> But I'm happy it IS a headline :) > >Me, I am a bit surprised that this made Phoronix, especially given that >Linus hasn't pulled it yet. Perhaps there is someone out there who, >like a number of the commenters, got confused and read "architecture" >when both the article and the pull request said "system". ;-) Me personally I got a notification on my phone, they tend to talk about arch "improvements" anyway. I like pheronix. > > Thanx, Paul --- Thanks! https://lore.kernel.org/all/EE579805-42F2-4C58-B752-F28779EEB717@grrlz.net/ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [GIT PULL] Add two-byte cmpxchg emulation function for v7.4 2026-10-20 18:48 ` John Paul Adrian Glaubitz 2026-10-20 18:54 ` Bradley Morgan @ 2026-10-20 19:14 ` Paul E. McKenney 2026-10-21 9:13 ` John Paul Adrian Glaubitz 1 sibling, 1 reply; 10+ messages in thread From: Paul E. McKenney @ 2026-10-20 19:14 UTC (permalink / raw) To: John Paul Adrian Glaubitz Cc: torvalds, linux-kernel, kernel-team, Bradley Morgan, Arnd Bergmann, phoronix On Tue, Oct 20, 2026 at 08:48:32PM +0200, John Paul Adrian Glaubitz wrote: > Hi Paul, > > On Fri, 2026-10-16 at 20:51 -0700, Paul E. McKenney wrote: > > 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. > > Since this paragraph has produced a headline today [1], would you mind > clarifying what you meant here? What architectures are you talking about? The important word in the second paragraph quoted by the article is "systems", which is not "architectures". To its credit, the article keeps this straight, but not so much the comments. And here is Arnd Bergmann's patch that started this: https://lore.kernel.org/all/20260908152808.3928630-4-arnd@kernel.org/ The system Arnd calls out is the Acorn Risc PC, which is one member of the Arm family. So not an entire architecture, but rather just a particular implementation of an architecture, and an old one at that. Not only that, but if I remember correctly, Arnd got considerable pushback, so I am not sure that his support-removal patch is going in just yet, as in I do not yet see it in -next. Please feel free to add this as a comment to the article, as the site is not permitting me to do so. I have added their feedback email on CC in case that helps, and in the hope that my doing so does not unduly annoy them. Thanx, Paul > Thanks, > Adrian > > > [1] https://www.phoronix.com/news/Linux-7.4-Two-Byte-CMPXCHG > > -- > .''`. John Paul Adrian Glaubitz > : :' : Debian Developer > `. `' Physicist > `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [GIT PULL] Add two-byte cmpxchg emulation function for v7.4 2026-10-20 19:14 ` Paul E. McKenney @ 2026-10-21 9:13 ` John Paul Adrian Glaubitz 0 siblings, 0 replies; 10+ messages in thread From: John Paul Adrian Glaubitz @ 2026-10-21 9:13 UTC (permalink / raw) To: paulmck Cc: torvalds, linux-kernel, kernel-team, Bradley Morgan, Arnd Bergmann, phoronix Hello Paul, On Tue, 2026-10-20 at 12:14 -0700, Paul E. McKenney wrote: > On Tue, Oct 20, 2026 at 08:48:32PM +0200, John Paul Adrian Glaubitz wrote: > > Hi Paul, > > > > On Fri, 2026-10-16 at 20:51 -0700, Paul E. McKenney wrote: > > > 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. > > > > Since this paragraph has produced a headline today [1], would you mind > > clarifying what you meant here? What architectures are you talking about? > > The important word in the second paragraph quoted by the article is > "systems", which is not "architectures". To its credit, the article > keeps this straight, but not so much the comments. > > And here is Arnd Bergmann's patch that started this: > > https://lore.kernel.org/all/20260908152808.3928630-4-arnd@kernel.org/ > > The system Arnd calls out is the Acorn Risc PC, which is one member of the > Arm family. So not an entire architecture, but rather just a particular > implementation of an architecture, and an old one at that. Not only > that, but if I remember correctly, Arnd got considerable pushback, > so I am not sure that his support-removal patch is going in just yet, > as in I do not yet see it in -next. > > Please feel free to add this as a comment to the article, as the site > is not permitting me to do so. I have added their feedback email on > CC in case that helps, and in the hope that my doing so does not unduly > annoy them. Thanks a lot for the clarification, much appreciated! Relieved, Adrian -- .''`. John Paul Adrian Glaubitz : :' : Debian Developer `. `' Physicist `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [GIT PULL] Add two-byte cmpxchg emulation function for v7.4 2026-10-17 3:51 [GIT PULL] Add two-byte cmpxchg emulation function for v7.4 Paul E. McKenney 2026-10-20 18:48 ` John Paul Adrian Glaubitz @ 2026-10-21 1:08 ` pr-tracker-bot 2026-10-23 11:26 ` Jan Engelhardt 2 siblings, 0 replies; 10+ messages in thread From: pr-tracker-bot @ 2026-10-21 1:08 UTC (permalink / raw) To: Paul E. McKenney Cc: torvalds, linux-kernel, kernel-team, Bradley Morgan, Arnd Bergmann The pull request you sent on Fri, 16 Oct 2026 20:51:38 -0700: > git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git tags/cmpxchg-emu.2026.10.12b has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/6303381334e3ac3f0762c5db2f240e0348c36c9b Thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/prtracker.html ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [GIT PULL] Add two-byte cmpxchg emulation function for v7.4 2026-10-17 3:51 [GIT PULL] Add two-byte cmpxchg emulation function for v7.4 Paul E. McKenney 2026-10-20 18:48 ` John Paul Adrian Glaubitz 2026-10-21 1:08 ` pr-tracker-bot @ 2026-10-23 11:26 ` Jan Engelhardt 2026-10-23 16:12 ` Paul E. McKenney 2 siblings, 1 reply; 10+ messages in thread From: Jan Engelhardt @ 2026-10-23 11:26 UTC (permalink / raw) To: Paul E. McKenney Cc: torvalds, linux-kernel, kernel-team, Bradley Morgan, Arnd Bergmann On Saturday 2026-10-17 05:51, Paul E. McKenney wrote: > >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() [...] >namely sh, arc, csky, and xtensa. > >There is reason to believe that these systems will soon no longer be >supported by Linux. riscv64 also only has two exchange operations (lr.w.aqrl/lr.d.aqrl/sc.w.rl/sc.d.rl). (atomic_compare_exchange_strong with uint8/16_t, in userspace, gets replaced by the compiler to a lot more instructions thanks to implied -finline-atomics.) Are you saying riscv64 is going to go unsupported too? ;-) ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [GIT PULL] Add two-byte cmpxchg emulation function for v7.4 2026-10-23 11:26 ` Jan Engelhardt @ 2026-10-23 16:12 ` Paul E. McKenney 0 siblings, 0 replies; 10+ messages in thread From: Paul E. McKenney @ 2026-10-23 16:12 UTC (permalink / raw) To: Jan Engelhardt Cc: torvalds, linux-kernel, kernel-team, Bradley Morgan, Arnd Bergmann On Fri, Oct 23, 2026 at 01:26:25PM +0200, Jan Engelhardt wrote: > > On Saturday 2026-10-17 05:51, Paul E. McKenney wrote: > > > >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() [...] > >namely sh, arc, csky, and xtensa. > > > >There is reason to believe that these systems will soon no longer be > >supported by Linux. > > riscv64 also only has two exchange operations > (lr.w.aqrl/lr.d.aqrl/sc.w.rl/sc.d.rl). > (atomic_compare_exchange_strong with uint8/16_t, in userspace, gets > replaced by the compiler to a lot more instructions thanks to > implied -finline-atomics.) > > Are you saying riscv64 is going to go unsupported too? ;-) Given that the compiler can make it work in userspace, then the riscv64 architecture-specific code should be able to make it work in the Linux kernel. At which point there is absolutely no reason that Linux-kernel support for riscv64 should be dropped. Or am I missing something here? Thanx, Paul ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2026-10-23 16:12 UTC | newest] Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2026-10-17 3:51 [GIT PULL] Add two-byte cmpxchg emulation function for v7.4 Paul E. McKenney 2026-10-20 18:48 ` John Paul Adrian Glaubitz 2026-10-20 18:54 ` Bradley Morgan 2026-10-20 19:21 ` Paul E. McKenney 2026-10-20 19:26 ` Bradley Morgan 2026-10-20 19:14 ` Paul E. McKenney 2026-10-21 9:13 ` John Paul Adrian Glaubitz 2026-10-21 1:08 ` pr-tracker-bot 2026-10-23 11:26 ` Jan Engelhardt 2026-10-23 16:12 ` Paul E. McKenney
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®