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 __field( unsigned int, taints
)
36 __string( name
, mod
->name
)
40 tp_assign(taints
, mod
->taints
)
41 tp_strcpy(name
, mod
->name
)
44 TP_printk("%s %s", __get_str(name
), show_module_flags(__entry
->taints
))
47 LTTNG_TRACEPOINT_EVENT(module_free
,
49 TP_PROTO(struct module
*mod
),
54 __string( name
, mod
->name
)
58 tp_strcpy(name
, mod
->name
)
61 TP_printk("%s", __get_str(name
))
64 #ifdef CONFIG_MODULE_UNLOAD
65 /* trace_module_get/put are only used if CONFIG_MODULE_UNLOAD is defined */
67 LTTNG_TRACEPOINT_EVENT_CLASS(module_refcnt
,
69 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
70 TP_PROTO(struct module
*mod
, unsigned long ip
),
74 TP_PROTO(struct module
*mod
, unsigned long ip
, int refcnt
),
76 TP_ARGS(mod
, ip
, refcnt
),
80 __field( unsigned long, ip
)
81 __field( int, refcnt
)
82 __string( name
, mod
->name
)
87 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0))
88 tp_assign(refcnt
, atomic_read(&mod
->refcnt
))
89 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
90 tp_assign(refcnt
, __this_cpu_read(mod
->refptr
->incs
) + __this_cpu_read(mod
->refptr
->decs
))
92 tp_assign(refcnt
, refcnt
)
94 tp_strcpy(name
, mod
->name
)
97 TP_printk("%s call_site=%pf refcnt=%d",
98 __get_str(name
), (void *)__entry
->ip
, __entry
->refcnt
)
101 LTTNG_TRACEPOINT_EVENT_INSTANCE(module_refcnt
, module_get
,
103 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
104 TP_PROTO(struct module
*mod
, unsigned long ip
),
108 TP_PROTO(struct module
*mod
, unsigned long ip
, int refcnt
),
110 TP_ARGS(mod
, ip
, refcnt
)
114 LTTNG_TRACEPOINT_EVENT_INSTANCE(module_refcnt
, module_put
,
116 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
117 TP_PROTO(struct module
*mod
, unsigned long ip
),
121 TP_PROTO(struct module
*mod
, unsigned long ip
, int refcnt
),
123 TP_ARGS(mod
, ip
, refcnt
)
126 #endif /* CONFIG_MODULE_UNLOAD */
128 LTTNG_TRACEPOINT_EVENT(module_request
,
130 TP_PROTO(char *name
, bool wait
, unsigned long ip
),
132 TP_ARGS(name
, wait
, ip
),
135 __field( unsigned long, ip
)
136 __field( bool, wait
)
137 __string( name
, name
)
142 tp_assign(wait
, wait
)
143 tp_strcpy(name
, name
)
146 TP_printk("%s wait=%d call_site=%pf",
147 __get_str(name
), (int)__entry
->wait
, (void *)__entry
->ip
)
150 #endif /* CONFIG_MODULES */
152 #endif /* LTTNG_TRACE_MODULE_H */
154 /* This part must be outside protection */
155 #include "../../../probes/define_trace.h"
This page took 0.032535 seconds and 5 git commands to generate.