linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tracing: Fix user stack trace "??" output
@ 2019-06-30  8:54 Eiichi Tsukata
  2019-07-18  1:23 ` Eiichi Tsukata
  0 siblings, 1 reply; 3+ messages in thread
From: Eiichi Tsukata @ 2019-06-30  8:54 UTC (permalink / raw)
  To: rostedt, tglx, peterz, mingo, linux-kernel; +Cc: Eiichi Tsukata

Commit c5c27a0a5838 ("x86/stacktrace: Remove the pointless ULONG_MAX
marker") removes ULONG_MAX marker from user stack trace entries but
trace_user_stack_print() still uses the marker and it outputs unnecessary
"??".

For example:

            less-1911  [001] d..2    34.758944: <user stack trace>
   =>  <00007f16f2295910>
   => ??
   => ??
   => ??
   => ??
   => ??
   => ??
   => ??

The user stack trace code zeroes the storage before saving the stack, so if
the trace is shorter than the maximum number of entries it can terminate
the print loop if a zero entry is detected.

Fixes: 4285f2fcef80 ("tracing: Remove the ULONG_MAX stack trace hackery")
Signed-off-by: Eiichi Tsukata <devel@etsukata.com>
---
 kernel/trace/trace_output.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
index ba751f993c3b..cab4a5398f1d 100644
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -1109,17 +1109,10 @@ static enum print_line_t trace_user_stack_print(struct trace_iterator *iter,
 	for (i = 0; i < FTRACE_STACK_ENTRIES; i++) {
 		unsigned long ip = field->caller[i];
 
-		if (ip == ULONG_MAX || trace_seq_has_overflowed(s))
+		if (!ip || trace_seq_has_overflowed(s))
 			break;
 
 		trace_seq_puts(s, " => ");
-
-		if (!ip) {
-			trace_seq_puts(s, "??");
-			trace_seq_putc(s, '\n');
-			continue;
-		}
-
 		seq_print_user_ip(s, mm, ip, flags);
 		trace_seq_putc(s, '\n');
 	}
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] tracing: Fix user stack trace "??" output
  2019-06-30  8:54 [PATCH] tracing: Fix user stack trace "??" output Eiichi Tsukata
@ 2019-07-18  1:23 ` Eiichi Tsukata
  2019-07-18 16:37   ` Steven Rostedt
  0 siblings, 1 reply; 3+ messages in thread
From: Eiichi Tsukata @ 2019-07-18  1:23 UTC (permalink / raw)
  To: rostedt, linux-kernel; +Cc: tglx, peterz, mingo

Hello Steven

Would you review the patch?

On 2019/06/30 17:54, Eiichi Tsukata wrote:
> Commit c5c27a0a5838 ("x86/stacktrace: Remove the pointless ULONG_MAX
> marker") removes ULONG_MAX marker from user stack trace entries but
> trace_user_stack_print() still uses the marker and it outputs unnecessary
> "??".
> 
> For example:
> 
>             less-1911  [001] d..2    34.758944: <user stack trace>
>    =>  <00007f16f2295910>
>    => ??
>    => ??
>    => ??
>    => ??
>    => ??
>    => ??
>    => ??
> 
> The user stack trace code zeroes the storage before saving the stack, so if
> the trace is shorter than the maximum number of entries it can terminate
> the print loop if a zero entry is detected.
> 
> Fixes: 4285f2fcef80 ("tracing: Remove the ULONG_MAX stack trace hackery")
> Signed-off-by: Eiichi Tsukata <devel@etsukata.com>
> ---
>  kernel/trace/trace_output.c | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
> index ba751f993c3b..cab4a5398f1d 100644
> --- a/kernel/trace/trace_output.c
> +++ b/kernel/trace/trace_output.c
> @@ -1109,17 +1109,10 @@ static enum print_line_t trace_user_stack_print(struct trace_iterator *iter,
>  	for (i = 0; i < FTRACE_STACK_ENTRIES; i++) {
>  		unsigned long ip = field->caller[i];
>  
> -		if (ip == ULONG_MAX || trace_seq_has_overflowed(s))
> +		if (!ip || trace_seq_has_overflowed(s))
>  			break;
>  
>  		trace_seq_puts(s, " => ");
> -
> -		if (!ip) {
> -			trace_seq_puts(s, "??");
> -			trace_seq_putc(s, '\n');
> -			continue;
> -		}
> -
>  		seq_print_user_ip(s, mm, ip, flags);
>  		trace_seq_putc(s, '\n');
>  	}
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] tracing: Fix user stack trace "??" output
  2019-07-18  1:23 ` Eiichi Tsukata
@ 2019-07-18 16:37   ` Steven Rostedt
  0 siblings, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2019-07-18 16:37 UTC (permalink / raw)
  To: Eiichi Tsukata; +Cc: linux-kernel, tglx, peterz, mingo

On Thu, 18 Jul 2019 10:23:19 +0900
Eiichi Tsukata <devel@etsukata.com> wrote:

> Hello Steven
> 
> Would you review the patch?

Thanks for reminding me. Looks good, I'll apply it now and start
testing it.

-- Steve


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-18 16:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-30  8:54 [PATCH] tracing: Fix user stack trace "??" output Eiichi Tsukata
2019-07-18  1:23 ` Eiichi Tsukata
2019-07-18 16:37   ` Steven Rostedt

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).