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(_TRACE_MODULE_H) || defined(TRACE_HEADER_MULTI_READ)
15 #define _TRACE_MODULE_H
17 #include <linux/tracepoint.h>
23 #define show_module_flags(flags) __print_flags(flags, "", \
24 { (1UL << TAINT_PROPRIETARY_MODULE), "P" }, \
25 { (1UL << TAINT_FORCED_MODULE), "F" }, \
26 { (1UL << TAINT_CRAP), "C" })
28 TRACE_EVENT(module_load
,
30 TP_PROTO(struct module
*mod
),
35 __field( unsigned int, taints
)
36 __string( name
, mod
->name
)
40 __entry
->taints
= mod
->taints
;
41 __assign_str(name
, mod
->name
);
44 TP_printk("%s %s", __get_str(name
), show_module_flags(__entry
->taints
))
47 TRACE_EVENT(module_free
,
49 TP_PROTO(struct module
*mod
),
54 __string( name
, mod
->name
)
58 __assign_str(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 DECLARE_EVENT_CLASS(module_refcnt
,
69 TP_PROTO(struct module
*mod
, unsigned long ip
),
74 __field( unsigned long, ip
)
75 __field( int, refcnt
)
76 __string( name
, mod
->name
)
81 __entry
->refcnt
= __this_cpu_read(mod
->refptr
->incs
) + __this_cpu_read(mod
->refptr
->decs
);
82 __assign_str(name
, mod
->name
);
85 TP_printk("%s call_site=%pf refcnt=%d",
86 __get_str(name
), (void *)__entry
->ip
, __entry
->refcnt
)
89 DEFINE_EVENT(module_refcnt
, module_get
,
91 TP_PROTO(struct module
*mod
, unsigned long ip
),
96 DEFINE_EVENT(module_refcnt
, module_put
,
98 TP_PROTO(struct module
*mod
, unsigned long ip
),
102 #endif /* CONFIG_MODULE_UNLOAD */
104 TRACE_EVENT(module_request
,
106 TP_PROTO(char *name
, bool wait
, unsigned long ip
),
108 TP_ARGS(name
, wait
, ip
),
111 __field( unsigned long, ip
)
112 __field( bool, wait
)
113 __string( name
, name
)
118 __entry
->wait
= wait
;
119 __assign_str(name
, name
);
122 TP_printk("%s wait=%d call_site=%pf",
123 __get_str(name
), (int)__entry
->wait
, (void *)__entry
->ip
)
126 #endif /* CONFIG_MODULES */
128 #endif /* _TRACE_MODULE_H */
130 /* This part must be outside protection */
131 #include <trace/define_trace.h>
This page took 0.066877 seconds and 4 git commands to generate.