From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@linux-foundation.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Geoff Levand <geoffrey.levand@am.sony.com>
Subject: [PATCH 6/7] powerpc32, ftrace: port function graph tracer to ppc32, static only
Date: Fri, 13 Feb 2009 00:24:04 -0500 [thread overview]
Message-ID: <20090213053006.314153453@goodmis.org> (raw)
In-Reply-To: 20090213052358.524970112@goodmis.org
[-- Attachment #1: 0006-powerpc32-ftrace-port-function-graph-tracer-to-ppc.patch --]
[-- Type: text/plain, Size: 2583 bytes --]
From: Steven Rostedt <rostedt@goodmis.org>
This patch ports the function graph tracer for PowerPC, but only
for static function tracing.
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
arch/powerpc/Kconfig | 2 +-
arch/powerpc/kernel/entry_32.S | 43 +++++++++++++++++++++++++++++++++++++++-
arch/powerpc/kernel/ftrace.c | 2 +-
3 files changed, 44 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 6e1ee1b..9e4bd20 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -111,7 +111,7 @@ config PPC
select HAVE_FTRACE_MCOUNT_RECORD
select HAVE_DYNAMIC_FTRACE
select HAVE_FUNCTION_TRACER
- select HAVE_FUNCTION_GRAPH_TRACER if PPC64
+ select HAVE_FUNCTION_GRAPH_TRACER if PPC64 || !DYNAMIC_FTRACE
select ARCH_WANT_OPTIONAL_GPIOLIB
select HAVE_IDE
select HAVE_IOREMAP_PROT
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index eb0c13e..9cf7083 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -1199,9 +1199,11 @@ _GLOBAL(_mcount)
mtctr r5
bctrl
-
nop
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
+ b ftrace_graph_caller
+#endif
MCOUNT_RESTORE_FRAME
bctr
@@ -1210,4 +1212,43 @@ _GLOBAL(_mcount)
_GLOBAL(ftrace_stub)
blr
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
+_GLOBAL(ftrace_graph_caller)
+ /* load r4 with local address */
+ lwz r4, 44(r1)
+ subi r4, r4, MCOUNT_INSN_SIZE
+
+ /* get the parent address */
+ addi r3, r1, 52
+
+ bl prepare_ftrace_return
+ nop
+
+ MCOUNT_RESTORE_FRAME
+ /* old link register ends up in ctr reg */
+ bctr
+
+_GLOBAL(return_to_handler)
+ /* need to save return values */
+ stwu r1, -32(r1)
+ stw r3, 20(r1)
+ stw r4, 16(r1)
+ stw r31, 12(r1)
+ mr r31, r1
+
+ bl ftrace_return_to_handler
+ nop
+
+ /* return value has real return address */
+ mtlr r3
+
+ lwz r3, 20(r1)
+ lwz r4, 16(r1)
+ lwz r31,12(r1)
+ lwz r1, 0(r1)
+
+ /* Jump back to real return address */
+ blr
+#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
+
#endif /* CONFIG_MCOUNT */
diff --git a/arch/powerpc/kernel/ftrace.c b/arch/powerpc/kernel/ftrace.c
index 5c6dfa9..dddd99b 100644
--- a/arch/powerpc/kernel/ftrace.c
+++ b/arch/powerpc/kernel/ftrace.c
@@ -603,7 +603,7 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
"1: " PPC_LL "%[old], 0(%[parent])\n"
"2: " PPC_STL "%[return_hooker], 0(%[parent])\n"
" li %[faulted], 0\n"
- "3:"
+ "3:\n"
".section .fixup, \"ax\"\n"
"4: li %[faulted], 1\n"
--
1.5.6.5
--
next prev parent reply other threads:[~2009-02-13 5:31 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-13 5:23 [PATCH 0/7] [git pull] powerpc function graph tracer Steven Rostedt
2009-02-13 5:23 ` [PATCH 1/7] tracing/function-graph-tracer: make arch generic push pop functions Steven Rostedt
2009-02-17 4:49 ` Steven Rostedt
2009-02-18 1:00 ` Ingo Molnar
2009-02-18 1:24 ` Steven Rostedt
2009-02-18 3:12 ` Benjamin Herrenschmidt
2009-02-18 3:48 ` Steven Rostedt
2009-02-18 12:53 ` Ingo Molnar
2009-02-18 17:29 ` Steven Rostedt
2009-02-13 5:24 ` [PATCH 2/7] powerpc64: port of the function graph tracer Steven Rostedt
2009-02-13 5:24 ` [PATCH 3/7] powerpc64, tracing: add function graph tracer with dynamic tracing Steven Rostedt
2009-02-13 5:24 ` [PATCH 4/7] powerpc64, ftrace: save toc only on modules for function graph Steven Rostedt
2009-02-13 5:24 ` [PATCH 5/7] powerpc32, ftrace: save and restore mcount regs with macro Steven Rostedt
2009-02-13 5:24 ` Steven Rostedt [this message]
2009-02-13 5:24 ` [PATCH 7/7] powerpc32, ftrace: dynamic function graph tracer 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=20090213053006.314153453@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=benh@kernel.crashing.org \
--cc=fweisbec@gmail.com \
--cc=geoffrey.levand@am.sony.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
/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