lkml.org 
[lkml]   [2021]   [May]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH 5/6] powerpc/stacktrace: Include ftraced function in arch_stack_walk_reliable()
Date
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 stack trace.

Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
---
While I don't think we expect to see ftrace show up in the trace for a
non-running task, I think it is good to cover this scenario. I also
think it is ok to consider such traces to be reliable. But, I'm not sure
of the implications w.r.t livepatching.

- Naveen


arch/powerpc/kernel/stacktrace.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/arch/powerpc/kernel/stacktrace.c b/arch/powerpc/kernel/stacktrace.c
index 1deb1bf331ddbd..1e1be297c5d6c7 100644
--- a/arch/powerpc/kernel/stacktrace.c
+++ b/arch/powerpc/kernel/stacktrace.c
@@ -160,6 +160,10 @@ int arch_stack_walk_reliable(stack_trace_consume_fn consume_entry,

if (!consume_entry(cookie, ip))
return -EINVAL;
+
+ ip = ftrace_get_traced_func_if_no_stackframe(ip, stack);
+ if (ip && !consume_entry(cookie, ip))
+ return -EINVAL;
}
return 0;
}
--
2.30.2
\
 
 \ /
  Last update: 2021-05-21 08:50    [W:0.096 / U:0.228 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site