aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorSteven Rostedt <rostedt@goodmis.org>2008-05-27 20:48:37 -0400
committerIngo Molnar <mingo@elte.hu>2008-06-02 06:50:04 -0400
commitad90c0e3ce8d20d6873b57e36181ef6d7a0097fe (patch)
tree34af559928f9f2403c72156b672578d28f790a4f /include/linux
parent76094a2cf46e4ab776055d4086615b884408568c (diff)
ftrace: user update and disable dynamic ftrace daemon
In dynamic ftrace, the mcount function starts off pointing to a stub function that just returns. On start up, the call to the stub is modified to point to a "record_ip" function. The job of the record_ip function is to add the function to a pre-allocated hash list. If the function is already there, it simply is ignored, otherwise it is added to the list. Later, a ftraced daemon wakes up and calls kstop_machine if any functions have been recorded, and changes the calls to the recorded functions to a simple nop. If no functions were recorded, the daemon goes back to sleep. The daemon wakes up once a second to see if it needs to update any newly recorded functions into nops. Usually it does not, but if a lot of code has been executed for the first time in the kernel, the ftraced daemon will call kstop_machine to update those into nops. The problem currently is that there's no way to stop the daemon from doing this, and it can cause unneeded latencies (800us which for some is bothersome). This patch adds a new file /debugfs/tracing/ftraced_enabled. If the daemon is active, reading this will return "enabled\n" and "disabled\n" when the daemon is not running. To disable the daemon, the user can echo "0" or "disable" into this file, and "1" or "enable" to re-enable the daemon. Since the daemon is used to convert the functions into nops to increase the performance of the system, I also added that anytime something is written into the ftraced_enabled file, kstop_machine will run if there are new functions that have been detected that need to be converted. This way the user can disable the daemon but still be able to control the conversion of the mcount calls to nops by simply, "echo 0 > /debugfs/tracing/ftraced_enabled" when they need to do more conversions. To see the number of converted functions: "cat /debugfs/tracing/dyn_ftrace_total_info" Signed-off-by: Steven Rostedt <srostedt@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/ftrace.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index b482fe88bc04..623819433ed5 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -72,9 +72,15 @@ extern int ftrace_update_ftrace_func(ftrace_func_t func);
72extern void ftrace_caller(void); 72extern void ftrace_caller(void);
73extern void ftrace_call(void); 73extern void ftrace_call(void);
74extern void mcount_call(void); 74extern void mcount_call(void);
75
76void ftrace_disable_daemon(void);
77void ftrace_enable_daemon(void);
78
75#else 79#else
76# define ftrace_force_update() ({ 0; }) 80# define ftrace_force_update() ({ 0; })
77# define ftrace_set_filter(buf, len, reset) do { } while (0) 81# define ftrace_set_filter(buf, len, reset) do { } while (0)
82# define ftrace_disable_daemon() do { } while (0)
83# define ftrace_enable_daemon() do { } while (0)
78#endif 84#endif
79 85
80/* totally disable ftrace - can not re-enable after this */ 86/* totally disable ftrace - can not re-enable after this */