public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rust: sync: atomic: Provide stub for `rusttest` 32-bit hosts
@ 2026-01-23 23:34 Miguel Ojeda
  2026-01-25  6:04 ` Onur Özkan
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Miguel Ojeda @ 2026-01-23 23:34 UTC (permalink / raw)
  To: Will Deacon, Peter Zijlstra, Boqun Feng, Miguel Ojeda
  Cc: Mark Rutland, Gary Guo, linux-kernel, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, rust-for-linux, stable

For arm32, on a x86_64 builder, running the `rusttest` target yields:

    error[E0080]: evaluation of constant value failed
      --> rust/kernel/static_assert.rs:37:23
       |
    37 |         const _: () = ::core::assert!($condition $(,$arg)?);
       |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'assertion failed: size_of::<isize>() == size_of::<isize_atomic_repr>()', rust/kernel/sync/atomic/predefine.rs:68:1
       |
      ::: rust/kernel/sync/atomic/predefine.rs:68:1
       |
    68 | static_assert!(size_of::<isize>() == size_of::<isize_atomic_repr>());
       | -------------------------------------------------------------------- in this macro invocation
       |
       = note: this error originates in the macro `::core::assert` which comes from the expansion of the macro `static_assert` (in Nightly builds, run with -Z macro-backtrace for more info)

The reason is that `rusttest` runs on the host, so for e.g. a x86_64
builder `isize` is 64 bits but it is not a `CONFIG_64BIT` build.

Fix it by providing a stub for `rusttest` as usual.

Fixes: 84c6d36bcaf9 ("rust: sync: atomic: Add Atomic<{usize,isize}>")
Cc: stable@vger.kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
---
I kept the `cfg`s separated instead of using `all` so that, when we get
to remove this (since these tests will eventually be moved to KUnit), it
will just be line deletions (and I find it easier to read, too).

 rust/kernel/sync/atomic/predefine.rs | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/rust/kernel/sync/atomic/predefine.rs b/rust/kernel/sync/atomic/predefine.rs
index 45a17985cda4..0fca1ba3c2db 100644
--- a/rust/kernel/sync/atomic/predefine.rs
+++ b/rust/kernel/sync/atomic/predefine.rs
@@ -35,12 +35,23 @@ fn rhs_into_delta(rhs: i64) -> i64 {
 // as `isize` and `usize`, and `isize` and `usize` are always bi-directional transmutable to
 // `isize_atomic_repr`, which also always implements `AtomicImpl`.
 #[allow(non_camel_case_types)]
+#[cfg(not(testlib))]
 #[cfg(not(CONFIG_64BIT))]
 type isize_atomic_repr = i32;
 #[allow(non_camel_case_types)]
+#[cfg(not(testlib))]
 #[cfg(CONFIG_64BIT)]
 type isize_atomic_repr = i64;

+#[allow(non_camel_case_types)]
+#[cfg(testlib)]
+#[cfg(target_pointer_width = "32")]
+type isize_atomic_repr = i32;
+#[allow(non_camel_case_types)]
+#[cfg(testlib)]
+#[cfg(target_pointer_width = "64")]
+type isize_atomic_repr = i64;
+
 // Ensure size and alignment requirements are checked.
 static_assert!(size_of::<isize>() == size_of::<isize_atomic_repr>());
 static_assert!(align_of::<isize>() == align_of::<isize_atomic_repr>());

base-commit: a44bfed9df8a514962e2cb076d9c0b594caeff36
--
2.52.0

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

* Re: [PATCH] rust: sync: atomic: Provide stub for `rusttest` 32-bit hosts
  2026-01-23 23:34 [PATCH] rust: sync: atomic: Provide stub for `rusttest` 32-bit hosts Miguel Ojeda
@ 2026-01-25  6:04 ` Onur Özkan
  2026-01-25 14:23 ` Miguel Ojeda
  2026-01-26  3:09 ` Miguel Ojeda
  2 siblings, 0 replies; 5+ messages in thread
From: Onur Özkan @ 2026-01-25  6:04 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Will Deacon, Peter Zijlstra, Boqun Feng, Mark Rutland, Gary Guo,
	linux-kernel, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
	rust-for-linux, stable

On Sat, 24 Jan 2026 00:34:32 +0100
Miguel Ojeda <ojeda@kernel.org> wrote:

