Skip to content

Commit

Permalink
tracepoints: use modules notifiers
Browse files Browse the repository at this point in the history
Impact: cleanup

Use module notifiers for tracepoint updates rather than adding a hook in
module.c.

Signed-off-by: Mathieu Desnoyers <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
Mathieu Desnoyers authored and Ingo Molnar committed Nov 16, 2008
1 parent 5f38267 commit 32f8574
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
5 changes: 0 additions & 5 deletions kernel/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -2187,11 +2187,6 @@ static noinline struct module *load_module(void __user *umod,
debug = section_objs(hdr, sechdrs, secstrings, "__verbose",
sizeof(*debug), &num_debug);
dynamic_printk_setup(debug, num_debug);

#ifdef CONFIG_TRACEPOINTS
tracepoint_update_probe_range(mod->tracepoints,
mod->tracepoints + mod->num_tracepoints);
#endif
}

/* sechdrs[0].sh_size is always zero */
Expand Down
29 changes: 29 additions & 0 deletions kernel/tracepoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -541,3 +541,32 @@ void tracepoint_iter_reset(struct tracepoint_iter *iter)
iter->tracepoint = NULL;
}
EXPORT_SYMBOL_GPL(tracepoint_iter_reset);

int tracepoint_module_notify(struct notifier_block *self,
unsigned long val, void *data)
{
struct module *mod = data;

switch (val) {
case MODULE_STATE_COMING:
tracepoint_update_probe_range(mod->tracepoints,
mod->tracepoints + mod->num_tracepoints);
break;
case MODULE_STATE_GOING:
tracepoint_update_probe_range(mod->tracepoints,
mod->tracepoints + mod->num_tracepoints);
break;
}
return 0;
}

struct notifier_block tracepoint_module_nb = {
.notifier_call = tracepoint_module_notify,
.priority = 0,
};

static int init_tracepoints(void)
{
return register_module_notifier(&tracepoint_module_nb);
}
__initcall(init_tracepoints);

0 comments on commit 32f8574

Please sign in to comment.