提交 437d3e12 编写于 作者: T Tony Lu 提交者: Chris Metcalf

tile: ftrace: fix function_graph tracer issues

- Add support for ARCH_SUPPORTS_FTRACE_OPS
- Replace the instruction in ftrace_call with the bundle {move r10, lr;
jal ftrace_stub}, so that the lr contains the right value after returning
from ftrace_stub.  An alternative fix might be to leave the instruction
in ftrace_call alone when it is being updated with ftrace_stub.
Signed-off-by: NTony Lu <zlu@ezchip.com>
Signed-off-by: NChris Metcalf <cmetcalf@ezchip.com>
上级 a84f2423
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
extern void __mcount(void); extern void __mcount(void);
#define ARCH_SUPPORTS_FTRACE_OPS 1
#ifdef CONFIG_DYNAMIC_FTRACE #ifdef CONFIG_DYNAMIC_FTRACE
static inline unsigned long ftrace_call_adjust(unsigned long addr) static inline unsigned long ftrace_call_adjust(unsigned long addr)
{ {
......
...@@ -74,7 +74,11 @@ static unsigned long ftrace_gen_branch(unsigned long pc, unsigned long addr, ...@@ -74,7 +74,11 @@ static unsigned long ftrace_gen_branch(unsigned long pc, unsigned long addr,
create_JumpOff_X1(pcrel_by_instr); create_JumpOff_X1(pcrel_by_instr);
} }
if (addr == FTRACE_ADDR) { /*
* Also put { move r10, lr; jal ftrace_stub } in a bundle, which
* is used to replace the instruction in address ftrace_call.
*/
if (addr == FTRACE_ADDR || addr == (unsigned long)ftrace_stub) {
/* opcode: or r10, lr, zero */ /* opcode: or r10, lr, zero */
opcode_x0 = opcode_x0 =
create_Dest_X0(10) | create_Dest_X0(10) |
......
...@@ -81,7 +81,12 @@ STD_ENTRY(ftrace_caller) ...@@ -81,7 +81,12 @@ STD_ENTRY(ftrace_caller)
/* arg1: self return address */ /* arg1: self return address */
/* arg2: parent's return address */ /* arg2: parent's return address */
{ move r0, lr; move r1, r10 } /* arg3: ftrace_ops */
/* arg4: regs (but make it NULL) */
{ move r0, lr; moveli r2, hw2_last(function_trace_op) }
{ move r1, r10; shl16insli r2, r2, hw1(function_trace_op) }
{ movei r3, 0; shl16insli r2, r2, hw0(function_trace_op) }
ld r2,r2
.global ftrace_call .global ftrace_call
ftrace_call: ftrace_call:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册