2 #define TRACE_SYSTEM module
4 #if !defined(_TRACE_MODULE_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_MODULE_H
7 #include <linux/tracepoint.h>
13 #define show_module_flags(flags) __print_flags(flags, "", \
14 { (1UL << TAINT_PROPRIETARY_MODULE), "P" }, \
15 { (1UL << TAINT_FORCED_MODULE), "F" }, \
16 { (1UL << TAINT_CRAP), "C" })
18 TRACE_EVENT(module_load
,
20 TP_PROTO(struct module
*mod
),
25 __field( unsigned int, taints
)
26 __string( name
, mod
->name
)
30 __entry
->taints
= mod
->taints
;
31 __assign_str(name
, mod
->name
);
34 TP_printk("%s %s", __get_str(name
), show_module_flags(__entry
->taints
))
37 TRACE_EVENT(module_free
,
39 TP_PROTO(struct module
*mod
),
44 __string( name
, mod
->name
)
48 __assign_str(name
, mod
->name
);
51 TP_printk("%s", __get_str(name
))
54 TRACE_EVENT(module_get
,
56 TP_PROTO(struct module
*mod
, unsigned long ip
, int refcnt
),
58 TP_ARGS(mod
, ip
, refcnt
),
61 __field( unsigned long, ip
)
62 __field( int, refcnt
)
63 __string( name
, mod
->name
)
68 __entry
->refcnt
= refcnt
;
69 __assign_str(name
, mod
->name
);
72 TP_printk("%s call_site=%pf refcnt=%d",
73 __get_str(name
), (void *)__entry
->ip
, __entry
->refcnt
)
76 TRACE_EVENT(module_put
,
78 TP_PROTO(struct module
*mod
, unsigned long ip
, int refcnt
),
80 TP_ARGS(mod
, ip
, refcnt
),
83 __field( unsigned long, ip
)
84 __field( int, refcnt
)
85 __string( name
, mod
->name
)
90 __entry
->refcnt
= refcnt
;
91 __assign_str(name
, mod
->name
);
94 TP_printk("%s call_site=%pf refcnt=%d",
95 __get_str(name
), (void *)__entry
->ip
, __entry
->refcnt
)
98 TRACE_EVENT(module_request
,
100 TP_PROTO(char *name
, bool wait
, unsigned long ip
),
102 TP_ARGS(name
, wait
, ip
),
105 __field( bool, wait
)
106 __field( unsigned long, ip
)
107 __string( name
, name
)
111 __entry
->wait
= wait
;
113 __assign_str(name
, name
);
116 TP_printk("%s wait=%d call_site=%pf",
117 __get_str(name
), (int)__entry
->wait
, (void *)__entry
->ip
)
120 #endif /* CONFIG_MODULES */
122 #endif /* _TRACE_MODULE_H */
124 /* This part must be outside protection */
125 #include <trace/define_trace.h>