From nobody Sat Feb 7 14:34:22 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 816422A1BA; Fri, 23 Jan 2026 23:35:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769211300; cv=none; b=jqTce2wDz5TaR7OETVBtoW2AXeMwJLOj87i5aqeFVqPeUDsTGvNXZ3GuNcdROx439i5a9f5okopKHcDgYvDTw9nUr22edB0W2haxsSLWQaKnljZ2KE+6RK/A6fqHr2nO8Yd5JHVDjSBQDjuS4fafad//Foo4fnmkg0zoHbUZ7Ds= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769211300; c=relaxed/simple; bh=u+/URG18L0dtZ2a2AJ1vvUt3ELVMjVvOX9jgyRTfNHs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=FUGn/DYm5IEhOhfkv96xdX73IOCtFO86+PubFqXp4Zac+a3Uuv6PsO2bk06Bu9RbkAnhF9Eik2x1c1b+xzg2a/dL2ph+nS7KRkLuN81DpeKENWkl3PbkmpZTiQaQmrt30uaWmRDFith6jUPf+x7tLYmPpqxnmcbDO+9x4GO668w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QmbUUTqi; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="QmbUUTqi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB5D8C4CEF1; Fri, 23 Jan 2026 23:34:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1769211300; bh=u+/URG18L0dtZ2a2AJ1vvUt3ELVMjVvOX9jgyRTfNHs=; h=From:To:Cc:Subject:Date:From; b=QmbUUTqiMwfQfB/G6S+QNPb+/6sYMJG1NiniwoyHpam8GvuaM06470cBFME5h6vtJ eKzF0tF2i7sWbeghKEeBxPRfTDdhnISnvZYzYpqpEcYWT20iF/SjrzvanZAIp/jlqp hITJnWmHAnKscrTI0h7BAQ32W/q62HgYRj1YAD0jOCaLw3Fnb5bt8W3i1p+N2TVk8F SFrb/a/aAvHJW73hcX4mWjzWDu9PrBr+l/eOgqq8UU1cxIDr4orc46mmP+xNDKcv21 YILrMqe7GycdnJixaLk2kTSxhrlHq2cPbIbj44vvkV9ueWpPW7jcgpS90JLobZ8W8b 2ybebzhM0DyrQ== From: Miguel Ojeda To: Will Deacon , Peter Zijlstra , Boqun Feng , Miguel Ojeda Cc: Mark Rutland , Gary Guo , linux-kernel@vger.kernel.org, =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , rust-for-linux@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH] rust: sync: atomic: Provide stub for `rusttest` 32-bit hosts Date: Sat, 24 Jan 2026 00:34:32 +0100 Message-ID: <20260123233432.22703-1-ojeda@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 _: () =3D ::core::assert!($condition $(,$arg)?); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the ev= aluated program panicked at 'assertion failed: size_of::() =3D=3D si= ze_of::()', rust/kernel/sync/atomic/predefine.rs:68:1 | ::: rust/kernel/sync/atomic/predefine.rs:68:1 | 68 | static_assert!(size_of::() =3D=3D size_of::()); | ------------------------------------------------------------------= -- in this macro invocation | =3D note: this error originates in the macro `::core::assert` which = comes from the expansion of the macro `static_assert` (in Nightly builds, r= un 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 Acked-by: Boqun Feng Reviewed-by: Onur =C3=96zkan --- 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-direction= al 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 =3D i32; #[allow(non_camel_case_types)] +#[cfg(not(testlib))] #[cfg(CONFIG_64BIT)] type isize_atomic_repr =3D i64; +#[allow(non_camel_case_types)] +#[cfg(testlib)] +#[cfg(target_pointer_width =3D "32")] +type isize_atomic_repr =3D i32; +#[allow(non_camel_case_types)] +#[cfg(testlib)] +#[cfg(target_pointer_width =3D "64")] +type isize_atomic_repr =3D i64; + // Ensure size and alignment requirements are checked. static_assert!(size_of::() =3D=3D size_of::()); static_assert!(align_of::() =3D=3D align_of::()); base-commit: a44bfed9df8a514962e2cb076d9c0b594caeff36 -- 2.52.0