Re: [PATCH v6] rust: add global lock support

From: Miguel Ojeda
Date: Sun Nov 10 2024 - 19:14:50 EST


On Wed, Oct 23, 2024 at 3:23 PM Alice Ryhl <aliceryhl@xxxxxxxxxx> wrote:
>
> Add support for creating global variables that are wrapped in a mutex or
> spinlock.
>
> The implementation here is intended to replace the global mutex
> workaround found in the Rust Binder RFC [1]. In both cases, the global
> lock must be initialized before first use. The macro is unsafe to use
> for the same reason.
>
> The separate initialization step is required because it is tricky to
> access the value of __ARCH_SPIN_LOCK_UNLOCKED from Rust. Doing so will
> require changes to the C side. That change will happen as a follow-up to
> this patch.
>
> Link: https://lore.kernel.org/rust-for-linux/20231101-rust-binder-v1-2-08ba9197f637@xxxxxxxxxx/#Z31drivers:android:context.rs [1]
> Signed-off-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>

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

[ Simplified a few intra-doc links. Formatted a few comments. Reworded
title. - Miguel ]

Cheers,
Miguel