diff options
author | Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> | 2008-11-14 17:47:46 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-11-16 03:01:35 -0500 |
commit | 32f85742778dfc2c74975cf0b9f5bdb13470cb32 (patch) | |
tree | bec188e2772c3ebbf70b149d78bd36eb24d927c0 | |
parent | 5f382671def7cb9c0f4b75d586dc5f60dca5e1c3 (diff) |
tracepoints: use modules notifiers
Impact: cleanup
Use module notifiers for tracepoint updates rather than adding a hook in
module.c.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | kernel/module.c | 5 | ||||
-rw-r--r-- | kernel/tracepoint.c | 29 |
2 files changed, 29 insertions, 5 deletions
diff --git a/kernel/module.c b/kernel/module.c index 72c6ca574211..fc1dff9a178c 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -2187,11 +2187,6 @@ static noinline struct module *load_module(void __user *umod, | |||
2187 | debug = section_objs(hdr, sechdrs, secstrings, "__verbose", | 2187 | debug = section_objs(hdr, sechdrs, secstrings, "__verbose", |
2188 | sizeof(*debug), &num_debug); | 2188 | sizeof(*debug), &num_debug); |
2189 | dynamic_printk_setup(debug, num_debug); | 2189 | dynamic_printk_setup(debug, num_debug); |
2190 | |||
2191 | #ifdef CONFIG_TRACEPOINTS | ||
2192 | tracepoint_update_probe_range(mod->tracepoints, | ||
2193 | mod->tracepoints + mod->num_tracepoints); | ||
2194 | #endif | ||
2195 | } | 2190 | } |
2196 | 2191 | ||
2197 | /* sechdrs[0].sh_size is always zero */ | 2192 | /* sechdrs[0].sh_size is always zero */ |
diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c index 47a7303d6cd9..94ac4e35530d 100644 --- a/kernel/tracepoint.c +++ b/kernel/tracepoint.c | |||
@@ -541,3 +541,32 @@ void tracepoint_iter_reset(struct tracepoint_iter *iter) | |||
541 | iter->tracepoint = NULL; | 541 | iter->tracepoint = NULL; |
542 | } | 542 | } |
543 | EXPORT_SYMBOL_GPL(tracepoint_iter_reset); | 543 | EXPORT_SYMBOL_GPL(tracepoint_iter_reset); |
544 | |||
545 | int tracepoint_module_notify(struct notifier_block *self, | ||
546 | unsigned long val, void *data) | ||
547 | { | ||
548 | struct module *mod = data; | ||
549 | |||
550 | switch (val) { | ||
551 | case MODULE_STATE_COMING: | ||
552 | tracepoint_update_probe_range(mod->tracepoints, | ||
553 | mod->tracepoints + mod->num_tracepoints); | ||
554 | break; | ||
555 | case MODULE_STATE_GOING: | ||
556 | tracepoint_update_probe_range(mod->tracepoints, | ||
557 | mod->tracepoints + mod->num_tracepoints); | ||
558 | break; | ||
559 | } | ||
560 | return 0; | ||
561 | } | ||
562 | |||
563 | struct notifier_block tracepoint_module_nb = { | ||
564 | .notifier_call = tracepoint_module_notify, | ||
565 | .priority = 0, | ||
566 | }; | ||
567 | |||
568 | static int init_tracepoints(void) | ||
569 | { | ||
570 | return register_module_notifier(&tracepoint_module_nb); | ||
571 | } | ||
572 | __initcall(init_tracepoints); | ||