linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND] trace: function graph: Fix filters for function_graph threshold
@ 2016-06-18  5:44 Joel Fernandes
       [not found] ` <CAD=GYpbXmHhCnGWyyXQTCg6a92-NYmmNRmjRgYgfU8vpfUN_9w@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Joel Fernandes @ 2016-06-18  5:44 UTC (permalink / raw)
  To: linux-kernel; +Cc: Frederic Weisbecker, Steven Rostedt, Ingo Molnar

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.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>
Signed-off-by: Joel Fernandes <agnel.joel@gmail.com>
---
 kernel/trace/trace_functions_graph.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index a663cbb..0967fac 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -337,6 +337,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);
@@ -354,14 +361,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)
@@ -456,7 +455,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);
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH RESEND] trace: function graph: Fix filters for function_graph threshold
       [not found] ` <CAD=GYpbXmHhCnGWyyXQTCg6a92-NYmmNRmjRgYgfU8vpfUN_9w@mail.gmail.com>
@ 2016-06-27 15:17   ` Steven Rostedt
  2016-06-27 17:14     ` Joel Fernandes
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2016-06-27 15:17 UTC (permalink / raw)
  To: Joel Fernandes
  Cc: Linux Kernel Mailing List, Frederic Weisbecker, Ingo Molnar

On Mon, 27 Jun 2016 01:25:16 -0700
Joel Fernandes <agnel.joel@gmail.com> wrote:

> Gentle ping. Could you anyone pick up this patch?
> 
>

Thanks for the reminder. As this isn't a regression (it never
worked ;-) do you think this should go to the stable releases, and/or
even the current release. Or are you fine with this just going in the
next merge window?

-- Steve

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH RESEND] trace: function graph: Fix filters for function_graph threshold
  2016-06-27 15:17   ` Steven Rostedt
@ 2016-06-27 17:14     ` Joel Fernandes
  0 siblings, 0 replies; 3+ messages in thread
From: Joel Fernandes @ 2016-06-27 17:14 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Linux Kernel Mailing List, Frederic Weisbecker, Ingo Molnar

Hi Steve,

On Mon, Jun 27, 2016 at 8:17 AM, Steven Rostedt <rostedt@goodmis.org> wrote:
> On Mon, 27 Jun 2016 01:25:16 -0700
> Joel Fernandes <agnel.joel@gmail.com> wrote:
>
>> Gentle ping. Could you anyone pick up this patch?
>>
>>
>
> Thanks for the reminder. As this isn't a regression (it never
> worked ;-) do you think this should go to the stable releases, and/or
> even the current release. Or are you fine with this just going in the
> next merge window?

Queuing for the next merge window is fine with me. Thanks for picking it up.

Regards,
Joel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-06-27 17:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-18  5:44 [PATCH RESEND] trace: function graph: Fix filters for function_graph threshold Joel Fernandes
     [not found] ` <CAD=GYpbXmHhCnGWyyXQTCg6a92-NYmmNRmjRgYgfU8vpfUN_9w@mail.gmail.com>
2016-06-27 15:17   ` Steven Rostedt
2016-06-27 17:14     ` Joel Fernandes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).