Re: [PATCH v4 1/2] rust: add static_key_false
From: Gary Guo <gary@garyguo.net>
Date: 2024-07-30 10:20:19
Also in:
linux-arch, linux-riscv, lkml, loongarch, rust-for-linux
From: Gary Guo <gary@garyguo.net>
Date: 2024-07-30 10:20:19
Also in:
linux-arch, linux-riscv, lkml, loongarch, rust-for-linux
On Fri, 28 Jun 2024 13:23:31 +0000 Alice Ryhl [off-list ref] 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@google.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
--- 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(-)