Commit 6e4be6c9 authored by jolsa@redhat.com's avatar jolsa@redhat.com Committed by Greg Kroah-Hartman

tracing: correct module boundaries for ftrace_release

commit e7247a15 upstream.

When the module is about the unload we release its call records.
The ftrace_release function was given wrong values representing
the module core boundaries, thus not releasing its call records.

Plus making ftrace_release function module specific.
Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
LKML-Reference: <1254934835-363-3-git-send-email-jolsa@redhat.com>
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 23a27d5c
...@@ -241,7 +241,7 @@ extern void ftrace_enable_daemon(void); ...@@ -241,7 +241,7 @@ extern void ftrace_enable_daemon(void);
# define ftrace_set_filter(buf, len, reset) do { } while (0) # define ftrace_set_filter(buf, len, reset) do { } while (0)
# define ftrace_disable_daemon() do { } while (0) # define ftrace_disable_daemon() do { } while (0)
# define ftrace_enable_daemon() do { } while (0) # define ftrace_enable_daemon() do { } while (0)
static inline void ftrace_release(void *start, unsigned long size) { } static inline void ftrace_release_mod(struct module *mod) {}
static inline int register_ftrace_command(struct ftrace_func_command *cmd) static inline int register_ftrace_command(struct ftrace_func_command *cmd)
{ {
return -EINVAL; return -EINVAL;
......
...@@ -2801,19 +2801,17 @@ static int ftrace_convert_nops(struct module *mod, ...@@ -2801,19 +2801,17 @@ static int ftrace_convert_nops(struct module *mod,
} }
#ifdef CONFIG_MODULES #ifdef CONFIG_MODULES
void ftrace_release(void *start, void *end) void ftrace_release_mod(struct module *mod)
{ {
struct dyn_ftrace *rec; struct dyn_ftrace *rec;
struct ftrace_page *pg; struct ftrace_page *pg;
unsigned long s = (unsigned long)start;
unsigned long e = (unsigned long)end;
if (ftrace_disabled || !start || start == end) if (ftrace_disabled)
return; return;
mutex_lock(&ftrace_lock); mutex_lock(&ftrace_lock);
do_for_each_ftrace_rec(pg, rec) { do_for_each_ftrace_rec(pg, rec) {
if ((rec->ip >= s) && (rec->ip < e)) { if (within_module_core(rec->ip, mod)) {
/* /*
* rec->ip is changed in ftrace_free_rec() * rec->ip is changed in ftrace_free_rec()
* It should not between s and e if record was freed. * It should not between s and e if record was freed.
...@@ -2845,9 +2843,7 @@ static int ftrace_module_notify(struct notifier_block *self, ...@@ -2845,9 +2843,7 @@ static int ftrace_module_notify(struct notifier_block *self,
mod->num_ftrace_callsites); mod->num_ftrace_callsites);
break; break;
case MODULE_STATE_GOING: case MODULE_STATE_GOING:
ftrace_release(mod->ftrace_callsites, ftrace_release_mod(mod);
mod->ftrace_callsites +
mod->num_ftrace_callsites);
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment