riscv/ftrace: Add HAVE_FUNCTION_GRAPH_RET_ADDR_PTR support

In walk_stackframe, the pc now receives the address from calling
ftrace_graph_ret_addr instead of manual calculation.

Note that the original calculation,
        pc = frame->ra - 4
is buggy when the instruction at the return address happened to be a
compressed inst. But since it is not a critical part of ftrace, it is
ignored for now to ease the review process.

Cc: Greentime Hu <greentime@andestech.com>
Signed-off-by: Alan Kao <alankao@andestech.com>
Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
This commit is contained in:
Alan Kao
2018-02-13 13:13:21 +08:00
committed by Palmer Dabbelt
parent aea4c671fb
commit b785ec129b
2 changed files with 7 additions and 1 deletions

View File

@@ -151,7 +151,7 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr,
return;
err = ftrace_push_return_trace(old, self_addr, &trace.depth,
frame_pointer, NULL);
frame_pointer, parent);
if (err == -EBUSY)
return;
*parent = return_hooker;