tracing/function_graph: Fix filters for function_graph threshold
authorJoel Fernandes <agnel.joel@gmail.com>
Sat, 18 Jun 2016 05:44:54 +0000 (22:44 -0700)
committerSteven Rostedt <rostedt@goodmis.org>
Mon, 27 Jun 2016 17:29:24 +0000 (13:29 -0400)
Function graph tracer currently ignores filters if tracing_thresh is set.
For example, even if set_ftrace_pid is set, then its ignored if tracing_thresh
set, resulting in all processes being traced.

To fix this, we reuse the same entry function as when tracing_thresh is not
set and do everything as in the regular case except for writing the function entry
to the ring buffer.

Link: http://lkml.kernel.org/r/1466228694-2677-1-git-send-email-agnel.joel@gmail.com
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Signed-off-by: Joel Fernandes <agnel.joel@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
kernel/trace/trace_functions_graph.c

index 67cce7896aeb821e61c0a753a228da41aa94bb4b..7363ccf795125ce14d89a3303300e47a096c877e 100644 (file)
@@ -338,6 +338,13 @@ int trace_graph_entry(struct ftrace_graph_ent *trace)
        if (ftrace_graph_notrace_addr(trace->func))
                return 1;
 
+       /*
+        * Stop here if tracing_threshold is set. We only write function return
+        * events to the ring buffer.
+        */
+       if (tracing_thresh)
+               return 1;
+
        local_irq_save(flags);
        cpu = raw_smp_processor_id();
        data = per_cpu_ptr(tr->trace_buffer.data, cpu);
@@ -355,14 +362,6 @@ int trace_graph_entry(struct ftrace_graph_ent *trace)
        return ret;
 }
 
-static int trace_graph_thresh_entry(struct ftrace_graph_ent *trace)
-{
-       if (tracing_thresh)
-               return 1;
-       else
-               return trace_graph_entry(trace);
-}
-
 static void
 __trace_graph_function(struct trace_array *tr,
                unsigned long ip, unsigned long flags, int pc)
@@ -457,7 +456,7 @@ static int graph_trace_init(struct trace_array *tr)
        set_graph_array(tr);
        if (tracing_thresh)
                ret = register_ftrace_graph(&trace_graph_thresh_return,
-                                           &trace_graph_thresh_entry);
+                                           &trace_graph_entry);
        else
                ret = register_ftrace_graph(&trace_graph_return,
                                            &trace_graph_entry);
This page took 0.025683 seconds and 5 git commands to generate.