aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorRabin Vincent <rabin@rab.in>2012-01-24 10:52:52 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2012-01-25 04:24:37 -0500
commitd68133b5a81bd9c4b673c2a731ac1a33a9dc0cb8 (patch)
tree4cd5cee5bb4023fdc1f92c9fbdf733167f0a0b5a /arch/arm
parent34ae6c96a6a7db4ed8ec0524bf7fa1086b9ab2ba (diff)
ARM: 7299/1: ftrace: clear zero bit in reported IPs for Thumb-2
The dynamic ftrace ops startup test currently fails on Thumb-2 kernels: Testing tracer function: PASSED Testing dynamic ftrace: PASSED Testing dynamic ftrace ops #1: (0 0 0 0 0) FAILED! This is because while the addresses in the mcount records do not have the zero bit set, the IP reported by the mcount call does have it set (because it is copied from the LR). This mismatch causes the ops filtering in ftrace_ops_list_func() to not call the relevant tracers. Fix this by clearing the zero bit before adjusting the LR for the mcount instruction size. Also, combine the mov+sub into a single sub instruction. Acked-by: Dave Martin <dave.martin@linaro.org> Signed-off-by: Rabin Vincent <rabin@rab.in> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/kernel/entry-common.S15
1 files changed, 9 insertions, 6 deletions
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index 520889cf1b5b..9fd0ba90c1d2 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -149,6 +149,11 @@ ENDPROC(ret_from_fork)
149#endif 149#endif
150#endif 150#endif
151 151
152.macro mcount_adjust_addr rd, rn
153 bic \rd, \rn, #1 @ clear the Thumb bit if present
154 sub \rd, \rd, #MCOUNT_INSN_SIZE
155.endm
156
152.macro __mcount suffix 157.macro __mcount suffix
153 mcount_enter 158 mcount_enter
154 ldr r0, =ftrace_trace_function 159 ldr r0, =ftrace_trace_function
@@ -173,8 +178,7 @@ ENDPROC(ret_from_fork)
173 mcount_exit 178 mcount_exit
174 179
1751: mcount_get_lr r1 @ lr of instrumented func 1801: mcount_get_lr r1 @ lr of instrumented func
176 mov r0, lr @ instrumented function 181 mcount_adjust_addr r0, lr @ instrumented function
177 sub r0, r0, #MCOUNT_INSN_SIZE
178 adr lr, BSYM(2f) 182 adr lr, BSYM(2f)
179 mov pc, r2 183 mov pc, r2
1802: mcount_exit 1842: mcount_exit
@@ -184,8 +188,7 @@ ENDPROC(ret_from_fork)
184 mcount_enter 188 mcount_enter
185 189
186 mcount_get_lr r1 @ lr of instrumented func 190 mcount_get_lr r1 @ lr of instrumented func
187 mov r0, lr @ instrumented function 191 mcount_adjust_addr r0, lr @ instrumented function
188 sub r0, r0, #MCOUNT_INSN_SIZE
189 192
190 .globl ftrace_call\suffix 193 .globl ftrace_call\suffix
191ftrace_call\suffix: 194ftrace_call\suffix:
@@ -205,11 +208,11 @@ ftrace_graph_call\suffix:
205#ifdef CONFIG_DYNAMIC_FTRACE 208#ifdef CONFIG_DYNAMIC_FTRACE
206 @ called from __ftrace_caller, saved in mcount_enter 209 @ called from __ftrace_caller, saved in mcount_enter
207 ldr r1, [sp, #16] @ instrumented routine (func) 210 ldr r1, [sp, #16] @ instrumented routine (func)
211 mcount_adjust_addr r1, r1
208#else 212#else
209 @ called from __mcount, untouched in lr 213 @ called from __mcount, untouched in lr
210 mov r1, lr @ instrumented routine (func) 214 mcount_adjust_addr r1, lr @ instrumented routine (func)
211#endif 215#endif
212 sub r1, r1, #MCOUNT_INSN_SIZE
213 mov r2, fp @ frame pointer 216 mov r2, fp @ frame pointer
214 bl prepare_ftrace_return 217 bl prepare_ftrace_return
215 mcount_exit 218 mcount_exit