From: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
To: Steven Rostedt <rostedt@goodmis.org>,
Michael Ellerman <mpe@ellerman.id.au>,
Michal Suchanek <msuchanek@suse.de>, Torsten Duwe <duwe@suse.de>
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: [RFC PATCH 3/6] powerpc: Indicate traced function name in show_stack()
Date: Fri, 21 May 2021 12:18:38 +0530 [thread overview]
Message-ID: <9358c81e47f9d395d90691f77f50feaf20be963e.1621577151.git.naveen.n.rao@linux.vnet.ibm.com> (raw)
In-Reply-To: <cover.1621577151.git.naveen.n.rao@linux.vnet.ibm.com>
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.
With this patch, stack traces show the function traced next to the
ftrace entry:
NIP [c0080000003700d4] handler_pre+0x1c/0x5c [kprobe_example]
LR [c00000000006c118] kprobe_ftrace_handler+0x1b8/0x270
Call Trace:
[c00000001ed7fa50] [c00000001ed7faa0] 0xc00000001ed7faa0 (unreliable)
[c00000001ed7fab0] [c00000000006c118] kprobe_ftrace_handler+0x1b8/0x270
[c00000001ed7fb00] [c000000000076604] ftrace_regs_call+0x4/0xa4 (kernel_clone+0xc/0x600)
^^^^^^^^^^^^^^^^^^^^^^^^
[c00000001ed7fcf0] [c000000000139e08] __do_sys_clone+0x88/0xd0
[c00000001ed7fdb0] [c00000000002b6c4] system_call_exception+0xf4/0x200
[c00000001ed7fe10] [c00000000000ca5c] system_call_common+0xec/0x278
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
---
arch/powerpc/kernel/process.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 89e34aa273e21a..9df1d44939bec1 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -2160,6 +2160,9 @@ void show_stack(struct task_struct *tsk, unsigned long *stack,
&ftrace_idx, ip, stack);
if (ret_addr != ip)
pr_cont(" (%pS)", (void *)ret_addr);
+ ip = ftrace_get_traced_func_if_no_stackframe(ip, stack);
+ if (ip)
+ pr_cont(" (%pS)", (void *)ip);
if (firstframe)
pr_cont(" (unreliable)");
pr_cont("\n");
--
2.30.2
next prev parent reply other threads:[~2021-05-21 6:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-21 6:48 [RFC PATCH 0/6] powerpc: Stack tracer fixes Naveen N. Rao
2021-05-21 6:48 ` [RFC PATCH 1/6] trace/stack: Move code to save the stack trace into a separate function Naveen N. Rao
2021-06-01 15:28 ` Steven Rostedt
2021-06-02 10:35 ` Naveen N. Rao
2021-06-02 14:09 ` Steven Rostedt
2021-05-21 6:48 ` [RFC PATCH 2/6] powerpc/trace: Add support for stack tracer Naveen N. Rao
2021-06-01 13:51 ` Naveen N. Rao
2021-05-21 6:48 ` Naveen N. Rao [this message]
2021-05-21 6:48 ` [RFC PATCH 4/6] powerpc/perf: Include traced function in the callchain Naveen N. Rao
2021-05-21 6:48 ` [RFC PATCH 5/6] powerpc/stacktrace: Include ftraced function in arch_stack_walk_reliable() Naveen N. Rao
2021-05-21 6:48 ` [RFC PATCH 6/6] powerpc/stacktrace: Include ftraced function in arch_stack_walk() Naveen N. Rao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9358c81e47f9d395d90691f77f50feaf20be963e.1621577151.git.naveen.n.rao@linux.vnet.ibm.com \
--to=naveen.n.rao@linux.vnet.ibm.com \
--cc=duwe@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=msuchanek@suse.de \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).