Commit | Line | Data |
---|---|---|
b7cdc182 | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
b283666f PW |
2 | /* |
3 | * Because linux/module.h has tracepoints in the header, and ftrace.h | |
4 | * eventually includes this file, define_trace.h includes linux/module.h | |
5 | * But we do not want the module.h to override the TRACE_SYSTEM macro | |
6 | * variable that define_trace.h is processing, so we only set it | |
7 | * when module events are being processed, which would happen when | |
8 | * CREATE_TRACE_POINTS is defined. | |
9 | */ | |
10 | #ifdef CREATE_TRACE_POINTS | |
11 | #undef TRACE_SYSTEM | |
12 | #define TRACE_SYSTEM module | |
13 | #endif | |
14 | ||
3bc29f0a MD |
15 | #if !defined(LTTNG_TRACE_MODULE_H) || defined(TRACE_HEADER_MULTI_READ) |
16 | #define LTTNG_TRACE_MODULE_H | |
b283666f | 17 | |
6ec43db8 | 18 | #include <probes/lttng-tracepoint-event.h> |
b283666f PW |
19 | |
20 | #ifdef CONFIG_MODULES | |
21 | ||
22 | #ifndef _TRACE_MODULE_DEF | |
23 | #define _TRACE_MODULE_DEF | |
24 | struct module; | |
25 | ||
b283666f PW |
26 | #endif |
27 | ||
3bc29f0a | 28 | LTTNG_TRACEPOINT_EVENT(module_load, |
b283666f PW |
29 | |
30 | TP_PROTO(struct module *mod), | |
31 | ||
32 | TP_ARGS(mod), | |
33 | ||
f127e61e MD |
34 | TP_FIELDS( |
35 | ctf_integer(unsigned int, taints, mod->taints) | |
36 | ctf_string(name, mod->name) | |
37 | ) | |
b283666f PW |
38 | ) |
39 | ||
3bc29f0a | 40 | LTTNG_TRACEPOINT_EVENT(module_free, |
b283666f PW |
41 | |
42 | TP_PROTO(struct module *mod), | |
43 | ||
44 | TP_ARGS(mod), | |
45 | ||
f127e61e MD |
46 | TP_FIELDS( |
47 | ctf_string(name, mod->name) | |
48 | ) | |
b283666f PW |
49 | ) |
50 | ||
51 | #ifdef CONFIG_MODULE_UNLOAD | |
52 | /* trace_module_get/put are only used if CONFIG_MODULE_UNLOAD is defined */ | |
53 | ||
3bc29f0a | 54 | LTTNG_TRACEPOINT_EVENT_CLASS(module_refcnt, |
b283666f PW |
55 | |
56 | TP_PROTO(struct module *mod, unsigned long ip), | |
57 | ||
58 | TP_ARGS(mod, ip), | |
59 | ||
f127e61e | 60 | TP_FIELDS( |
2c054599 | 61 | ctf_integer_hex(unsigned long, ip, ip) |
f127e61e | 62 | ctf_integer(int, refcnt, atomic_read(&mod->refcnt)) |
f127e61e MD |
63 | ctf_string(name, mod->name) |
64 | ) | |
b283666f PW |
65 | ) |
66 | ||
3bc29f0a | 67 | LTTNG_TRACEPOINT_EVENT_INSTANCE(module_refcnt, module_get, |
b283666f PW |
68 | |
69 | TP_PROTO(struct module *mod, unsigned long ip), | |
70 | ||
71 | TP_ARGS(mod, ip) | |
72 | ) | |
73 | ||
3bc29f0a | 74 | LTTNG_TRACEPOINT_EVENT_INSTANCE(module_refcnt, module_put, |
b283666f PW |
75 | |
76 | TP_PROTO(struct module *mod, unsigned long ip), | |
77 | ||
78 | TP_ARGS(mod, ip) | |
79 | ) | |
80 | #endif /* CONFIG_MODULE_UNLOAD */ | |
81 | ||
3bc29f0a | 82 | LTTNG_TRACEPOINT_EVENT(module_request, |
b283666f PW |
83 | |
84 | TP_PROTO(char *name, bool wait, unsigned long ip), | |
85 | ||
86 | TP_ARGS(name, wait, ip), | |
87 | ||
f127e61e | 88 | TP_FIELDS( |
2c054599 | 89 | ctf_integer_hex(unsigned long, ip, ip) |
f127e61e MD |
90 | ctf_integer(bool, wait, wait) |
91 | ctf_string(name, name) | |
92 | ) | |
b283666f PW |
93 | ) |
94 | ||
95 | #endif /* CONFIG_MODULES */ | |
96 | ||
3bc29f0a | 97 | #endif /* LTTNG_TRACE_MODULE_H */ |
b283666f PW |
98 | |
99 | /* This part must be outside protection */ | |
6ec43db8 | 100 | #include <probes/define_trace.h> |