diff options
author | Palmer Dabbelt <palmer@sifive.com> | 2018-04-02 20:30:49 -0700 |
---|---|---|
committer | Palmer Dabbelt <palmer@sifive.com> | 2018-04-02 20:30:49 -0700 |
commit | 1cead2d7fec53a8d385934caefcf5dbb1b7d778b (patch) | |
tree | f62b6429a1853e0d9627733a2f9ea7b4baeed937 /arch/riscv/kernel/stacktrace.c | |
parent | 0adb32858b0bddf4ada5f364a84ed60b196dbcda (diff) | |
parent | b785ec129bd9498ecd6e221e45820b00c6ed4adf (diff) |
RISC-V: Add dynamic ftrace support for RISC-V platforms
This patch set includes the building blocks of dynamic ftrace features
for RISC-V machines. I'm afraid I'm not very familiar with ftrace, but
the code looks OK to me. It's been used to track down a performance
problem in our SPI driver and appears to work acceptably, but we haven't
given it a whole lot of banging yet so there might still be some bugs
lurking around somewhere.
Diffstat (limited to 'arch/riscv/kernel/stacktrace.c')
-rw-r--r-- | arch/riscv/kernel/stacktrace.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/riscv/kernel/stacktrace.c b/arch/riscv/kernel/stacktrace.c index 559aae781154..a4b1d94371a0 100644 --- a/arch/riscv/kernel/stacktrace.c +++ b/arch/riscv/kernel/stacktrace.c @@ -18,6 +18,7 @@ #include <linux/sched/debug.h> #include <linux/sched/task_stack.h> #include <linux/stacktrace.h> +#include <linux/ftrace.h> #ifdef CONFIG_FRAME_POINTER @@ -63,7 +64,12 @@ static void notrace walk_stackframe(struct task_struct *task, frame = (struct stackframe *)fp - 1; sp = fp; fp = frame->fp; +#ifdef HAVE_FUNCTION_GRAPH_RET_ADDR_PTR + pc = ftrace_graph_ret_addr(current, NULL, frame->ra, + (unsigned long *)(fp - 8)); +#else pc = frame->ra - 0x4; +#endif } } |