]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
powerpc32, ftrace: port function graph tracer to ppc32, static only
authorSteven Rostedt <rostedt@goodmis.org>
Thu, 12 Feb 2009 00:10:57 +0000 (19:10 -0500)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Sun, 22 Feb 2009 23:48:55 +0000 (10:48 +1100)
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>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/Kconfig
arch/powerpc/kernel/entry_32.S
arch/powerpc/kernel/ftrace.c

index b298fb0703dec1d1d8c71f62a5a647eb38af8967..f50b1c41a699418b79767f6e51675bf476d57c4a 100644 (file)
@@ -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
index fd54cb59728ef646b8384476c8d40ff6c62fb93e..12247b937d25c78157731b412872c39187b1857a 100644 (file)
@@ -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 */
index 5c6dfa97e83832e7cd323ba623bad8558f368e03..dddd99bbbd8d8c1599de912e75dc2307268dead6 100644 (file)
@@ -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"