* [PATCH] ftrace: Hide a extra entry in stack trace
@ 2024-09-23 3:59 Tatsuya S
2024-09-26 5:05 ` Steven Rostedt
0 siblings, 1 reply; 3+ messages in thread
From: Tatsuya S @ 2024-09-23 3:59 UTC (permalink / raw)
To: Steven Rostedt, Masami Hiramatsu, Mathieu Desnoyers
Cc: Tatsuya S, linux-kernel, linux-trace-kernel
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
=> __x64_sys_write
=> do_syscall_64
=> entry_SYSCALL_64_after_hwframe
To resolve this, increment skip in __ftrace_trace_stack().
The reason why skip is incremented in __ftrace_trace_stack()
is because __ftrace_trace_stack() in stack trace is the only function
that wasn't skipped from anywhere.
Signed-off-by: Tatsuya S <tatsuya.s2862@gmail.com>
---
kernel/trace/trace.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index c3b2c7dfadef..e0d98621ff23 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -2919,6 +2919,8 @@ static void __ftrace_trace_stack(struct trace_buffer *buffer,
#ifndef CONFIG_UNWINDER_ORC
if (!regs)
skip++;
+#else
+ skip++;
#endif
preempt_disable_notrace();
--
2.46.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ftrace: Hide a extra entry in stack trace
2024-09-23 3:59 [PATCH] ftrace: Hide a extra entry in stack trace Tatsuya S
@ 2024-09-26 5:05 ` Steven Rostedt
2024-09-26 5:43 ` ts
0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2024-09-26 5:05 UTC (permalink / raw)
To: Tatsuya S
Cc: Masami Hiramatsu, Mathieu Desnoyers, linux-kernel,
linux-trace-kernel
On Mon, 23 Sep 2024 12:59:15 +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
> => __x64_sys_write
> => do_syscall_64
> => entry_SYSCALL_64_after_hwframe
>
> To resolve this, increment skip in __ftrace_trace_stack().
> The reason why skip is incremented in __ftrace_trace_stack()
> is because __ftrace_trace_stack() in stack trace is the only function
> that wasn't skipped from anywhere.
>
> Signed-off-by: Tatsuya S <tatsuya.s2862@gmail.com>
> ---
> kernel/trace/trace.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index c3b2c7dfadef..e0d98621ff23 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -2919,6 +2919,8 @@ static void __ftrace_trace_stack(struct trace_buffer *buffer,
> #ifndef CONFIG_UNWINDER_ORC
> if (!regs)
> skip++;
> +#else
> + skip++;
> #endif
The above #ifdef block should be removed and replaced with;
if (IS_ENABLED(CONFIG_UNWINDER_ORC) || !regs)
skip++;
>
> preempt_disable_notrace();
-- Steve
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ftrace: Hide a extra entry in stack trace
2024-09-26 5:05 ` Steven Rostedt
@ 2024-09-26 5:43 ` ts
0 siblings, 0 replies; 3+ messages in thread
From: ts @ 2024-09-26 5:43 UTC (permalink / raw)
To: Steven Rostedt
Cc: Masami Hiramatsu, Mathieu Desnoyers, linux-kernel,
linux-trace-kernel
On 9/26/24 2:05 PM, Steven Rostedt wrote:
> On Mon, 23 Sep 2024 12:59:15 +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
>> => __x64_sys_write
>> => do_syscall_64
>> => entry_SYSCALL_64_after_hwframe
>>
>> To resolve this, increment skip in __ftrace_trace_stack().
>> The reason why skip is incremented in __ftrace_trace_stack()
>> is because __ftrace_trace_stack() in stack trace is the only function
>> that wasn't skipped from anywhere.
>>
>> Signed-off-by: Tatsuya S <tatsuya.s2862@gmail.com>
>> ---
>> kernel/trace/trace.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
>> index c3b2c7dfadef..e0d98621ff23 100644
>> --- a/kernel/trace/trace.c
>> +++ b/kernel/trace/trace.c
>> @@ -2919,6 +2919,8 @@ static void __ftrace_trace_stack(struct trace_buffer *buffer,
>> #ifndef CONFIG_UNWINDER_ORC
>> if (!regs)
>> skip++;
>> +#else
>> + skip++;
>> #endif
> The above #ifdef block should be removed and replaced with;
>
>
> if (IS_ENABLED(CONFIG_UNWINDER_ORC) || !regs)
> skip++;
>
>>
>> preempt_disable_notrace();
> -- Steve
I will submit a new patch to fix it.
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-09-26 5:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-23 3:59 [PATCH] ftrace: Hide a extra entry in stack trace Tatsuya S
2024-09-26 5:05 ` Steven Rostedt
2024-09-26 5:43 ` ts
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).