diff options
author | Steven Rostedt <srostedt@redhat.com> | 2009-04-15 13:24:06 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-04-17 10:59:15 -0400 |
commit | 93eb677d74a4f7d3edfb678c94f6c0544d9fbad2 (patch) | |
tree | 8bbc46895be623a78316230362e94969dbb02135 /include/linux/module.h | |
parent | f3948f8857ef5de239f28a61dddb1554a0ae4c2c (diff) |
ftrace: use module notifier for function tracer
The hooks in the module code for the function tracer must be called
before any of that module code runs. The function tracer hooks
modify the module (replacing calls to mcount to nops). If the code
is executed while the change occurs, then the CPU can take a GPF.
To handle the above with a bit of paranoia, I originally implemented
the hooks as calls directly from the module code.
After examining the notifier calls, it looks as though the start up
notify is called before any of the module's code is executed. This makes
the use of the notify safe with ftrace.
Only the startup notify is required to be "safe". The shutdown simply
removes the entries from the ftrace function list, and does not modify
any code.
This change has another benefit. It removes a issue with a reverse dependency
in the mutexes of ftrace_lock and module_mutex.
[ Impact: fix lock dependency bug, cleanup ]
Cc: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'include/linux/module.h')
-rw-r--r-- | include/linux/module.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/module.h b/include/linux/module.h index 6155fa44168b..a8f2c0aa4c32 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
@@ -341,6 +341,10 @@ struct module | |||
341 | struct ftrace_event_call *trace_events; | 341 | struct ftrace_event_call *trace_events; |
342 | unsigned int num_trace_events; | 342 | unsigned int num_trace_events; |
343 | #endif | 343 | #endif |
344 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD | ||
345 | unsigned long *ftrace_callsites; | ||
346 | unsigned int num_ftrace_callsites; | ||
347 | #endif | ||
344 | 348 | ||
345 | #ifdef CONFIG_MODULE_UNLOAD | 349 | #ifdef CONFIG_MODULE_UNLOAD |
346 | /* What modules depend on me? */ | 350 | /* What modules depend on me? */ |