[RFC PATCH 4/6] powerpc/perf: Include traced function in the callchain
From: Naveen N. Rao
Date: Fri May 21 2021 - 02:50:09 EST
With -mprofile-kernel and ppc32, the function tracer is invoked before a
function sets up its own stackframe. This results in the traced function
not appearing in stack traces. Fix this by checking for ftrace entry and
including the traced function in the perf callchain.
Signed-off-by: Naveen N. Rao <naveen.n.rao@xxxxxxxxxxxxxxxxxx>
---
arch/powerpc/perf/callchain.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/powerpc/perf/callchain.c b/arch/powerpc/perf/callchain.c
index 6c028ee513c0d7..ed4dd4ab6621f6 100644
--- a/arch/powerpc/perf/callchain.c
+++ b/arch/powerpc/perf/callchain.c
@@ -93,6 +93,11 @@ perf_callchain_kernel(struct perf_callchain_entry_ctx *entry, struct pt_regs *re
}
perf_callchain_store(entry, next_ip);
+ if (level && next_ip) {
+ next_ip = ftrace_get_traced_func_if_no_stackframe(next_ip, fp);
+ if (next_ip)
+ perf_callchain_store(entry, next_ip);
+ }
if (!valid_next_sp(next_sp, sp))
return;
sp = next_sp;
--
2.30.2