Li Zefan | 7ead8b8 | 2009-08-17 16:56:28 +0800 | [diff] [blame] | 1 | #undef TRACE_SYSTEM |
| 2 | #define TRACE_SYSTEM module |
| 3 | |
| 4 | #if !defined(_TRACE_MODULE_H) || defined(TRACE_HEADER_MULTI_READ) |
| 5 | #define _TRACE_MODULE_H |
| 6 | |
| 7 | #include <linux/tracepoint.h> |
| 8 | |
| 9 | #ifdef CONFIG_MODULES |
| 10 | |
| 11 | struct module; |
| 12 | |
| 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" }) |
| 17 | |
| 18 | TRACE_EVENT(module_load, |
| 19 | |
| 20 | TP_PROTO(struct module *mod), |
| 21 | |
| 22 | TP_ARGS(mod), |
| 23 | |
| 24 | TP_STRUCT__entry( |
| 25 | __field( unsigned int, taints ) |
| 26 | __string( name, mod->name ) |
| 27 | ), |
| 28 | |
| 29 | TP_fast_assign( |
| 30 | __entry->taints = mod->taints; |
| 31 | __assign_str(name, mod->name); |
| 32 | ), |
| 33 | |
| 34 | TP_printk("%s %s", __get_str(name), show_module_flags(__entry->taints)) |
| 35 | ); |
| 36 | |
| 37 | TRACE_EVENT(module_free, |
| 38 | |
| 39 | TP_PROTO(struct module *mod), |
| 40 | |
| 41 | TP_ARGS(mod), |
| 42 | |
| 43 | TP_STRUCT__entry( |
| 44 | __string( name, mod->name ) |
| 45 | ), |
| 46 | |
| 47 | TP_fast_assign( |
| 48 | __assign_str(name, mod->name); |
| 49 | ), |
| 50 | |
| 51 | TP_printk("%s", __get_str(name)) |
| 52 | ); |
| 53 | |
Li Zefan | 925684d | 2009-11-26 15:03:23 +0800 | [diff] [blame] | 54 | DECLARE_EVENT_CLASS(module_refcnt, |
Li Zefan | 7ead8b8 | 2009-08-17 16:56:28 +0800 | [diff] [blame] | 55 | |
| 56 | TP_PROTO(struct module *mod, unsigned long ip, int refcnt), |
| 57 | |
| 58 | TP_ARGS(mod, ip, refcnt), |
| 59 | |
| 60 | TP_STRUCT__entry( |
| 61 | __field( unsigned long, ip ) |
| 62 | __field( int, refcnt ) |
| 63 | __string( name, mod->name ) |
| 64 | ), |
| 65 | |
| 66 | TP_fast_assign( |
| 67 | __entry->ip = ip; |
| 68 | __entry->refcnt = refcnt; |
| 69 | __assign_str(name, mod->name); |
| 70 | ), |
| 71 | |
| 72 | TP_printk("%s call_site=%pf refcnt=%d", |
| 73 | __get_str(name), (void *)__entry->ip, __entry->refcnt) |
| 74 | ); |
| 75 | |
Li Zefan | 925684d | 2009-11-26 15:03:23 +0800 | [diff] [blame] | 76 | DEFINE_EVENT(module_refcnt, module_get, |
Li Zefan | 7ead8b8 | 2009-08-17 16:56:28 +0800 | [diff] [blame] | 77 | |
| 78 | TP_PROTO(struct module *mod, unsigned long ip, int refcnt), |
| 79 | |
Li Zefan | 925684d | 2009-11-26 15:03:23 +0800 | [diff] [blame] | 80 | TP_ARGS(mod, ip, refcnt) |
| 81 | ); |
Li Zefan | 7ead8b8 | 2009-08-17 16:56:28 +0800 | [diff] [blame] | 82 | |
Li Zefan | 925684d | 2009-11-26 15:03:23 +0800 | [diff] [blame] | 83 | DEFINE_EVENT(module_refcnt, module_put, |
Li Zefan | 7ead8b8 | 2009-08-17 16:56:28 +0800 | [diff] [blame] | 84 | |
Li Zefan | 925684d | 2009-11-26 15:03:23 +0800 | [diff] [blame] | 85 | TP_PROTO(struct module *mod, unsigned long ip, int refcnt), |
Li Zefan | 7ead8b8 | 2009-08-17 16:56:28 +0800 | [diff] [blame] | 86 | |
Li Zefan | 925684d | 2009-11-26 15:03:23 +0800 | [diff] [blame] | 87 | TP_ARGS(mod, ip, refcnt) |
Li Zefan | 7ead8b8 | 2009-08-17 16:56:28 +0800 | [diff] [blame] | 88 | ); |
| 89 | |
| 90 | TRACE_EVENT(module_request, |
| 91 | |
| 92 | TP_PROTO(char *name, bool wait, unsigned long ip), |
| 93 | |
| 94 | TP_ARGS(name, wait, ip), |
| 95 | |
| 96 | TP_STRUCT__entry( |
| 97 | __field( bool, wait ) |
| 98 | __field( unsigned long, ip ) |
| 99 | __string( name, name ) |
| 100 | ), |
| 101 | |
| 102 | TP_fast_assign( |
| 103 | __entry->wait = wait; |
| 104 | __entry->ip = ip; |
| 105 | __assign_str(name, name); |
| 106 | ), |
| 107 | |
| 108 | TP_printk("%s wait=%d call_site=%pf", |
| 109 | __get_str(name), (int)__entry->wait, (void *)__entry->ip) |
| 110 | ); |
| 111 | |
| 112 | #endif /* CONFIG_MODULES */ |
| 113 | |
| 114 | #endif /* _TRACE_MODULE_H */ |
| 115 | |
| 116 | /* This part must be outside protection */ |
| 117 | #include <trace/define_trace.h> |
| 118 | |