From: Gary Guo <gary@garyguo.net>
To: Boqun Feng <boqun.feng@gmail.com>
Cc: FUJITA Tomonori <fujita.tomonori@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 v1 1/3] rust: sync: atomic: Prepare AtomicOps macros for i8/i16 support
Date: Mon, 29 Dec 2025 16:36:16 +0000 [thread overview]
Message-ID: <20251229163616.732caffb.gary@garyguo.net> (raw)
In-Reply-To: <aVJiR72gcz_uonoS@tardis-2.local>
On Mon, 29 Dec 2025 19:13:11 +0800
Boqun Feng <boqun.feng@gmail.com> wrote:
> On Sun, Dec 28, 2025 at 09:05:44PM +0900, FUJITA Tomonori wrote:
> > Rework the internal AtomicOps macro plumbing to generate per-type
> > implementations from a mapping list.
> >
> > Capture the trait definition once and reuse it for both declaration
> > and per-type impl expansion to reduce duplication and keep future
> > extensions simple.
> >
> > This is a preparatory refactor for enabling i8/i16 atomics cleanly.
> >
> > Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
>
> Thanks! I have an idea that uses proc-macro to generate the Atomic*Ops
> impls, e.g.
>
> #[atomic_ops(i8, i16, i32, i64)]
> pub trait AtomicBasicOps {
> #[variant(acquire)]
> fn read(a: &AtomicRepr<Self>) -> Self {
> unsafe { binding_call!(a.as_ptr().cast()) }
> }
> }
Unless the proc macro is generally applicable to a wide range of subsystem
abstractions, I would still prefer to use declarative macros.
Best,
Gary
>
> But I think the current solution in your patch suffices as a temporary
> solution at least.
>
> Regards,
> Boqun
next prev parent reply other threads:[~2025-12-29 16:36 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-28 12:05 [PATCH v1 0/3] rust: Add xchg and cmpxchg support on i8/i16 FUJITA Tomonori
2025-12-28 12:05 ` [PATCH v1 1/3] rust: sync: atomic: Prepare AtomicOps macros for i8/i16 support FUJITA Tomonori
2025-12-29 11:13 ` Boqun Feng
2025-12-29 11:54 ` FUJITA Tomonori
2025-12-29 16:36 ` Gary Guo [this message]
2025-12-30 0:17 ` Boqun Feng
2026-01-02 11:25 ` Gary Guo
2025-12-28 12:05 ` [PATCH v1 2/3] rust: sync: atomic: Remove workaround macro for i8/i16 BasicOps FUJITA Tomonori
2025-12-29 11:58 ` Boqun Feng
2025-12-29 12:55 ` FUJITA Tomonori
2025-12-29 13:19 ` Boqun Feng
2025-12-28 12:05 ` [PATCH v1 3/3] rust: sync: atomic: Add i8/i16 xchg and cmpxchg support FUJITA Tomonori
2025-12-29 12:27 ` Boqun Feng
2025-12-29 12:30 ` Boqun Feng
2025-12-29 13:04 ` FUJITA Tomonori
2025-12-29 13:13 ` Boqun Feng
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=20251229163616.732caffb.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