1 /* SPDX-License-Identifier: GPL-2.0 */
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.
10 #ifdef CREATE_TRACE_POINTS
12 #define TRACE_SYSTEM module
15 #if !defined(LTTNG_TRACE_MODULE_H) || defined(TRACE_HEADER_MULTI_READ)
16 #define LTTNG_TRACE_MODULE_H
18 #include <probes/lttng-tracepoint-event.h>
19 #include <linux/version.h>
23 #ifndef _TRACE_MODULE_DEF
24 #define _TRACE_MODULE_DEF
29 LTTNG_TRACEPOINT_EVENT(module_load
,
31 TP_PROTO(struct module
*mod
),
36 ctf_integer(unsigned int, taints
, mod
->taints
)
37 ctf_string(name
, mod
->name
)
41 LTTNG_TRACEPOINT_EVENT(module_free
,
43 TP_PROTO(struct module
*mod
),
48 ctf_string(name
, mod
->name
)
52 #ifdef CONFIG_MODULE_UNLOAD
53 /* trace_module_get/put are only used if CONFIG_MODULE_UNLOAD is defined */
55 LTTNG_TRACEPOINT_EVENT_CLASS(module_refcnt
,
57 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
58 TP_PROTO(struct module
*mod
, unsigned long ip
),
62 TP_PROTO(struct module
*mod
, unsigned long ip
, int refcnt
),
64 TP_ARGS(mod
, ip
, refcnt
),
68 ctf_integer(unsigned long, ip
, ip
)
69 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0))
70 ctf_integer(int, refcnt
, atomic_read(&mod
->refcnt
))
71 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
72 ctf_integer(int, refcnt
, __this_cpu_read(mod
->refptr
->incs
) + __this_cpu_read(mod
->refptr
->decs
))
74 ctf_integer(int, refcnt
, refcnt
)
76 ctf_string(name
, mod
->name
)
80 LTTNG_TRACEPOINT_EVENT_INSTANCE(module_refcnt
, module_get
,
82 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
83 TP_PROTO(struct module
*mod
, unsigned long ip
),
87 TP_PROTO(struct module
*mod
, unsigned long ip
, int refcnt
),
89 TP_ARGS(mod
, ip
, refcnt
)
93 LTTNG_TRACEPOINT_EVENT_INSTANCE(module_refcnt
, module_put
,
95 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
96 TP_PROTO(struct module
*mod
, unsigned long ip
),
100 TP_PROTO(struct module
*mod
, unsigned long ip
, int refcnt
),
102 TP_ARGS(mod
, ip
, refcnt
)
105 #endif /* CONFIG_MODULE_UNLOAD */
107 LTTNG_TRACEPOINT_EVENT(module_request
,
109 TP_PROTO(char *name
, bool wait
, unsigned long ip
),
111 TP_ARGS(name
, wait
, ip
),
114 ctf_integer(unsigned long, ip
, ip
)
115 ctf_integer(bool, wait
, wait
)
116 ctf_string(name
, name
)
120 #endif /* CONFIG_MODULES */
122 #endif /* LTTNG_TRACE_MODULE_H */
124 /* This part must be outside protection */
125 #include <probes/define_trace.h>
This page took 0.069046 seconds and 5 git commands to generate.