[PATCH v6 2/5] rust: add tracepoint support
Gary Guo
gary at garyguo.net
Fri Aug 9 11:20:43 PDT 2024
On Thu, 08 Aug 2024 17:23:38 +0000
Alice Ryhl <aliceryhl at google.com> wrote:
> Make it possible to have Rust code call into tracepoints defined by C
> code. It is still required that the tracepoint is declared in a C
> header, and that this header is included in the input to bindgen.
>
> Instead of calling __DO_TRACE directly, the exported rust_do_trace_
> function calls an inline helper function. This is because the `cond`
> argument does not exist at the callsite of DEFINE_RUST_DO_TRACE.
>
> __DECLARE_TRACE always emits an inline static and an extern declaration
> that is only used when CREATE_RUST_TRACE_POINTS is set. These should not
> end up in the final binary so it is not a problem that they sometimes
> are emitted without a user.
>
> Reviewed-by: Carlos Llamas <cmllamas at google.com>
> Signed-off-by: Alice Ryhl <aliceryhl at google.com>
Reviewed-by: Gary Guo <gary at garyguo.net>
> ---
> include/linux/tracepoint.h | 22 +++++++++++++++++-
> include/trace/define_trace.h | 12 ++++++++++
> rust/bindings/bindings_helper.h | 1 +
> rust/kernel/lib.rs | 1 +
> rust/kernel/tracepoint.rs | 49 +++++++++++++++++++++++++++++++++++++++++
> 5 files changed, 84 insertions(+), 1 deletion(-)
More information about the linux-riscv
mailing list