diff options
author | Alice Ryhl <[email protected]> | 2024-10-30 16:04:26 +0000 |
---|---|---|
committer | Steven Rostedt (Google) <[email protected]> | 2024-11-04 16:21:44 -0500 |
commit | 91d39024e1b02914cc5e2dbc137908e29b269ce4 (patch) | |
tree | 19306232d5a35c6aa694aca3c6d0bf5a1b3d8f68 /samples/rust/rust_print.rs | |
parent | ad37bcd965fda43f34cf5cc051f5d310880bd1e7 (diff) |
rust: samples: add tracepoint to Rust sample
This updates the Rust printing sample to invoke a tracepoint. This
ensures that we have a user in-tree from the get-go even though the
patch is being merged before its real user.
Cc: Masami Hiramatsu <[email protected]>
Cc: Mathieu Desnoyers <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Josh Poimboeuf <[email protected]>
Cc: Jason Baron <[email protected]>
Cc: Ard Biesheuvel <[email protected]>
Cc: Miguel Ojeda <[email protected]>
Cc: Alex Gaynor <[email protected]>
Cc: Wedson Almeida Filho <[email protected]>
Cc: Gary Guo <[email protected]>
Cc: " =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= " <[email protected]>
Cc: Benno Lossin <[email protected]>
Cc: Andreas Hindborg <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: Sean Christopherson <[email protected]>
Cc: Uros Bizjak <[email protected]>
Cc: Catalin Marinas <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: Marc Zyngier <[email protected]>
Cc: Oliver Upton <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Ryan Roberts <[email protected]>
Cc: Fuad Tabba <[email protected]>
Cc: Paul Walmsley <[email protected]>
Cc: Palmer Dabbelt <[email protected]>
Cc: Albert Ou <[email protected]>
Cc: Anup Patel <[email protected]>
Cc: Andrew Jones <[email protected]>
Cc: Alexandre Ghiti <[email protected]>
Cc: Conor Dooley <[email protected]>
Cc: Samuel Holland <[email protected]>
Cc: Huacai Chen <[email protected]>
Cc: WANG Xuerui <[email protected]>
Cc: Bibo Mao <[email protected]>
Cc: Tiezhu Yang <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Tianrui Zhao <[email protected]>
Link: https://lore.kernel.org/[email protected]
Reviewed-by: Boqun Feng <[email protected]>
Signed-off-by: Alice Ryhl <[email protected]>
Signed-off-by: Steven Rostedt (Google) <[email protected]>
Diffstat (limited to 'samples/rust/rust_print.rs')
-rw-r--r-- | samples/rust/rust_print.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/samples/rust/rust_print.rs b/samples/rust/rust_print.rs index 6eabb0d79ea3..6d14b08cac1c 100644 --- a/samples/rust/rust_print.rs +++ b/samples/rust/rust_print.rs @@ -69,6 +69,8 @@ impl kernel::Module for RustPrint { arc_print()?; + trace::trace_rust_sample_loaded(42); + Ok(RustPrint) } } @@ -78,3 +80,19 @@ impl Drop for RustPrint { pr_info!("Rust printing macros sample (exit)\n"); } } + +mod trace { + use core::ffi::c_int; + + kernel::declare_trace! { + /// # Safety + /// + /// Always safe to call. + unsafe fn rust_sample_loaded(magic: c_int); + } + + pub(crate) fn trace_rust_sample_loaded(magic: i32) { + // SAFETY: Always safe to call. + unsafe { rust_sample_loaded(magic as c_int) } + } +} |