Re: [PATCH v7 1/9] rust: Introduce atomic API helpers

From
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date
2025-07-16 09:23:12
Also in
linux-arch, lkml
Reply to
Boqun Feng, 2025-07-14
On Sun, Jul 13, 2025 at 10:36:48PM -0700, Boqun Feng wrote:
quoted hunk ↗ jump to hunk
In order to support LKMM atomics in Rust, add rust_helper_* for atomic
APIs. These helpers ensure the implementation of LKMM atomics in Rust is
the same as in C. This could save the maintenance burden of having two
similar atomic implementations in asm.

Originally-by: Mark Rutland [off-list ref]
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Boqun Feng <redacted>
---
 rust/helpers/atomic.c                     | 1040 +++++++++++++++++++++
 rust/helpers/helpers.c                    |    1 +
 scripts/atomic/gen-atomics.sh             |    1 +
 scripts/atomic/gen-rust-atomic-helpers.sh |   67 ++
 4 files changed, 1109 insertions(+)
 create mode 100644 rust/helpers/atomic.c
 create mode 100755 scripts/atomic/gen-rust-atomic-helpers.sh
diff --git a/rust/helpers/atomic.c b/rust/helpers/atomic.c
new file mode 100644
index 000000000000..cf06b7ef9a1c
--- /dev/null
+++ b/rust/helpers/atomic.c
@@ -0,0 +1,1040 @@
+// SPDX-License-Identifier: GPL-2.0
+
+// Generated by scripts/atomic/gen-rust-atomic-helpers.sh
+// DO NOT MODIFY THIS FILE DIRECTLY
As this is auto-generated, how do we know when to auto-generate it
again?  What files does it depend on?  And why can't we just
auto-generate it at build time instead of having a static file in the
tree that no one knows when to regenerate it?  :)

thanks,

greg k-h
Thread (50 messages) 50 messages, 5 authors, last reply 2025-07-16
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help