Re: [PATCH v6 1/5] rust: add generic static_key_false

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 08 Aug 2024 17:23:37 +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.
> 
> This patch only provides a generic implementation without code patching
> (matching the one used when CONFIG_JUMP_LABEL is disabled). Later
> patches add support for inline asm implementations that use runtime
> patching.
> 
> When CONFIG_JUMP_LABEL is unset, `static_key_count` is a static inline
> function, so a Rust helper is defined for `static_key_count` in this
> case. If Rust is compiled with LTO, this call should get inlined. The
> helper can be eliminated once we have the necessary inline asm to make
> atomic operations from Rust.
> 
> Signed-off-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
> ---
>  rust/bindings/bindings_helper.h       |  1 +
>  rust/helpers.c                        |  9 +++++++++
>  rust/kernel/arch_static_branch_asm.rs |  1 +
>  rust/kernel/jump_label.rs             | 29 +++++++++++++++++++++++++++++
>  rust/kernel/lib.rs                    |  1 +
>  5 files changed, 41 insertions(+)
> 
> diff --git a/rust/kernel/arch_static_branch_asm.rs b/rust/kernel/arch_static_branch_asm.rs
> new file mode 100644
> index 000000000000..958f1f130455
> --- /dev/null
> +++ b/rust/kernel/arch_static_branch_asm.rs
> @@ -0,0 +1 @@
> +::kernel::concat_literals!("1: jmp " "{l_yes}" " # objtool NOPs this \n\t" ".pushsection __jump_table,  \"aw\" \n\t" " " ".balign 8" " " "\n\t" ".long 1b - . \n\t" ".long " "{l_yes}" "- . \n\t" " " ".quad" " " " " "{symb} + {off} + {branch}" " - . \n\t" ".popsection \n\t")


I believe this file is included by mistake, given it's added to
gitignore in patch 5.

Best,
Gary




[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux