Re: [PATCH v4 1/2] rust: add static_key_false

From: Gary Guo
Date: Tue Jul 30 2024 - 06:20:30 EST


On Fri, 28 Jun 2024 13:23:31 +0000
Alice Ryhl <aliceryhl@xxxxxxxxxx> wrote:

> Add just enough support for static key so that we can use it from
> tracepoints. Tracepoints rely on `static_key_false` even though it is
> deprecated, so we add the same functionality to Rust.
>
> It is not possible to use the existing C implementation of
> arch_static_branch because it passes the argument `key` to inline
> assembly as an 'i' parameter, so any attempt to add a C helper for this
> function will fail to compile because the value of `key` must be known
> at compile-time.
>
> Signed-off-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>

Reviewed-by: Gary Guo <gary@xxxxxxxxxxx>

> ---
> rust/kernel/arch/arm64/jump_label.rs | 34 ++++++++++++++++++++++++++++
> rust/kernel/arch/loongarch/jump_label.rs | 35 +++++++++++++++++++++++++++++
> rust/kernel/arch/mod.rs | 24 ++++++++++++++++++++
> rust/kernel/arch/riscv/jump_label.rs | 38 ++++++++++++++++++++++++++++++++
> rust/kernel/arch/x86/jump_label.rs | 35 +++++++++++++++++++++++++++++
> rust/kernel/lib.rs | 2 ++
> rust/kernel/static_key.rs | 32 +++++++++++++++++++++++++++
> scripts/Makefile.build | 2 +-
> 8 files changed, 201 insertions(+), 1 deletion(-)