17ead8b83SLi Zefan #undef TRACE_SYSTEM 27ead8b83SLi Zefan #define TRACE_SYSTEM module 37ead8b83SLi Zefan 47ead8b83SLi Zefan #if !defined(_TRACE_MODULE_H) || defined(TRACE_HEADER_MULTI_READ) 57ead8b83SLi Zefan #define _TRACE_MODULE_H 67ead8b83SLi Zefan 77ead8b83SLi Zefan #include <linux/tracepoint.h> 87ead8b83SLi Zefan 97ead8b83SLi Zefan #ifdef CONFIG_MODULES 107ead8b83SLi Zefan 117ead8b83SLi Zefan struct module; 127ead8b83SLi Zefan 137ead8b83SLi Zefan #define show_module_flags(flags) __print_flags(flags, "", \ 147ead8b83SLi Zefan { (1UL << TAINT_PROPRIETARY_MODULE), "P" }, \ 157ead8b83SLi Zefan { (1UL << TAINT_FORCED_MODULE), "F" }, \ 167ead8b83SLi Zefan { (1UL << TAINT_CRAP), "C" }) 177ead8b83SLi Zefan 187ead8b83SLi Zefan TRACE_EVENT(module_load, 197ead8b83SLi Zefan 207ead8b83SLi Zefan TP_PROTO(struct module *mod), 217ead8b83SLi Zefan 227ead8b83SLi Zefan TP_ARGS(mod), 237ead8b83SLi Zefan 247ead8b83SLi Zefan TP_STRUCT__entry( 257ead8b83SLi Zefan __field( unsigned int, taints ) 267ead8b83SLi Zefan __string( name, mod->name ) 277ead8b83SLi Zefan ), 287ead8b83SLi Zefan 297ead8b83SLi Zefan TP_fast_assign( 307ead8b83SLi Zefan __entry->taints = mod->taints; 317ead8b83SLi Zefan __assign_str(name, mod->name); 327ead8b83SLi Zefan ), 337ead8b83SLi Zefan 347ead8b83SLi Zefan TP_printk("%s %s", __get_str(name), show_module_flags(__entry->taints)) 357ead8b83SLi Zefan ); 367ead8b83SLi Zefan 377ead8b83SLi Zefan TRACE_EVENT(module_free, 387ead8b83SLi Zefan 397ead8b83SLi Zefan TP_PROTO(struct module *mod), 407ead8b83SLi Zefan 417ead8b83SLi Zefan TP_ARGS(mod), 427ead8b83SLi Zefan 437ead8b83SLi Zefan TP_STRUCT__entry( 447ead8b83SLi Zefan __string( name, mod->name ) 457ead8b83SLi Zefan ), 467ead8b83SLi Zefan 477ead8b83SLi Zefan TP_fast_assign( 487ead8b83SLi Zefan __assign_str(name, mod->name); 497ead8b83SLi Zefan ), 507ead8b83SLi Zefan 517ead8b83SLi Zefan TP_printk("%s", __get_str(name)) 527ead8b83SLi Zefan ); 537ead8b83SLi Zefan 54*925684d6SLi Zefan DECLARE_EVENT_CLASS(module_refcnt, 557ead8b83SLi Zefan 567ead8b83SLi Zefan TP_PROTO(struct module *mod, unsigned long ip, int refcnt), 577ead8b83SLi Zefan 587ead8b83SLi Zefan TP_ARGS(mod, ip, refcnt), 597ead8b83SLi Zefan 607ead8b83SLi Zefan TP_STRUCT__entry( 617ead8b83SLi Zefan __field( unsigned long, ip ) 627ead8b83SLi Zefan __field( int, refcnt ) 637ead8b83SLi Zefan __string( name, mod->name ) 647ead8b83SLi Zefan ), 657ead8b83SLi Zefan 667ead8b83SLi Zefan TP_fast_assign( 677ead8b83SLi Zefan __entry->ip = ip; 687ead8b83SLi Zefan __entry->refcnt = refcnt; 697ead8b83SLi Zefan __assign_str(name, mod->name); 707ead8b83SLi Zefan ), 717ead8b83SLi Zefan 727ead8b83SLi Zefan TP_printk("%s call_site=%pf refcnt=%d", 737ead8b83SLi Zefan __get_str(name), (void *)__entry->ip, __entry->refcnt) 747ead8b83SLi Zefan ); 757ead8b83SLi Zefan 76*925684d6SLi Zefan DEFINE_EVENT(module_refcnt, module_get, 777ead8b83SLi Zefan 787ead8b83SLi Zefan TP_PROTO(struct module *mod, unsigned long ip, int refcnt), 797ead8b83SLi Zefan 80*925684d6SLi Zefan TP_ARGS(mod, ip, refcnt) 81*925684d6SLi Zefan ); 827ead8b83SLi Zefan 83*925684d6SLi Zefan DEFINE_EVENT(module_refcnt, module_put, 847ead8b83SLi Zefan 85*925684d6SLi Zefan TP_PROTO(struct module *mod, unsigned long ip, int refcnt), 867ead8b83SLi Zefan 87*925684d6SLi Zefan TP_ARGS(mod, ip, refcnt) 887ead8b83SLi Zefan ); 897ead8b83SLi Zefan 907ead8b83SLi Zefan TRACE_EVENT(module_request, 917ead8b83SLi Zefan 927ead8b83SLi Zefan TP_PROTO(char *name, bool wait, unsigned long ip), 937ead8b83SLi Zefan 947ead8b83SLi Zefan TP_ARGS(name, wait, ip), 957ead8b83SLi Zefan 967ead8b83SLi Zefan TP_STRUCT__entry( 977ead8b83SLi Zefan __field( bool, wait ) 987ead8b83SLi Zefan __field( unsigned long, ip ) 997ead8b83SLi Zefan __string( name, name ) 1007ead8b83SLi Zefan ), 1017ead8b83SLi Zefan 1027ead8b83SLi Zefan TP_fast_assign( 1037ead8b83SLi Zefan __entry->wait = wait; 1047ead8b83SLi Zefan __entry->ip = ip; 1057ead8b83SLi Zefan __assign_str(name, name); 1067ead8b83SLi Zefan ), 1077ead8b83SLi Zefan 1087ead8b83SLi Zefan TP_printk("%s wait=%d call_site=%pf", 1097ead8b83SLi Zefan __get_str(name), (int)__entry->wait, (void *)__entry->ip) 1107ead8b83SLi Zefan ); 1117ead8b83SLi Zefan 1127ead8b83SLi Zefan #endif /* CONFIG_MODULES */ 1137ead8b83SLi Zefan 1147ead8b83SLi Zefan #endif /* _TRACE_MODULE_H */ 1157ead8b83SLi Zefan 1167ead8b83SLi Zefan /* This part must be outside protection */ 1177ead8b83SLi Zefan #include <trace/define_trace.h> 1187ead8b83SLi Zefan 119