2 * Because linux/module.h has tracepoints in the header, and ftrace.h
3 * eventually includes this file, define_trace.h includes linux/module.h
4 * But we do not want the module.h to override the TRACE_SYSTEM macro
5 * variable that define_trace.h is processing, so we only set it
6 * when module events are being processed, which would happen when
7 * CREATE_TRACE_POINTS is defined.
9 #ifdef CREATE_TRACE_POINTS
11 #define TRACE_SYSTEM module
14 #if !defined(LTTNG_TRACE_MODULE_H) || defined(TRACE_HEADER_MULTI_READ)
15 #define LTTNG_TRACE_MODULE_H
17 #include <probes/lttng-tracepoint-event.h>
18 #include <linux/version.h>
22 #ifndef _TRACE_MODULE_DEF
23 #define _TRACE_MODULE_DEF
28 LTTNG_TRACEPOINT_EVENT(module_load
,
30 TP_PROTO(struct module
*mod
),
35 ctf_integer(unsigned int, taints
, mod
->taints
)
36 ctf_string(name
, mod
->name
)
40 LTTNG_TRACEPOINT_EVENT(module_free
,
42 TP_PROTO(struct module
*mod
),
47 ctf_string(name
, mod
->name
)
51 #ifdef CONFIG_MODULE_UNLOAD
52 /* trace_module_get/put are only used if CONFIG_MODULE_UNLOAD is defined */
54 LTTNG_TRACEPOINT_EVENT_CLASS(module_refcnt
,
56 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
57 TP_PROTO(struct module
*mod
, unsigned long ip
),
61 TP_PROTO(struct module
*mod
, unsigned long ip
, int refcnt
),
63 TP_ARGS(mod
, ip
, refcnt
),
67 ctf_integer(unsigned long, ip
, ip
)
68 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0))
69 ctf_integer(int, refcnt
, atomic_read(&mod
->refcnt
))
70 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
71 ctf_integer(int, refcnt
, __this_cpu_read(mod
->refptr
->incs
) + __this_cpu_read(mod
->refptr
->decs
))
73 ctf_integer(int, refcnt
, refcnt
)
75 ctf_string(name
, mod
->name
)
79 LTTNG_TRACEPOINT_EVENT_INSTANCE(module_refcnt
, module_get
,
81 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
82 TP_PROTO(struct module
*mod
, unsigned long ip
),
86 TP_PROTO(struct module
*mod
, unsigned long ip
, int refcnt
),
88 TP_ARGS(mod
, ip
, refcnt
)
92 LTTNG_TRACEPOINT_EVENT_INSTANCE(module_refcnt
, module_put
,
94 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
95 TP_PROTO(struct module
*mod
, unsigned long ip
),
99 TP_PROTO(struct module
*mod
, unsigned long ip
, int refcnt
),
101 TP_ARGS(mod
, ip
, refcnt
)
104 #endif /* CONFIG_MODULE_UNLOAD */
106 LTTNG_TRACEPOINT_EVENT(module_request
,
108 TP_PROTO(char *name
, bool wait
, unsigned long ip
),
110 TP_ARGS(name
, wait
, ip
),
113 ctf_integer(unsigned long, ip
, ip
)
114 ctf_integer(bool, wait
, wait
)
115 ctf_string(name
, name
)
119 #endif /* CONFIG_MODULES */
121 #endif /* LTTNG_TRACE_MODULE_H */
123 /* This part must be outside protection */
124 #include <probes/define_trace.h>
This page took 0.038645 seconds and 4 git commands to generate.