diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2009-08-17 04:56:28 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-08-17 05:25:08 -0400 |
commit | 7ead8b8313d92b3a69a1a61b0dcbc4cd66c960dc (patch) | |
tree | 614759ec1b24ea9f6d1409b866c80df0611e5d6b /include/linux/module.h | |
parent | 60d970c254b95ec7a0fc4c590b510253987b64a0 (diff) |
tracing/events: Add module tracepoints
Add trace points to trace module_load, module_free, module_get,
module_put and module_request, and use trace_event facility to
get the trace output.
Here's the sample output:
TASK-PID CPU# TIMESTAMP FUNCTION
| | | | |
<...>-42 [000] 1.758380: module_request: fb0 wait=1 call_site=fb_open
...
<...>-60 [000] 3.269403: module_load: scsi_wait_scan
<...>-60 [000] 3.269432: module_put: scsi_wait_scan call_site=sys_init_module refcnt=0
<...>-61 [001] 3.273168: module_free: scsi_wait_scan
...
<...>-1021 [000] 13.836081: module_load: sunrpc
<...>-1021 [000] 13.840589: module_put: sunrpc call_site=sys_init_module refcnt=-1
<...>-1027 [000] 13.848098: module_get: sunrpc call_site=try_module_get refcnt=0
<...>-1027 [000] 13.848308: module_get: sunrpc call_site=get_filesystem refcnt=1
<...>-1027 [000] 13.848692: module_put: sunrpc call_site=put_filesystem refcnt=0
...
modprobe-2587 [001] 1088.437213: module_load: trace_events_sample F
modprobe-2587 [001] 1088.437786: module_put: trace_events_sample call_site=sys_init_module refcnt=0
Note:
- the taints flag can be 'F', 'C' and/or 'P' if mod->taints != 0
- the module refcnt is percpu, so it can be negative in a
specific cpu
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
LKML-Reference: <4A891B3C.5030608@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux/module.h')
-rw-r--r-- | include/linux/module.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/include/linux/module.h b/include/linux/module.h index 098bdb7bfacf..f8f92d015efe 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
@@ -17,10 +17,12 @@ | |||
17 | #include <linux/moduleparam.h> | 17 | #include <linux/moduleparam.h> |
18 | #include <linux/marker.h> | 18 | #include <linux/marker.h> |
19 | #include <linux/tracepoint.h> | 19 | #include <linux/tracepoint.h> |
20 | #include <asm/local.h> | ||
21 | 20 | ||
21 | #include <asm/local.h> | ||
22 | #include <asm/module.h> | 22 | #include <asm/module.h> |
23 | 23 | ||
24 | #include <trace/events/module.h> | ||
25 | |||
24 | /* Not Yet Implemented */ | 26 | /* Not Yet Implemented */ |
25 | #define MODULE_SUPPORTED_DEVICE(name) | 27 | #define MODULE_SUPPORTED_DEVICE(name) |
26 | 28 | ||
@@ -462,7 +464,10 @@ static inline local_t *__module_ref_addr(struct module *mod, int cpu) | |||
462 | static inline void __module_get(struct module *module) | 464 | static inline void __module_get(struct module *module) |
463 | { | 465 | { |
464 | if (module) { | 466 | if (module) { |
465 | local_inc(__module_ref_addr(module, get_cpu())); | 467 | unsigned int cpu = get_cpu(); |
468 | local_inc(__module_ref_addr(module, cpu)); | ||
469 | trace_module_get(module, _THIS_IP_, | ||
470 | local_read(__module_ref_addr(module, cpu))); | ||
466 | put_cpu(); | 471 | put_cpu(); |
467 | } | 472 | } |
468 | } | 473 | } |
@@ -473,8 +478,11 @@ static inline int try_module_get(struct module *module) | |||
473 | 478 | ||
474 | if (module) { | 479 | if (module) { |
475 | unsigned int cpu = get_cpu(); | 480 | unsigned int cpu = get_cpu(); |
476 | if (likely(module_is_live(module))) | 481 | if (likely(module_is_live(module))) { |
477 | local_inc(__module_ref_addr(module, cpu)); | 482 | local_inc(__module_ref_addr(module, cpu)); |
483 | trace_module_get(module, _THIS_IP_, | ||
484 | local_read(__module_ref_addr(module, cpu))); | ||
485 | } | ||
478 | else | 486 | else |
479 | ret = 0; | 487 | ret = 0; |
480 | put_cpu(); | 488 | put_cpu(); |