From: Boqun Feng <boqun.feng@gmail.com>
To: Alice Ryhl <aliceryhl@google.com>
Cc: "Miguel Ojeda" <ojeda@kernel.org>, "Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Will Deacon" <will@kernel.org>,
"Peter Zijlstra" <peterz@infradead.org>,
"Mark Rutland" <mark.rutland@arm.com>,
rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rust: move #define __rust_helper out of atomic.c
Date: Wed, 7 Jan 2026 22:37:52 +0800 [thread overview]
Message-ID: <aV5vwMe_AiyQ8ePB@tardis-2.local> (raw)
In-Reply-To: <20260107-move-rust_helper-define-v1-1-4109d58ef275@google.com>
On Wed, Jan 07, 2026 at 02:14:13PM +0000, Alice Ryhl wrote:
> We were lucky that atomic.c is the first file in helpers.c so that we
> may use the define from it in the follow-up headers [1], but this is
> fragile. Thus, move it to helpers.c.
>
I reword a bit to make it clear that we need this changes for inline
helpers:
In order to support inline helpers [1], we need to have __rust_helper
defined for all helper files. Current we are lucky that atomic.c is the
first file in helpers.c, but this is fragile. Thus, move it to
helpers.c.
Let me know if you have futher suggestion.
> Link: https://lore.kernel.org/r/20260105-define-rust-helper-v2-0-51da5f454a67@google.com [1]
> Signed-off-by: Alice Ryhl <aliceryhl@google.com>
> ---
> When I send the next version of [PATCH 0/4] Inline helpers into Rust
> without full LTO, it will be based on top of this patch. Regardless of
> the timelines for the other series, I think it would be good to merge
> this patch soon.
> ---
> rust/helpers/atomic.c | 5 -----
> rust/helpers/helpers.c | 2 ++
> scripts/atomic/gen-rust-atomic-helpers.sh | 5 -----
> 3 files changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/rust/helpers/atomic.c b/rust/helpers/atomic.c
> index cf06b7ef9a1c559e8d7bdfc2bcd2aeb8951c29d1..a48605628ed73ac32aae2e6280481407a670e88f 100644
> --- a/rust/helpers/atomic.c
> +++ b/rust/helpers/atomic.c
> @@ -11,11 +11,6 @@
>
> #include <linux/atomic.h>
>
> -// TODO: Remove this after INLINE_HELPERS support is added.
> -#ifndef __rust_helper
> -#define __rust_helper
> -#endif
> -
> __rust_helper int
> rust_helper_atomic_read(const atomic_t *v)
> {
> diff --git a/rust/helpers/helpers.c b/rust/helpers/helpers.c
> index 79c72762ad9c4b473971e6210c9577860d2e2b08..a86fab743d1dc951373e5ff05278c6c7872ef491 100644
> --- a/rust/helpers/helpers.c
> +++ b/rust/helpers/helpers.c
> @@ -7,6 +7,8 @@
> * Sorted alphabetically.
> */
>
> +#define __rust_helper
> +
> #include "atomic.c"
> #include "auxiliary.c"
> #include "barrier.c"
> diff --git a/scripts/atomic/gen-rust-atomic-helpers.sh b/scripts/atomic/gen-rust-atomic-helpers.sh
> index 45b1e100ed7c63108ee6cb07e48a17668f860d47..a3732153af29f415e397e17cab6e75cb5d7efafc 100755
> --- a/scripts/atomic/gen-rust-atomic-helpers.sh
> +++ b/scripts/atomic/gen-rust-atomic-helpers.sh
whenever we changed scripts/atomic/* we need to rerun
scripts/atomic/gen-atomics.sh to calculate a new hash value of the
generated files, so we are missing this:
diff --git a/rust/helpers/atomic.c b/rust/helpers/atomic.c
index a48605628ed7..4b24eceef5fc 100644
--- a/rust/helpers/atomic.c
+++ b/rust/helpers/atomic.c
@@ -1032,4 +1032,4 @@ rust_helper_atomic64_dec_if_positive(atomic64_t *v)
}
#endif /* _RUST_ATOMIC_API_H */
-// 615a0e0c98b5973a47fe4fa65e92935051ca00ed
+// e4edb6174dd42a265284958f00a7cea7ddb464b1
I queued with this change for the rust-sync PR of 7.0, thanks!
Regards,
Boqun
> @@ -47,11 +47,6 @@ cat << EOF
>
> #include <linux/atomic.h>
>
> -// TODO: Remove this after INLINE_HELPERS support is added.
> -#ifndef __rust_helper
> -#define __rust_helper
> -#endif
> -
> EOF
>
> grep '^[a-z]' "$1" | while read name meta args; do
>
> ---
> base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
> change-id: 20260107-move-rust_helper-define-63edcfb2bff3
>
> Best regards,
> --
> Alice Ryhl <aliceryhl@google.com>
>
next prev parent reply other threads:[~2026-01-07 16:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-07 14:14 Alice Ryhl
2026-01-07 14:37 ` Boqun Feng [this message]
2026-01-07 17:20 ` Alice Ryhl
2026-01-07 23:15 ` Boqun Feng
2026-01-13 10:49 ` [tip: locking/core] rust: helpers: Move " tip-bot2 for Alice Ryhl
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=aV5vwMe_AiyQ8ePB@tardis-2.local \
--to=boqun.feng@gmail.com \
--cc=a.hindborg@kernel.org \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=dakr@kernel.org \
--cc=gary@garyguo.net \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=mark.rutland@arm.com \
--cc=ojeda@kernel.org \
--cc=peterz@infradead.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
--cc=will@kernel.org \
/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®