From: Steven Rostedt <rostedt@goodmis.org>
To: Puranjay Mohan <puranjay@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
"Madhavan T. Venkataraman" <madvenka@linux.microsoft.com>,
Kalesh Singh <kaleshsingh@google.com>,
chenqiwu <qiwuchen55@gmail.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, puranjay12@gmail.com
Subject: Re: [PATCH] arm64: stacktrace: fix the usage of ftrace_graph_ret_addr()
Date: Tue, 18 Jun 2024 12:50:31 -0400 [thread overview]
Message-ID: <20240618125031.22642d40@rorschach.local.home> (raw)
In-Reply-To: <20240618162342.28275-1-puranjay@kernel.org>
On Tue, 18 Jun 2024 16:23:42 +0000
Puranjay Mohan <puranjay@kernel.org> wrote:
> ftrace_graph_ret_addr() takes an 'idx' integer pointer that is used to
> optimize the stack unwinding process. arm64 currently passes `NULL` for
> this parameter which stops it from utilizing these optimizations.
It no longer is an optimization (in linux-next). If it's not included,
it doesn't bother to find what the "return_to_handler" actually points to.
>
> Further, the current code for ftrace_graph_ret_addr() will just return
> the passed in return address if it is NULL which will break this usage.
>
> Pass a valid integer pointer to ftrace_graph_ret_addr() similar to
> x86_64's stack unwinder.
In the next merge window, this will not work. Besides the comment about
"optimization" not the real reason for this change...
Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
-- Steve
>
> Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
> ---
> arch/arm64/kernel/stacktrace.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c
> index 6b3258860377..2729faaee4b4 100644
> --- a/arch/arm64/kernel/stacktrace.c
> +++ b/arch/arm64/kernel/stacktrace.c
> @@ -25,6 +25,7 @@
> *
> * @common: Common unwind state.
> * @task: The task being unwound.
> + * @graph_idx: Used by ftrace_graph_ret_addr() for optimized stack unwinding.
> * @kr_cur: When KRETPROBES is selected, holds the kretprobe instance
> * associated with the most recently encountered replacement lr
> * value.
> @@ -32,6 +33,7 @@
> struct kunwind_state {
> struct unwind_state common;
> struct task_struct *task;
> + int graph_idx;
> #ifdef CONFIG_KRETPROBES
> struct llist_node *kr_cur;
> #endif
> @@ -106,7 +108,7 @@ kunwind_recover_return_address(struct kunwind_state *state)
> if (state->task->ret_stack &&
> (state->common.pc == (unsigned long)return_to_handler)) {
> unsigned long orig_pc;
> - orig_pc = ftrace_graph_ret_addr(state->task, NULL,
> + orig_pc = ftrace_graph_ret_addr(state->task, &state->graph_idx,
> state->common.pc,
> (void *)state->common.fp);
> if (WARN_ON_ONCE(state->common.pc == orig_pc))
next prev parent reply other threads:[~2024-06-18 16:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-18 16:23 [PATCH] arm64: stacktrace: fix the usage of ftrace_graph_ret_addr() Puranjay Mohan
2024-06-18 16:50 ` Steven Rostedt [this message]
2024-06-18 17:42 ` Mark Rutland
2024-06-19 12:43 ` Will Deacon
2024-06-24 20:17 ` Steven Rostedt
2024-08-29 17:54 ` Mark Rutland
2024-09-03 20:07 ` Steven Rostedt
2024-09-04 16:50 ` Steven Rostedt
2024-09-04 16:51 ` Steven Rostedt
2024-09-05 17:19 ` Catalin Marinas
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=20240618125031.22642d40@rorschach.local.home \
--to=rostedt@goodmis.org \
--cc=catalin.marinas@arm.com \
--cc=kaleshsingh@google.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=madvenka@linux.microsoft.com \
--cc=mark.rutland@arm.com \
--cc=puranjay12@gmail.com \
--cc=puranjay@kernel.org \
--cc=qiwuchen55@gmail.com \
--cc=will@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