Merge branch 'v4.4/topic/hibernate' into linux-linaro-lsk-v4.4
[firefly-linux-kernel-4.4.55.git] / kernel / trace / trace_functions_graph.c
index 92382af7a21312c03ecef0cabdfbce19e2c8111e..7fd6f5a26143cfd3a49960a5ace9ecc60e26a51b 100644 (file)
@@ -288,9 +288,6 @@ int __trace_graph_entry(struct trace_array *tr,
        struct ring_buffer *buffer = tr->trace_buffer.buffer;
        struct ftrace_graph_ent_entry *entry;
 
-       if (unlikely(__this_cpu_read(ftrace_cpu_disabled)))
-               return 0;
-
        event = trace_buffer_lock_reserve(buffer, TRACE_GRAPH_ENT,
                                          sizeof(*entry), flags, pc);
        if (!event)
@@ -403,9 +400,6 @@ void __trace_graph_return(struct trace_array *tr,
        struct ring_buffer *buffer = tr->trace_buffer.buffer;
        struct ftrace_graph_ret_entry *entry;
 
-       if (unlikely(__this_cpu_read(ftrace_cpu_disabled)))
-               return;
-
        event = trace_buffer_lock_reserve(buffer, TRACE_GRAPH_RET,
                                          sizeof(*entry), flags, pc);
        if (!event)
@@ -786,6 +780,10 @@ print_graph_entry_leaf(struct trace_iterator *iter,
 
                cpu_data = per_cpu_ptr(data->cpu_data, cpu);
 
+               /* If a graph tracer ignored set_graph_notrace */
+               if (call->depth < -1)
+                       call->depth += FTRACE_NOTRACE_DEPTH;
+
                /*
                 * Comments display at + 1 to depth. Since
                 * this is a leaf function, keep the comments
@@ -794,7 +792,8 @@ print_graph_entry_leaf(struct trace_iterator *iter,
                cpu_data->depth = call->depth - 1;
 
                /* No need to keep this function around for this depth */
-               if (call->depth < FTRACE_RETFUNC_DEPTH)
+               if (call->depth < FTRACE_RETFUNC_DEPTH &&
+                   !WARN_ON_ONCE(call->depth < 0))
                        cpu_data->enter_funcs[call->depth] = 0;
        }
 
@@ -824,11 +823,16 @@ print_graph_entry_nested(struct trace_iterator *iter,
                struct fgraph_cpu_data *cpu_data;
                int cpu = iter->cpu;
 
+               /* If a graph tracer ignored set_graph_notrace */
+               if (call->depth < -1)
+                       call->depth += FTRACE_NOTRACE_DEPTH;
+
                cpu_data = per_cpu_ptr(data->cpu_data, cpu);
                cpu_data->depth = call->depth;
 
                /* Save this function pointer to see if the exit matches */
-               if (call->depth < FTRACE_RETFUNC_DEPTH)
+               if (call->depth < FTRACE_RETFUNC_DEPTH &&
+                   !WARN_ON_ONCE(call->depth < 0))
                        cpu_data->enter_funcs[call->depth] = call->func;
        }
 
@@ -1058,7 +1062,8 @@ print_graph_return(struct ftrace_graph_ret *trace, struct trace_seq *s,
                 */
                cpu_data->depth = trace->depth - 1;
 
-               if (trace->depth < FTRACE_RETFUNC_DEPTH) {
+               if (trace->depth < FTRACE_RETFUNC_DEPTH &&
+                   !WARN_ON_ONCE(trace->depth < 0)) {
                        if (cpu_data->enter_funcs[trace->depth] != trace->func)
                                func_match = 0;
                        cpu_data->enter_funcs[trace->depth] = 0;