diff options
Diffstat (limited to 'kernel/trace/trace_functions_graph.c')
-rw-r--r-- | kernel/trace/trace_functions_graph.c | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c index 4de3e57f723c..f0a0c982cde3 100644 --- a/kernel/trace/trace_functions_graph.c +++ b/kernel/trace/trace_functions_graph.c | |||
@@ -15,6 +15,33 @@ | |||
15 | #include "trace.h" | 15 | #include "trace.h" |
16 | #include "trace_output.h" | 16 | #include "trace_output.h" |
17 | 17 | ||
18 | static 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 | */ | ||
27 | bool 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 | */ | ||
40 | void ftrace_graph_stop(void) | ||
41 | { | ||
42 | kill_ftrace_graph = true; | ||
43 | } | ||
44 | |||
18 | /* When set, irq functions will be ignored */ | 45 | /* When set, irq functions will be ignored */ |
19 | static int ftrace_graph_skip_irqs; | 46 | static int ftrace_graph_skip_irqs; |
20 | 47 | ||
@@ -92,6 +119,9 @@ ftrace_push_return_trace(unsigned long ret, unsigned long func, int *depth, | |||
92 | unsigned long long calltime; | 119 | unsigned long long calltime; |
93 | int index; | 120 | int index; |
94 | 121 | ||
122 | if (unlikely(ftrace_graph_is_dead())) | ||
123 | return -EBUSY; | ||
124 | |||
95 | if (!current->ret_stack) | 125 | if (!current->ret_stack) |
96 | return -EBUSY; | 126 | return -EBUSY; |
97 | 127 | ||
@@ -323,7 +353,7 @@ int trace_graph_entry(struct ftrace_graph_ent *trace) | |||
323 | return ret; | 353 | return ret; |
324 | } | 354 | } |
325 | 355 | ||
326 | int trace_graph_thresh_entry(struct ftrace_graph_ent *trace) | 356 | static int trace_graph_thresh_entry(struct ftrace_graph_ent *trace) |
327 | { | 357 | { |
328 | if (tracing_thresh) | 358 | if (tracing_thresh) |
329 | return 1; | 359 | return 1; |
@@ -412,7 +442,7 @@ void set_graph_array(struct trace_array *tr) | |||
412 | smp_mb(); | 442 | smp_mb(); |
413 | } | 443 | } |
414 | 444 | ||
415 | void trace_graph_thresh_return(struct ftrace_graph_ret *trace) | 445 | static void trace_graph_thresh_return(struct ftrace_graph_ret *trace) |
416 | { | 446 | { |
417 | if (tracing_thresh && | 447 | if (tracing_thresh && |
418 | (trace->rettime - trace->calltime < tracing_thresh)) | 448 | (trace->rettime - trace->calltime < tracing_thresh)) |
@@ -445,6 +475,12 @@ static void graph_trace_reset(struct trace_array *tr) | |||
445 | unregister_ftrace_graph(); | 475 | unregister_ftrace_graph(); |
446 | } | 476 | } |
447 | 477 | ||
478 | static int graph_trace_update_thresh(struct trace_array *tr) | ||
479 | { | ||
480 | graph_trace_reset(tr); | ||
481 | return graph_trace_init(tr); | ||
482 | } | ||
483 | |||
448 | static int max_bytes_for_cpu; | 484 | static int max_bytes_for_cpu; |
449 | 485 | ||
450 | static enum print_line_t | 486 | static enum print_line_t |
@@ -1399,7 +1435,7 @@ static void __print_graph_headers_flags(struct seq_file *s, u32 flags) | |||
1399 | seq_printf(s, " | | | |\n"); | 1435 | seq_printf(s, " | | | |\n"); |
1400 | } | 1436 | } |
1401 | 1437 | ||
1402 | void print_graph_headers(struct seq_file *s) | 1438 | static void print_graph_headers(struct seq_file *s) |
1403 | { | 1439 | { |
1404 | print_graph_headers_flags(s, tracer_flags.val); | 1440 | print_graph_headers_flags(s, tracer_flags.val); |
1405 | } | 1441 | } |
@@ -1495,6 +1531,7 @@ static struct trace_event graph_trace_ret_event = { | |||
1495 | 1531 | ||
1496 | static struct tracer graph_trace __tracer_data = { | 1532 | static struct tracer graph_trace __tracer_data = { |
1497 | .name = "function_graph", | 1533 | .name = "function_graph", |
1534 | .update_thresh = graph_trace_update_thresh, | ||
1498 | .open = graph_trace_open, | 1535 | .open = graph_trace_open, |
1499 | .pipe_open = graph_trace_open, | 1536 | .pipe_open = graph_trace_open, |
1500 | .close = graph_trace_close, | 1537 | .close = graph_trace_close, |