aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>2014-06-25 10:39:46 -0400
committerSteven Rostedt <rostedt@goodmis.org>2014-07-17 09:45:07 -0400
commit1b2f121c1418249e56048d816754b479b3cb6fb3 (patch)
tree67dd1900a39a5c688492d7f4989f41161943b1e7
parent2b014666a1b93ad21c5667a4643da67bd49a5562 (diff)
ftrace-graph: Remove dependency of ftrace_stop() from ftrace_graph_stop()
ftrace_stop() is going away as it disables parts of function tracing that affects users that should not be affected. But ftrace_graph_stop() is built on ftrace_stop(). Here's another example of killing all of function tracing because something went wrong with function graph tracing. Instead of disabling all users of function tracing on function graph error, disable only function graph tracing. A new function is created called ftrace_graph_is_dead(). This is called in strategic paths to prevent function graph from doing more harm and allowing at least a warning to be printed before the system crashes. NOTE: ftrace_stop() is still used until all the archs are converted over to use ftrace_graph_is_dead(). After that, ftrace_stop() will be removed. Reviewed-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--include/linux/ftrace.h1
-rw-r--r--kernel/trace/ftrace.c5
-rw-r--r--kernel/trace/trace_functions_graph.c35
3 files changed, 36 insertions, 5 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 4807a39e7ae1..18fb2c4a3f7f 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -760,6 +760,7 @@ extern char __irqentry_text_end[];
760extern int register_ftrace_graph(trace_func_graph_ret_t retfunc, 760extern int register_ftrace_graph(trace_func_graph_ret_t retfunc,
761 trace_func_graph_ent_t entryfunc); 761 trace_func_graph_ent_t entryfunc);
762 762
763extern bool ftrace_graph_is_dead(void);
763extern void ftrace_graph_stop(void); 764extern void ftrace_graph_stop(void);
764 765
765/* The current handlers in use */ 766/* The current handlers in use */
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 1776153ea6e0..8063280fd53d 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -5473,9 +5473,4 @@ void ftrace_graph_exit_task(struct task_struct *t)
5473 5473
5474 kfree(ret_stack); 5474 kfree(ret_stack);
5475} 5475}
5476
5477void ftrace_graph_stop(void)
5478{
5479 ftrace_stop();
5480}
5481#endif 5476#endif
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index 4de3e57f723c..3604690be70b 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -15,6 +15,38 @@
15#include "trace.h" 15#include "trace.h"
16#include "trace_output.h" 16#include "trace_output.h"
17 17
18static bool kill_ftrace_graph;
19
20/**
21 * ftrace_graph_is_dead - returns true if ftrace_graph_stop() was called
22 *
23 * ftrace_graph_stop() is called when a severe error is detected in
24 * the function graph tracing. This function is called by the critical
25 * paths of function graph to keep those paths from doing any more harm.
26 */
27bool ftrace_graph_is_dead(void)
28{
29 return kill_ftrace_graph;
30}
31
32/**
33 * ftrace_graph_stop - set to permanently disable function graph tracincg
34 *
35 * In case of an error int function graph tracing, this is called
36 * to try to keep function graph tracing from causing any more harm.
37 * Usually this is pretty severe and this is called to try to at least
38 * get a warning out to the user.
39 */
40void ftrace_graph_stop(void)
41{
42 kill_ftrace_graph = true;
43 /*
44 * ftrace_stop() will be removed when all archs are updated to
45 * use ftrace_graph_is_dead()
46 */
47 ftrace_stop();
48}
49
18/* When set, irq functions will be ignored */ 50/* When set, irq functions will be ignored */
19static int ftrace_graph_skip_irqs; 51static int ftrace_graph_skip_irqs;
20 52
@@ -92,6 +124,9 @@ ftrace_push_return_trace(unsigned long ret, unsigned long func, int *depth,
92 unsigned long long calltime; 124 unsigned long long calltime;
93 int index; 125 int index;
94 126
127 if (unlikely(ftrace_graph_is_dead()))
128 return -EBUSY;
129
95 if (!current->ret_stack) 130 if (!current->ret_stack)
96 return -EBUSY; 131 return -EBUSY;
97 132