File tree Expand file tree Collapse file tree 6 files changed +61
-1
lines changed Expand file tree Collapse file tree 6 files changed +61
-1
lines changed Original file line number Diff line number Diff line change @@ -20223,6 +20223,7 @@ C: zulip://rust-for-linux.zulipchat.com
20223
20223
P: https://rust-for-linux.com/contributing
20224
20224
T: git https://github.com/Rust-for-Linux/linux.git rust-next
20225
20225
F: Documentation/rust/
20226
+ F: include/trace/events/rust_sample.h
20226
20227
F: rust/
20227
20228
F: samples/rust/
20228
20229
F: scripts/*rust*
Original file line number Diff line number Diff line change
1
+ /* SPDX-License-Identifier: GPL-2.0-only */
2
+ /*
3
+ * Tracepoints for `samples/rust/rust_print.rs`.
4
+ *
5
+ * Copyright (C) 2024 Google, Inc.
6
+ */
7
+
8
+ #undef TRACE_SYSTEM
9
+ #define TRACE_SYSTEM rust_sample
10
+
11
+ #if !defined(_RUST_SAMPLE_TRACE_H ) || defined(TRACE_HEADER_MULTI_READ )
12
+ #define _RUST_SAMPLE_TRACE_H
13
+
14
+ #include <linux/tracepoint.h>
15
+
16
+ TRACE_EVENT (rust_sample_loaded ,
17
+ TP_PROTO (int magic_number ),
18
+ TP_ARGS (magic_number ),
19
+ TP_STRUCT__entry (
20
+ __field (int , magic_number )
21
+ ),
22
+ TP_fast_assign (
23
+ __entry -> magic_number = magic_number ;
24
+ ),
25
+ TP_printk ("magic=%d" , __entry -> magic_number )
26
+ );
27
+
28
+ #endif /* _RUST_SAMPLE_TRACE_H */
29
+
30
+ /* This part must be outside protection */
31
+ #include <trace/define_trace.h>
Original file line number Diff line number Diff line change 23
23
#include <linux/tracepoint.h>
24
24
#include <linux/wait.h>
25
25
#include <linux/workqueue.h>
26
+ #include <trace/events/rust_sample.h>
26
27
27
28
/* `bindgen` gets confused at certain things. */
28
29
const size_t RUST_CONST_HELPER_ARCH_SLAB_MINALIGN = ARCH_SLAB_MINALIGN ;
Original file line number Diff line number Diff line change 1
1
# SPDX-License-Identifier: GPL-2.0
2
+ ccflags-y += -I$(src ) # needed for trace events
2
3
3
4
obj-$(CONFIG_SAMPLE_RUST_MINIMAL) += rust_minimal.o
4
- obj-$(CONFIG_SAMPLE_RUST_PRINT) += rust_print.o
5
+ obj-$(CONFIG_SAMPLE_RUST_PRINT) += rust_print.o rust_print_events.o
5
6
6
7
subdir-$(CONFIG_SAMPLE_RUST_HOSTPROGS) += hostprogs
Original file line number Diff line number Diff line change @@ -69,6 +69,8 @@ impl kernel::Module for RustPrint {
69
69
70
70
arc_print ( ) ?;
71
71
72
+ trace:: trace_rust_sample_loaded ( 42 ) ;
73
+
72
74
Ok ( RustPrint )
73
75
}
74
76
}
@@ -78,3 +80,19 @@ impl Drop for RustPrint {
78
80
pr_info ! ( "Rust printing macros sample (exit)\n " ) ;
79
81
}
80
82
}
83
+
84
+ mod trace {
85
+ use core:: ffi:: c_int;
86
+
87
+ kernel:: declare_trace! {
88
+ /// # Safety
89
+ ///
90
+ /// Always safe to call.
91
+ unsafe fn rust_sample_loaded( magic: c_int) ;
92
+ }
93
+
94
+ pub ( crate ) fn trace_rust_sample_loaded ( magic : i32 ) {
95
+ // SAFETY: Always safe to call.
96
+ unsafe { rust_sample_loaded ( magic as c_int ) }
97
+ }
98
+ }
Original file line number Diff line number Diff line change
1
+ // SPDX-License-Identifier: GPL-2.0-only
2
+ /*
3
+ * Copyright 2024 Google LLC
4
+ */
5
+
6
+ #define CREATE_TRACE_POINTS
7
+ #define CREATE_RUST_TRACE_POINTS
8
+ #include <trace/events/rust_sample.h>
You can’t perform that action at this time.
0 commit comments