mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Luca Ceresoli" <luca.ceresoli@bootlin.com>
To: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>,
	"Matthieu Baerts" <matttbe@kernel.org>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Sasha Levin" <sashal@kernel.org>
Cc: "Carlos Llamas" <cmllamas@google.com>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3] decode_stacktrace: Decode caller address
Date: Tue, 10 Mar 2026 19:40:33 +0100	[thread overview]
Message-ID: <DGZBLX5O6BBE.3AJBHQH98H40B@bootlin.com> (raw)
In-Reply-To: <177275821652.1557019.18367881408364381866.stgit@mhiramat.tok.corp.google.com>

Hello Masami,

On Fri Mar 6, 2026 at 1:50 AM CET, Masami Hiramatsu (Google) wrote:
> From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
>
> Decode the caller address instead of the return address by default.
> This also introduced -R option to provide return address decoding
> mode.
>
> This changes the decode_stacktrace.sh to decode the line info 1byte
> before the return address which will be the call(branch) instruction
> address. If the return address is a symbol address (zero offset from
> it), it falls back to decoding the return address.
>
> This improves results especially when optimizations have changed the
> order of the lines around the return address, or when the return
> address does not have the actual line information.
>
> With this change;
>  Call Trace:
>   <TASK>
>   dump_stack_lvl (lib/dump_stack.c:94 lib/dump_stack.c:120)
>   lockdep_rcu_suspicious (kernel/locking/lockdep.c:6876)
>   event_filter_pid_sched_process_fork (kernel/trace/trace_events.c:1057)
>   kernel_clone (include/trace/events/sched.h:396 include/trace/events/sched.h:396 kernel/fork.c:2664)
>   __x64_sys_clone (kernel/fork.c:2795 kernel/fork.c:2779 kernel/fork.c:2779)
>   do_syscall_64 (arch/x86/entry/syscall_64.c:63 arch/x86/entry/syscall_64.c:94)
>   ? entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:121)
>   ? trace_irq_disable (include/trace/events/preemptirq.h:36)
>   entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:121)
>
>
> Without this (or give -R option);
>  Call Trace:
>   <TASK>
>   dump_stack_lvl (lib/dump_stack.c:122)
>   lockdep_rcu_suspicious (kernel/locking/lockdep.c:6877)
>   event_filter_pid_sched_process_fork (kernel/trace/trace_events.c:?)
>   kernel_clone (include/trace/events/sched.h:? include/trace/events/sched.h:396 kernel/fork.c:2664)
>   __x64_sys_clone (kernel/fork.c:2779)
>   do_syscall_64 (arch/x86/entry/syscall_64.c:?)
>   ? entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130)
>   ? trace_irq_disable (include/trace/events/preemptirq.h:36)
>   entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130)
>
> Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>

An oops just happened on some code I'm working on on ARM64 (i.MX8MP) and
decode_stacktrace produced a way more precise output with the patch
applied.

Tested-by: Luca Ceresoli <luca.ceresoli@bootlin.com> # arm64

--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

      parent reply	other threads:[~2026-03-10 18:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-06  0:50 Masami Hiramatsu (Google)
2026-03-06  9:48 ` Matthieu Baerts
2026-03-10 18:40 ` Luca Ceresoli [this message]

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=DGZBLX5O6BBE.3AJBHQH98H40B@bootlin.com \
    --to=luca.ceresoli@bootlin.com \
    --cc=akpm@linux-foundation.org \
    --cc=cmllamas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matttbe@kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=sashal@kernel.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

all inboxes | Powered by JetHome®