public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Rajesh Bhagat <rajesh.lnx@gmail.com>
Subject: [PATCH 4/6] ftrace: Fix function_graph for archs that test ftrace_trace_function
Date: Wed, 14 Mar 2012 12:26:33 -0400	[thread overview]
Message-ID: <20120314162708.960391639@goodmis.org> (raw)
In-Reply-To: 20120314162629.118638243@goodmis.org

[-- Attachment #1: Type: text/plain, Size: 1885 bytes --]

From: Rajesh Bhagat <rajesh.lnx@gmail.com>

When CONFIG_DYNAMIC_FTRACE is not set, some archs (ARM) test
the variable function_trace_function to determine if it should
call the function tracer. If it is not set to ftrace_stub, then
it will call the function and return, and not call the function
graph tracer.

But some of these archs (ARM) do not have the assembly code
to test if function tracing is enabled or not (quick stop of tracing)
and it calls the helper routine ftrace_test_stop_func() instead.

If function tracer is enabled and then disabled, the variable
ftrace_trace_function is still set to the helper routine
ftrace_test_stop_func(), and not to ftrace_stub. This will
prevent the function graph tracer from ever running.

Output before patch
/debug/tracing # echo function > current_tracer
/debug/tracing # echo function_graph > current_tracer
/debug/tracing # cat trace

Output after patch
/debug/tracing # echo function > current_tracer
/debug/tracing # echo function_graph > current_tracer
/debug/tracing # cat trace
0) ! 253.375 us | } /* irq_enter */
0) | generic_handle_irq() {
0) | handle_fasteoi_irq() {
0) 9.208 us | _raw_spin_lock();
0) | handle_irq_event() {
0) | handle_irq_event_percpu() {

Signed-off-by: Rajesh Bhagat <rajesh.lnx@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/ftrace.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 867bd1d..0fa92f6 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -249,7 +249,8 @@ static void update_ftrace_function(void)
 #else
 	__ftrace_trace_function = func;
 #endif
-	ftrace_trace_function = ftrace_test_stop_func;
+	ftrace_trace_function =
+		(func == ftrace_stub) ? func : ftrace_test_stop_func;
 #endif
 }
 
-- 
1.7.8.3



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  parent reply	other threads:[~2012-03-14 16:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-14 16:26 [PATCH 0/6] [GIT PULL] tracing: updates Steven Rostedt
2012-03-14 16:26 ` [PATCH 1/6] tracing/ring-buffer: Only have tracing_on disable tracing buffers Steven Rostedt
2012-03-14 16:26 ` [PATCH 2/6] tracing: Do not select FRAME_POINTER on PPC Steven Rostedt
2012-03-14 16:26 ` [PATCH 3/6] tracing: Keep NMI watchdog from triggering when dumping trace Steven Rostedt
2012-03-14 16:26 ` Steven Rostedt [this message]
2012-03-14 16:26 ` [PATCH 5/6] tracing: Fix build breakage without CONFIG_PERF_EVENTS Steven Rostedt
2012-03-14 16:26 ` [PATCH 6/6] perf: Add ifdef to remove unused enum switch warnings Steven Rostedt
2012-03-19 10:59 ` [PATCH 0/6] [GIT PULL] tracing: updates Ingo Molnar
2012-03-19 14:46   ` Ingo Molnar
2012-03-20 13:48     ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120314162708.960391639@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rajesh.lnx@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox