Generic Linux architectural discussions
 help / color / mirror / Atom feed
* [PATCH v2 0/4] rust: Add i8/i16 atomic xchg helpers
@ 2025-12-23  6:21 FUJITA Tomonori
  2025-12-23  6:21 ` [PATCH v2 1/4] rust: helpers: " FUJITA Tomonori
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: FUJITA Tomonori @ 2025-12-23  6:21 UTC (permalink / raw)
  To: boqun.feng, ojeda
  Cc: a.hindborg, aliceryhl, bjorn3_gh, dakr, gary, lossin, tmgross,
	acourbot, rust-for-linux, linux-arch

This adds atomic xchg helpers with full, acquire, release, and relaxed
orderings in preparation for i8/i16 atomic xchg support.

The architectures supporting Rust, implement atomic xchg families
using architecture-specific instructions. They work for i8/i16 too so
the helpers just call them.

Tested on QEMU (86_64, arm64, riscv, loongarch, and armv7).

Note the architectures that support Rust handle xchg differently:

- arm64 and riscv support xchg with all the orderings.

- x86_64 and loongarch support only full-ordering xchg. They calls the
  full-ordering xchg for any orderings.

- arm v7 supports only relaxed-odering xchg. It uses __atomic_op_
 macros to add barriers properly.

v2:
- Add comment about ARCH_SUPPORTS_ATOMIC_RMW dependency
- Add Alice's Reviewed-by
v1: https://lore.kernel.org/rust-for-linux/20251217213742.639812-1-fujita.tomonori@gmail.com/

FUJITA Tomonori (4):
  rust: helpers: Add i8/i16 atomic xchg helpers
  rust: helpers: Add i8/i16 atomic xchg_acquire helpers
  rust: helpers: Add i8/i16 atomic xchg_release helpers
  rust: helpers: Add i8/i16 atomic xchg_relaxed helpers

 rust/helpers/atomic_ext.c | 48 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)


base-commit: cae418334e4c402e410d3ee234935da33c7f904b
-- 
2.43.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-12-30  1:42 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-23  6:21 [PATCH v2 0/4] rust: Add i8/i16 atomic xchg helpers FUJITA Tomonori
2025-12-23  6:21 ` [PATCH v2 1/4] rust: helpers: " FUJITA Tomonori
2025-12-23  6:21 ` [PATCH v2 2/4] rust: helpers: Add i8/i16 atomic xchg_acquire helpers FUJITA Tomonori
2025-12-23  6:21 ` [PATCH v2 3/4] rust: helpers: Add i8/i16 atomic xchg_release helpers FUJITA Tomonori
2025-12-23  6:21 ` [PATCH v2 4/4] rust: helpers: Add i8/i16 atomic xchg_relaxed helpers FUJITA Tomonori
2025-12-23 12:46 ` [PATCH v2 0/4] rust: Add i8/i16 atomic xchg helpers Gary Guo
2025-12-25  0:56   ` FUJITA Tomonori
2025-12-27  7:23     ` Boqun Feng
2025-12-27  9:17       ` FUJITA Tomonori
2025-12-30  1:14         ` Boqun Feng
2025-12-30  1:42           ` FUJITA Tomonori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox