All of lore.kernel.org
 help / color / mirror / Atom feed
From: Puranjay Mohan <puranjay12@gmail.com>
To: "Paul Walmsley" <paul.walmsley@sifive.com>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Albert Ou" <aou@eecs.berkeley.edu>,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	"Björn Töpel" <bjorn@rivosinc.com>
Cc: puranjay12@gmail.com
Subject: [PATCH 0/2] riscv: ftrace: make stack walk more robust.
Date: Thu, 28 Mar 2024 18:40:18 +0000	[thread overview]
Message-ID: <20240328184020.34278-1-puranjay12@gmail.com> (raw)

The current stack walker in riscv implemented in walk_stackframe() provides
the PC to a callback function when it unwinds the stacks. This doesn't
allow implementing stack walkers that need access to more information like
the frame pointer, etc.

This series makes walk_stackframe() provide a unwinde_state structure to
callback functions. This structure has all the information that
walk_stackframe() can provide.

Currently, there are four users of walk_stackframe(): return_address(),
perf_callchain_kernel(), dump_backtrace(), and __get_wchan(). All of these
have been converted to use arch_stack_walk() rather than calling
walk_stackframe() directly.

We need this to implement arch_bpf_stack_walk() that provides a callback
that needs the FP, SP, and PC. This will be needed for implementing BFP
exceptions for RISCV.

There are no functional changes in this series.

I have tested this by crashing the kernel and looking at the stack trace
with and without CONFIG_FRAME_POINTER

Puranjay Mohan (2):
  riscv: stacktrace: use arch_stack_walk() in place of walk_stackframe
  riscv: stacktrace: make walk_stackframe() more robust

 arch/riscv/include/asm/stacktrace.h |  2 -
 arch/riscv/kernel/perf_callchain.c  |  2 +-
 arch/riscv/kernel/stacktrace.c      | 75 +++++++++++++++++++++++------
 3 files changed, 61 insertions(+), 18 deletions(-)

-- 
2.40.1


WARNING: multiple messages have this Message-ID (diff)
From: Puranjay Mohan <puranjay12@gmail.com>
To: "Paul Walmsley" <paul.walmsley@sifive.com>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Albert Ou" <aou@eecs.berkeley.edu>,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	"Björn Töpel" <bjorn@rivosinc.com>
Cc: puranjay12@gmail.com
Subject: [PATCH 0/2] riscv: ftrace: make stack walk more robust.
Date: Thu, 28 Mar 2024 18:40:18 +0000	[thread overview]
Message-ID: <20240328184020.34278-1-puranjay12@gmail.com> (raw)

The current stack walker in riscv implemented in walk_stackframe() provides
the PC to a callback function when it unwinds the stacks. This doesn't
allow implementing stack walkers that need access to more information like
the frame pointer, etc.

This series makes walk_stackframe() provide a unwinde_state structure to
callback functions. This structure has all the information that
walk_stackframe() can provide.

Currently, there are four users of walk_stackframe(): return_address(),
perf_callchain_kernel(), dump_backtrace(), and __get_wchan(). All of these
have been converted to use arch_stack_walk() rather than calling
walk_stackframe() directly.

We need this to implement arch_bpf_stack_walk() that provides a callback
that needs the FP, SP, and PC. This will be needed for implementing BFP
exceptions for RISCV.

There are no functional changes in this series.

I have tested this by crashing the kernel and looking at the stack trace
with and without CONFIG_FRAME_POINTER

Puranjay Mohan (2):
  riscv: stacktrace: use arch_stack_walk() in place of walk_stackframe
  riscv: stacktrace: make walk_stackframe() more robust

 arch/riscv/include/asm/stacktrace.h |  2 -
 arch/riscv/kernel/perf_callchain.c  |  2 +-
 arch/riscv/kernel/stacktrace.c      | 75 +++++++++++++++++++++++------
 3 files changed, 61 insertions(+), 18 deletions(-)

-- 
2.40.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

             reply	other threads:[~2024-03-28 18:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-28 18:40 Puranjay Mohan [this message]
2024-03-28 18:40 ` [PATCH 0/2] riscv: ftrace: make stack walk more robust Puranjay Mohan
2024-03-28 18:40 ` [PATCH 1/2] riscv: stacktrace: use arch_stack_walk() in place of walk_stackframe Puranjay Mohan
2024-03-28 18:40   ` Puranjay Mohan
2024-04-02 13:19   ` Björn Töpel
2024-04-02 13:19     ` Björn Töpel
2024-03-28 18:40 ` [PATCH 2/2] riscv: stacktrace: make walk_stackframe() more robust Puranjay Mohan
2024-03-28 18:40   ` Puranjay Mohan
2024-04-02 13:20   ` Björn Töpel
2024-04-02 13:20     ` Björn Töpel
2024-04-02 13:18 ` [PATCH 0/2] riscv: ftrace: make stack walk " Björn Töpel
2024-04-02 13:18   ` Björn Töpel

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=20240328184020.34278-1-puranjay12@gmail.com \
    --to=puranjay12@gmail.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=bjorn@rivosinc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.