From: Gary Guo <gary@garyguo.net>
To: FUJITA Tomonori <fujita.tomonori@gmail.com>
Cc: boqun.feng@gmail.com, ojeda@kernel.org, a.hindborg@kernel.org,
aliceryhl@google.com, bjorn3_gh@protonmail.com, dakr@kernel.org,
lossin@kernel.org, tmgross@umich.edu, acourbot@nvidia.com,
rust-for-linux@vger.kernel.org, linux-arch@vger.kernel.org
Subject: Re: [PATCH v2 0/4] rust: Add i8/i16 atomic xchg helpers
Date: Tue, 23 Dec 2025 12:46:39 +0000 [thread overview]
Message-ID: <20251223124639.7771082d.gary@garyguo.net> (raw)
In-Reply-To: <20251223062140.938325-1-fujita.tomonori@gmail.com>
On Tue, 23 Dec 2025 15:21:36 +0900
FUJITA Tomonori <fujita.tomonori@gmail.com> wrote:
> This adds atomic xchg helpers with full, acquire, release, and relaxed
> orderings in preparation for i8/i16 atomic xchg support.
Any reason this series is not sent together with the user (i.e.
Rust support) that uses it?
>
> 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.
Maybe it's just that I'm reading this differently, but I think this is a
bit confusing, as if there's an optimisation opportunity.
x86 is TSO, so even a relaxed xchg is a full xchg. So in this sense x86
has implemented all orderings.
Looking at loongarch ISA manual it's suggested that apart from load/store,
all other atomic memory instructions are also always full ordering.
The change themselves LGTM, so
Reviewed-by: Gary Guo <gary@garyguo.net>
Best,
Gary
>
> - 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
next prev parent reply other threads:[~2025-12-23 12:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Gary Guo [this message]
2025-12-25 0:56 ` [PATCH v2 0/4] rust: Add i8/i16 atomic xchg helpers 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
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=20251223124639.7771082d.gary@garyguo.net \
--to=gary@garyguo.net \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=dakr@kernel.org \
--cc=fujita.tomonori@gmail.com \
--cc=linux-arch@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
/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