aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/entry_64.S
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-02-11 15:45:49 -0500
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-02-22 18:48:54 -0500
commitbb7253403f7a4670a128e4c080fd8ea1bd4d5029 (patch)
treef2ee8c966035a67be77fad922ada4c4d52a53be9 /arch/powerpc/kernel/entry_64.S
parent465428884765b43d642a967915e16c6c7cacbe8e (diff)
powerpc64, ftrace: save toc only on modules for function graph
The TOCS used by modules are different than the one used by the core kernel code. The function graph tracer must save and restore the TOC whenever it traces a module call. But this is an added overhead to burden the majority of core kernel code being traced. Benjamin Herrenschmidt suggested in testing the entry of the call to tell if it is a core kernel function or a module. He recommended using the REGION_ID() macro to perform this test. This patch implements Benjamin's idea, and uses a different return_to_handler routine dependent on if the entry is a core kernel function or not. The module version saves the TOC, where as the core kernel version does not. Geoff Lavand tested on PS3. Tested-by: Geoff Levand <geoffrey.levand@am.sony.com> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Steven Rostedt <srostedt@redhat.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/entry_64.S')
-rw-r--r--arch/powerpc/kernel/entry_64.S27
1 files changed, 26 insertions, 1 deletions
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 9f61fd61f277..abfc32330479 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -971,6 +971,28 @@ _GLOBAL(ftrace_graph_caller)
971 971
972_GLOBAL(return_to_handler) 972_GLOBAL(return_to_handler)
973 /* need to save return values */ 973 /* need to save return values */
974 std r4, -24(r1)
975 std r3, -16(r1)
976 std r31, -8(r1)
977 mr r31, r1
978 stdu r1, -112(r1)
979
980 bl .ftrace_return_to_handler
981 nop
982
983 /* return value has real return address */
984 mtlr r3
985
986 ld r1, 0(r1)
987 ld r4, -24(r1)
988 ld r3, -16(r1)
989 ld r31, -8(r1)
990
991 /* Jump back to real return address */
992 blr
993
994_GLOBAL(mod_return_to_handler)
995 /* need to save return values */
974 std r4, -32(r1) 996 std r4, -32(r1)
975 std r3, -24(r1) 997 std r3, -24(r1)
976 /* save TOC */ 998 /* save TOC */
@@ -979,7 +1001,10 @@ _GLOBAL(return_to_handler)
979 mr r31, r1 1001 mr r31, r1
980 stdu r1, -112(r1) 1002 stdu r1, -112(r1)
981 1003
982 /* update the TOC */ 1004 /*
1005 * We are in a module using the module's TOC.
1006 * Switch to our TOC to run inside the core kernel.
1007 */
983 LOAD_REG_IMMEDIATE(r4,ftrace_return_to_handler) 1008 LOAD_REG_IMMEDIATE(r4,ftrace_return_to_handler)
984 ld r2, 8(r4) 1009 ld r2, 8(r4)
985 1010