Re: [PATCH] Make Function Duration Tracer work with __gnu_mcount_nc

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Tim Bird
Date: Friday, March 19, 2010 - 2:53 pm

On 03/19/2010 02:43 PM, Ashwin Chaugule wrote:

Wow, interesting timing.  I just finished yesterday my own
version of this patch (for 2.6.29) - it looks amazingingly similar.

What's up with putting fp in r2 - is that required in the latest
prepare_ftrace_return()?
 -- Tim

------------- patch follows ----------------
Add support to __gnu_mcount_nc, used by newer (4.x?) Gnu compilers,
for ftrace function_graph support on ARM.

Signed-off-by: Tim Bird <tim.bird@am.sony.com>
---
 arch/arm/kernel/entry-common.S |   13 +++++++++++++
 1 file changed, 13 insertions(+)

--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -140,6 +140,12 @@ 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 gnu_ftrace_graph_caller
+#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
 	ldmia sp!, {r0-r3, ip, lr}
 	bx ip

@@ -196,6 +202,13 @@ return_to_handler:
 	ldmia sp!, {r0-r3}
 	mov pc, lr

+ENTRY(gnu_ftrace_graph_caller)
+	sub r0, fp, #4			@ &lr of instrumented routine (&parent)
+	sub r1, lr, #MCOUNT_INSN_SIZE	@ instrumented routine (func)
+	bl prepare_ftrace_return
+	ldmia sp!, {r0-r3, ip, lr}
+	bx ip
+
 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */

 #endif /* CONFIG_DYNAMIC_FTRACE */

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] Make Function Duration Tracer work with __gnu_ ..., Tim Bird, (Fri Mar 19, 2:53 pm)