linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tracing: Drop the tr check from the graph tracing path
@ 2010-01-14  7:23 Frederic Weisbecker
  2010-01-14 15:06 ` Steven Rostedt
  2010-01-17 18:30 ` [tip:tracing/core] " tip-bot for Frederic Weisbecker
  0 siblings, 2 replies; 3+ messages in thread
From: Frederic Weisbecker @ 2010-01-14  7:23 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: LKML, Frederic Weisbecker, Steven Rostedt, Lai Jiangshan,
	Paul E. McKenney

Each time we save a function entry from the function graph tracer,
we check if the trace array is set, which is wasteful because it is
set anyway before we start the tracer. All we need is to ensure we
have good read and write orderings. When we set the trace array, we
just need to guarantee it to be visible before starting tracing.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 kernel/trace/trace_functions_graph.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index b1342c5..f225229 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -212,9 +212,6 @@ int trace_graph_entry(struct ftrace_graph_ent *trace)
 	int cpu;
 	int pc;
 
-	if (unlikely(!tr))
-		return 0;
-
 	if (!ftrace_trace_task(current))
 		return 0;
 
@@ -287,11 +284,20 @@ void trace_graph_return(struct ftrace_graph_ret *trace)
 	local_irq_restore(flags);
 }
 
+void set_graph_array(struct trace_array *tr)
+{
+	graph_array = tr;
+
+	/* Make graph_array visible before we start tracing */
+
+	smp_mb();
+}
+
 static int graph_trace_init(struct trace_array *tr)
 {
 	int ret;
 
-	graph_array = tr;
+	set_graph_array(tr);
 	ret = register_ftrace_graph(&trace_graph_return,
 				    &trace_graph_entry);
 	if (ret)
@@ -301,11 +307,6 @@ static int graph_trace_init(struct trace_array *tr)
 	return 0;
 }
 
-void set_graph_array(struct trace_array *tr)
-{
-	graph_array = tr;
-}
-
 static void graph_trace_reset(struct trace_array *tr)
 {
 	tracing_stop_cmdline_record();
-- 
1.6.2.3


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

* Re: [PATCH] tracing: Drop the tr check from the graph tracing path
  2010-01-14  7:23 [PATCH] tracing: Drop the tr check from the graph tracing path Frederic Weisbecker
@ 2010-01-14 15:06 ` Steven Rostedt
  2010-01-17 18:30 ` [tip:tracing/core] " tip-bot for Frederic Weisbecker
  1 sibling, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2010-01-14 15:06 UTC (permalink / raw)
  To: Frederic Weisbecker; +Cc: Ingo Molnar, LKML, Lai Jiangshan, Paul E. McKenney

On Thu, 2010-01-14 at 08:23 +0100, Frederic Weisbecker wrote:
> Each time we save a function entry from the function graph tracer,
> we check if the trace array is set, which is wasteful because it is
> set anyway before we start the tracer. All we need is to ensure we
> have good read and write orderings. When we set the trace array, we
> just need to guarantee it to be visible before starting tracing.
> 
> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>

Acked-by: Steven Rostedt <rostedt@goodmis.org>

-- Steve

> Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> ---
>  kernel/trace/trace_functions_graph.c |   19 ++++++++++---------
>  1 files changed, 10 insertions(+), 9 deletions(-)



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

* [tip:tracing/core] tracing: Drop the tr check from the graph tracing path
  2010-01-14  7:23 [PATCH] tracing: Drop the tr check from the graph tracing path Frederic Weisbecker
  2010-01-14 15:06 ` Steven Rostedt
@ 2010-01-17 18:30 ` tip-bot for Frederic Weisbecker
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Frederic Weisbecker @ 2010-01-17 18:30 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, paulmck, fweisbec, rostedt, tglx, laijs, mingo

Commit-ID:  24a53652e361321b09df5040711e69387344ce09
Gitweb:     http://git.kernel.org/tip/24a53652e361321b09df5040711e69387344ce09
Author:     Frederic Weisbecker <fweisbec@gmail.com>
AuthorDate: Thu, 14 Jan 2010 08:23:15 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 17 Jan 2010 08:06:25 +0100

tracing: Drop the tr check from the graph tracing path

Each time we save a function entry from the function graph
tracer, we check if the trace array is set, which is wasteful
because it is set anyway before we start the tracer. All we need
is to ensure we have good read and write orderings. When we set
the trace array, we just need to guarantee it to be visible
before starting tracing.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
LKML-Reference: <1263453795-7496-1-git-send-regression-fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/trace/trace_functions_graph.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index b1342c5..f225229 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -212,9 +212,6 @@ int trace_graph_entry(struct ftrace_graph_ent *trace)
 	int cpu;
 	int pc;
 
-	if (unlikely(!tr))
-		return 0;
-
 	if (!ftrace_trace_task(current))
 		return 0;
 
@@ -287,11 +284,20 @@ void trace_graph_return(struct ftrace_graph_ret *trace)
 	local_irq_restore(flags);
 }
 
+void set_graph_array(struct trace_array *tr)
+{
+	graph_array = tr;
+
+	/* Make graph_array visible before we start tracing */
+
+	smp_mb();
+}
+
 static int graph_trace_init(struct trace_array *tr)
 {
 	int ret;
 
-	graph_array = tr;
+	set_graph_array(tr);
 	ret = register_ftrace_graph(&trace_graph_return,
 				    &trace_graph_entry);
 	if (ret)
@@ -301,11 +307,6 @@ static int graph_trace_init(struct trace_array *tr)
 	return 0;
 }
 
-void set_graph_array(struct trace_array *tr)
-{
-	graph_array = tr;
-}
-
 static void graph_trace_reset(struct trace_array *tr)
 {
 	tracing_stop_cmdline_record();

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

end of thread, other threads:[~2010-01-17 18:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-14  7:23 [PATCH] tracing: Drop the tr check from the graph tracing path Frederic Weisbecker
2010-01-14 15:06 ` Steven Rostedt
2010-01-17 18:30 ` [tip:tracing/core] " tip-bot for Frederic Weisbecker

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).