[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <4BA3F000.5030404@codeaurora.org>
Date: Fri, 19 Mar 2010 17:43:28 -0400
From: Ashwin Chaugule <ashwinc@...eaurora.org>
To: Tim Bird <tim.bird@...sony.com>,
Frederic Weisbecker <fweisbec@...il.com>,
Steven Rostedt <rostedt@...dmis.org>
CC: linux-arm-kernel <linux-arm-kernel@...ts.arm.linux.org.uk>,
linux kernel <linux-kernel@...r.kernel.org>,
linux-arm-msm@...r.kernel.org
Subject: [PATCH] Make Function Duration Tracer work with __gnu_mcount_nc
Is there a better way to fix this in the original ftrace_graph_caller ?
The lr isn't pushed on the stack before "bl mcount".
--
From: Ashwin Chaugule <ashwinc@...cinc.com>
Newer compilers use the __gnu_mcount_nc stub in every function
prologue. The lr of the instrumented function is pushed on the
stack before branching to __gnu_mcount_nc. Pop it before returning
back to instrumented function so that it can return to its parent
from its epilogue.
Signed-off-by: Ashwin Chaugule <ashwinc@...cinc.com>
---
arch/arm/kernel/entry-common.S | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index b8a9e47..30feac3 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -144,6 +144,14 @@ ENTRY(__gnu_mcount_nc)
adr r0, ftrace_stub
cmp r0, r2
bne gnu_trace
+
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
+ ldr r1, =ftrace_graph_return
+ ldr r2, [r1]
+ cmp r0, r2 @ if *ftrace_graph_return != ftrace_stub
+ bne new_ftrace_graph_caller
+#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
+
ldmia sp!, {r0-r3, ip, lr}
bx ip
@@ -155,6 +163,18 @@ gnu_trace:
mov pc, r2
ldmia sp!, {r0-r3, ip, lr}
bx ip
+
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
+ENTRY(new_ftrace_graph_caller) @ for use with __gnu_mcount_nc
+ sub r0, fp, #4 @ &lr of instrumented routine
(&parent)
+ mov r1, lr @ instrumented routine (func)
+ sub r1, r1, #MCOUNT_INSN_SIZE
+ mov r2, fp @ frame pointer
+ bl prepare_ftrace_return
+ ldmia sp!, {r0-r3, ip, lr} @ need to pop lr, pushed before
+ mov pc, ip @ bl __gnu_mcount_nc
+
+#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
ENTRY(mcount)
stmdb sp!, {r0-r3, lr}
--
1.5.6.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists