From: "Nysal Jan K.A." <nysal@linux.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: Jeevitha Palanisamy <jeevitha@linux.ibm.com>,
"Nysal Jan K.A." <nysal@linux.ibm.com>,
Madhavan Srinivasan <maddy@linux.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
"Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
"Ritesh Harjani (IBM)" <ritesh.list@gmail.com>,
Shrikanth Hegde <sshegde@linux.ibm.com>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Bill Wendling <morbo@google.com>,
Justin Stitt <justinstitt@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
"David Hildenbrand (Arm)" <david@kernel.org>,
SJ Park <sj@kernel.org>, Usama Arif <usama.arif@linux.dev>,
Kevin Brodsky <kevin.brodsky@arm.com>,
"Kiryl Shutsemau (Meta)" <kas@kernel.org>,
linux-kernel@vger.kernel.org, llvm@lists.linux.dev
Subject: [PATCH 0/3] powerpc: Implement cmpxchg128()
Date: Wed, 25 Nov 2026 23:10:21 +0530 [thread overview]
Message-ID: <20261125174035.1412724-1-nysal@linux.ibm.com> (raw)
This series adds arch_cmpxchg128() and arch_cmpxchg128_local() for
little-endian POWER8 and later, using lqarx/stqcx. This enables
HAVE_CMPXCHG_DOUBLE and HAVE_ALIGNED_STRUCT_PAGE, which gives us:
* SLUB's lockless __update_freelist_fast() path (avoiding slab_lock()).
* kmalloc_nolock(), without which BPF task-local storage creation fails
with -ENOMEM, and the selftests task_local_data_race and
struct_ops_assoc (timer subtests) fail. BPF Arena kfuncs were changed
to be callable from any context. kmalloc_nolock() replaced kvcalloc()
in the arena allocation paths because kvcalloc() may sleep and take
ordinary allocator locks, while kmalloc_nolock() can run in NMI or
non-sleepable contexts.
The lqarx and stqcx. instructions require the 128-bit operand to reside in
a consecutive even/odd register pair. In the Power ISA, the operand uses
big-endian register layout where the most significant and least
significant 64 bits are in the even and odd registers respectively.
Until now this could not be expressed in inline asm without hard
register constraints [1].
GCC now supports this through the PTI mode attribute [2,3] for PowerPC
and it will be available in the upcoming GCC 17 release. Backports have
landed in the GCC 14, 15 and 16 branches. GCC 16.2 is the first release
which has PTI mode support. For older GCC releases and clang there is a
fallback implementation with hard register constraints.
Additionally, this series enables PPC_HAS_LBARX_LHARX for Power10, which
was previously omitted in the Kconfig.
[1] https://github.com/linuxppc/issues/issues/463
[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106895
[3] https://gcc.gnu.org/pipermail/gcc-patches/2026-April/712831.html
Nysal Jan K.A. (3):
powerpc: Add support for 128-bit cmpxchg
powerpc: Implement 128-bit cmpxchg fallback
powerpc: Enable lbarx/lharx for Power10
arch/powerpc/Kconfig | 8 ++
arch/powerpc/include/asm/cmpxchg.h | 100 +++++++++++++++++++++++++
arch/powerpc/platforms/Kconfig.cputype | 4 +
3 files changed, 112 insertions(+)
base-commit: 65e4fd942f72a9dba0e4e257290c4fa1aa756854
--
2.52.0
next reply other threads:[~2026-11-25 17:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 17:40 Nysal Jan K.A. [this message]
2026-11-25 17:40 ` [PATCH 1/3] powerpc: Add support for 128-bit cmpxchg Nysal Jan K.A.
2026-11-25 17:40 ` [PATCH 2/3] powerpc: Implement 128-bit cmpxchg fallback Nysal Jan K.A.
2026-11-25 17:40 ` [PATCH 3/3] powerpc: Enable lbarx/lharx for Power10 Nysal Jan K.A.
2026-11-25 17:51 ` [PATCH 0/3] powerpc: Implement cmpxchg128() Nick Desaulniers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261125174035.1412724-1-nysal@linux.ibm.com \
--to=nysal@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=chleroy@kernel.org \
--cc=david@kernel.org \
--cc=jeevitha@linux.ibm.com \
--cc=justinstitt@google.com \
--cc=kas@kernel.org \
--cc=kevin.brodsky@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=llvm@lists.linux.dev \
--cc=maddy@linux.ibm.com \
--cc=morbo@google.com \
--cc=mpe@ellerman.id.au \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=npiggin@gmail.com \
--cc=ritesh.list@gmail.com \
--cc=sj@kernel.org \
--cc=sshegde@linux.ibm.com \
--cc=usama.arif@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®