From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Tatsuya S <tatsuya.s2862@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH v3] ftrace: Hide a extra entry in stack trace
Date: Fri, 4 Oct 2024 23:17:32 +0900 [thread overview]
Message-ID: <20241004231732.247301975e1e8f1511b50c6a@kernel.org> (raw)
In-Reply-To: <20241002051347.4239-3-tatsuya.s2862@gmail.com>
On Wed, 2 Oct 2024 14:13:48 +0900
Tatsuya S <tatsuya.s2862@gmail.com> wrote:
> A extra entry is shown on stack trace(CONFIG_UNWINDER_ORC=y).
>
> [003] ..... 110.171589: vfs_write <-__x64_sys_write
> [003] ..... 110.171600: <stack trace>
> => XXXXXXXXX (Wrong function name)
> => vfs_write
> => ksys_write
> => do_syscall_64
> => entry_SYSCALL_64_after_hwframe
>
> To resolve this, increment skip for __ftrace_trace_stack() in
> function_stack_trace_call().
> The reason why skip is incremented for __ftrace_trace_stack()
> is because __ftrace_trace_stack() in stack trace is the only function
> that wasn't skipped from anywhere.
Hi Tatsuya,
Can you focus on making test cases which checks what combinations caused
this wrong values and what does not? Also it should be checked with
various kconfigs. That is more valuable than making add-hoc fixes.
Thank you,
>
> Signed-off-by: Tatsuya S <tatsuya.s2862@gmail.com>
> ---
> V2 -> V3: Changed the place to increment skip number
> V1 -> V2: Fixed redundant code
>
> kernel/trace/trace_functions.c | 24 +++++++++++-------------
> 1 file changed, 11 insertions(+), 13 deletions(-)
>
> diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c
> index 3b0cea37e029..27089d8e65d4 100644
> --- a/kernel/trace/trace_functions.c
> +++ b/kernel/trace/trace_functions.c
> @@ -203,23 +203,21 @@ function_trace_call(unsigned long ip, unsigned long parent_ip,
> ftrace_test_recursion_unlock(bit);
> }
>
> -#ifdef CONFIG_UNWINDER_ORC
> -/*
> - * Skip 2:
> - *
> - * function_stack_trace_call()
> - * ftrace_call()
> - */
> -#define STACK_SKIP 2
> -#else
> /*
> * Skip 3:
> - * __trace_stack()
> - * function_stack_trace_call()
> - * ftrace_call()
> + * Skipped functions if CONFIG_UNWINDER_ORC is defined
> + *
> + * __ftrace_trace_stack()
> + * function_stack_trace_call()
> + * ftrace_call()
> + *
> + * Otherwise
> + *
> + * __trace_stack()
> + * function_stack_trace_call()
> + * ftrace_call()
> */
> #define STACK_SKIP 3
> -#endif
>
> static void
> function_stack_trace_call(unsigned long ip, unsigned long parent_ip,
> --
> 2.46.2
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
next prev parent reply other threads:[~2024-10-04 14:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-02 5:13 Tatsuya S
2024-10-02 13:56 ` Steven Rostedt
2024-10-02 15:28 ` Tatsuya S
2024-10-02 15:49 ` Steven Rostedt
2024-10-04 14:17 ` Masami Hiramatsu [this message]
2024-10-05 7:46 ` Tatsuya S
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=20241004231732.247301975e1e8f1511b50c6a@kernel.org \
--to=mhiramat@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=rostedt@goodmis.org \
--cc=tatsuya.s2862@gmail.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 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®