> For arm32, on a x86_64 builder, running the `rusttest` target yields:
> 
>     error[E0080]: evaluation of constant value failed
>       --> rust/kernel/static_assert.rs:37:23
>        |
>     37 |         const _: () = ::core::assert!($condition $(,$arg)?);
>        |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> the evaluated program panicked at 'assertion failed:
> size_of::<isize>() == size_of::<isize_atomic_repr>()',
> rust/kernel/sync/atomic/predefine.rs:68:1 | :::
> rust/kernel/sync/atomic/predefine.rs:68:1 | 68 |
> static_assert!(size_of::<isize>() == size_of::<isize_atomic_repr>());
> |
> --------------------------------------------------------------------
> in this macro invocation | = note: this error originates in the macro
> `::core::assert` which comes from the expansion of the macro
> `static_assert` (in Nightly builds, run with -Z macro-backtrace for
> more info)
> 
> The reason is that `rusttest` runs on the host, so for e.g. a x86_64
> builder `isize` is 64 bits but it is not a `CONFIG_64BIT` build.
> 
> Fix it by providing a stub for `rusttest` as usual.
> 
> Fixes: 84c6d36bcaf9 ("rust: sync: atomic: Add Atomic<{usize,isize}>")
> Cc: stable@vger.kernel.org
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
> ---
> I kept the `cfg`s separated instead of using `all` so that, when we
> get to remove this (since these tests will eventually be moved to
> KUnit), it will just be line deletions (and I find it easier to read,
> too).
> 
>  rust/kernel/sync/atomic/predefine.rs | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/rust/kernel/sync/atomic/predefine.rs
> b/rust/kernel/sync/atomic/predefine.rs index
> 45a17985cda4..0fca1ba3c2db 100644 ---
> a/rust/kernel/sync/atomic/predefine.rs +++
> b/rust/kernel/sync/atomic/predefine.rs @@ -35,12 +35,23 @@ fn
> rhs_into_delta(rhs: i64) -> i64 { // as `isize` and `usize`, and
> `isize` and `usize` are always bi-directional transmutable to //
> `isize_atomic_repr`, which also always implements `AtomicImpl`.
> #[allow(non_camel_case_types)] +#[cfg(not(testlib))]
>  #[cfg(not(CONFIG_64BIT))]
>  type isize_atomic_repr = i32;
>  #[allow(non_camel_case_types)]
> +#[cfg(not(testlib))]
>  #[cfg(CONFIG_64BIT)]
>  type isize_atomic_repr = i64;
> 
> +#[allow(non_camel_case_types)]
> +#[cfg(testlib)]
> +#[cfg(target_pointer_width = "32")]
> +type isize_atomic_repr = i32;
> +#[allow(non_camel_case_types)]
> +#[cfg(testlib)]
> +#[cfg(target_pointer_width = "64")]
> +type isize_atomic_repr = i64;
> +
>  // Ensure size and alignment requirements are checked.
>  static_assert!(size_of::<isize>() == size_of::<isize_atomic_repr>());
>  static_assert!(align_of::<isize>() ==
> align_of::<isize_atomic_repr>());
> 
> base-commit: a44bfed9df8a514962e2cb076d9c0b594caeff36
> --
> 2.52.0

Reviewed-by: Onur Özkan <work@onurozkan.dev>

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

* Re: [PATCH] rust: sync: atomic: Provide stub for `rusttest` 32-bit hosts
  2026-01-23 23:34 [PATCH] rust: sync: atomic: Provide stub for `rusttest` 32-bit hosts Miguel Ojeda
  2026-01-25  6:04 ` Onur Özkan
@ 2026-01-25 14:23 ` Miguel Ojeda
  2026-01-25 15:27   ` Boqun Feng
  2026-01-26  3:09 ` Miguel Ojeda
  2 siblings, 1 reply; 5+ messages in thread
From: Miguel Ojeda @ 2026-01-25 14:23 UTC (permalink / raw)
  To: Miguel Ojeda, Boqun Feng
  Cc: Will Deacon, Peter Zijlstra, Mark Rutland, Gary Guo, linux-kernel,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
	Trevor Gross, Danilo Krummrich, rust-for-linux, stable

On Sat, Jan 24, 2026 at 12:35 AM Miguel Ojeda <ojeda@kernel.org> wrote:
>
> For arm32, on a x86_64 builder, running the `rusttest` target yields:
>
>     error[E0080]: evaluation of constant value failed
>       --> rust/kernel/static_assert.rs:37:23
>        |
>     37 |         const _: () = ::core::assert!($condition $(,$arg)?);
>        |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'assertion failed: size_of::<isize>() == size_of::<isize_atomic_repr>()', rust/kernel/sync/atomic/predefine.rs:68:1
>        |
>       ::: rust/kernel/sync/atomic/predefine.rs:68:1
>        |
>     68 | static_assert!(size_of::<isize>() == size_of::<isize_atomic_repr>());
>        | -------------------------------------------------------------------- in this macro invocation
>        |
>        = note: this error originates in the macro `::core::assert` which comes from the expansion of the macro `static_assert` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> The reason is that `rusttest` runs on the host, so for e.g. a x86_64
> builder `isize` is 64 bits but it is not a `CONFIG_64BIT` build.
>
> Fix it by providing a stub for `rusttest` as usual.
>
> Fixes: 84c6d36bcaf9 ("rust: sync: atomic: Add Atomic<{usize,isize}>")
> Cc: stable@vger.kernel.org
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

Boqun et al.: in case it helps, I will send a fixes PR early this
week, so if you happen to want me to pick this one up with the rest,
please let me know.

Cheers,
Miguel

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

* Re: [PATCH] rust: sync: atomic: Provide stub for `rusttest` 32-bit hosts
  2026-01-25 14:23 ` Miguel Ojeda
@ 2026-01-25 15:27   ` Boqun Feng
  0 siblings, 0 replies; 5+ messages in thread
From: Boqun Feng @ 2026-01-25 15:27 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Miguel Ojeda, Will Deacon, Peter Zijlstra, Mark Rutland, Gary Guo,
	linux-kernel, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
	rust-for-linux, stable

On Sun, Jan 25, 2026 at 03:23:45PM +0100, Miguel Ojeda wrote:
> On Sat, Jan 24, 2026 at 12:35 AM Miguel Ojeda <ojeda@kernel.org> wrote:
> >
> > For arm32, on a x86_64 builder, running the `rusttest` target yields:
> >
> >     error[E0080]: evaluation of constant value failed
> >       --> rust/kernel/static_assert.rs:37:23
> >        |
> >     37 |         const _: () = ::core::assert!($condition $(,$arg)?);
> >        |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'assertion failed: size_of::<isize>() == size_of::<isize_atomic_repr>()', rust/kernel/sync/atomic/predefine.rs:68:1
> >        |
> >       ::: rust/kernel/sync/atomic/predefine.rs:68:1
> >        |
> >     68 | static_assert!(size_of::<isize>() == size_of::<isize_atomic_repr>());
> >        | -------------------------------------------------------------------- in this macro invocation
> >        |
> >        = note: this error originates in the macro `::core::assert` which comes from the expansion of the macro `static_assert` (in Nightly builds, run with -Z macro-backtrace for more info)
> >
> > The reason is that `rusttest` runs on the host, so for e.g. a x86_64
> > builder `isize` is 64 bits but it is not a `CONFIG_64BIT` build.
> >
> > Fix it by providing a stub for `rusttest` as usual.
> >
> > Fixes: 84c6d36bcaf9 ("rust: sync: atomic: Add Atomic<{usize,isize}>")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
> 
> Boqun et al.: in case it helps, I will send a fixes PR early this
> week, so if you happen to want me to pick this one up with the rest,

Thank you, that'll be great!

Acked-by: Boqun Feng <boqun.feng@gmail.com>

Regards,
Boqun

> please let me know.
> 
> Cheers,
> Miguel

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

* Re: [PATCH] rust: sync: atomic: Provide stub for `rusttest` 32-bit hosts
  2026-01-23 23:34 [PATCH] rust: sync: atomic: Provide stub for `rusttest` 32-bit hosts Miguel Ojeda
  2026-01-25  6:04 ` Onur Özkan
  2026-01-25 14:23 ` Miguel Ojeda
@ 2026-01-26  3:09 ` Miguel Ojeda
  2 siblings, 0 replies; 5+ messages in thread
From: Miguel Ojeda @ 2026-01-26  3:09 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Will Deacon, Peter Zijlstra, Boqun Feng, Mark Rutland, Gary Guo,
	linux-kernel, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
	rust-for-linux, stable

On Sat, Jan 24, 2026 at 12:35 AM Miguel Ojeda <ojeda@kernel.org> wrote:
>
> For arm32, on a x86_64 builder, running the `rusttest` target yields:
>
>     error[E0080]: evaluation of constant value failed
>       --> rust/kernel/static_assert.rs:37:23
>        |
>     37 |         const _: () = ::core::assert!($condition $(,$arg)?);
>        |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'assertion failed: size_of::<isize>() == size_of::<isize_atomic_repr>()', rust/kernel/sync/atomic/predefine.rs:68:1
>        |
>       ::: rust/kernel/sync/atomic/predefine.rs:68:1
>        |
>     68 | static_assert!(size_of::<isize>() == size_of::<isize_atomic_repr>());
>        | -------------------------------------------------------------------- in this macro invocation
>        |
>        = note: this error originates in the macro `::core::assert` which comes from the expansion of the macro `static_assert` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> The reason is that `rusttest` runs on the host, so for e.g. a x86_64
> builder `isize` is 64 bits but it is not a `CONFIG_64BIT` build.
>
> Fix it by providing a stub for `rusttest` as usual.
>
> Fixes: 84c6d36bcaf9 ("rust: sync: atomic: Add Atomic<{usize,isize}>")
> Cc: stable@vger.kernel.org
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

Applied to `rust-fixes`-- thanks everyone!

Cheers,
Miguel

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

end of thread, other threads:[~2026-01-26  3:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-23 23:34 [PATCH] rust: sync: atomic: Provide stub for `rusttest` 32-bit hosts Miguel Ojeda
2026-01-25  6:04 ` Onur Özkan
2026-01-25 14:23 ` Miguel Ojeda
2026-01-25 15:27   ` Boqun Feng
2026-01-26  3:09 ` Miguel Ojeda

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