Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1321885

Re: [PATCH] s390:ftrace: add save_stack_trace_regs()

From Heiko Carstens <heiko.carstens@de.ibm.com>
Newsgroups linux.kernel
Subject Re: [PATCH] s390:ftrace: add save_stack_trace_regs()
Date 2016-01-29 17:50 +0100
Message-ID <qWkpc-5W2-7@gated-at.bofh.it> (permalink)
References (1 earlier) <qWd4m-cs-11@gated-at.bofh.it> <qWgOD-3ad-23@gated-at.bofh.it> <qWhKG-3Ue-13@gated-at.bofh.it> <qWix5-4ym-29@gated-at.bofh.it> <qWj9M-553-29@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Jan 29, 2016 at 10:22:41AM -0500, Steven Rostedt wrote:
> > No, that doesn't fix it (current Linus' master):
> > 
> > # uname -a
> > Linux p2345007 4.5.0-rc1-00032-g26cd83670f2f #26 SMP Fri Jan 29 15:39:47 CET 2016 s390x s390x s390x GNU/Linux
> > 
> > # cat stack_max_size 
> > 4496
> > 
> > # cat stack_trace
> >         Depth    Size   Location    (0 entries)
> >         -----    ----   --------
> 
> Ah this stack trace. This is different than what Pratyush Anand is
> fixing. This is the stack tracer which uses function tracing. The other
> fix is to deal with stack traces from events, specifically kprobes. As
> he stated, you test with:
> 
> # echo stacktrace > /sys/kernel/debug/tracing/trace_options
> # echo "p kfree" >> /sys/kernel/debug/tracing/kprobe_events
> # echo 1 > /sys/kernel/debug/tracing/events/kprobes/enable

Yes, I was aware of that, however the output of the trace file looked like
this:

            bash-1516  [003] d.s.    44.002233: p_kfree_0: (kfree+0x0/0x1a8)
            bash-1516  [003] d.s.    44.002233: <stack trace>
            bash-1540  [000] d...    44.002335: p_kfree_0: (kfree+0x0/0x1a8)
            bash-1540  [000] d...    44.002336: <stack trace>
            bash-1540  [000] d...    44.002338: p_kfree_0: (kfree+0x0/0x1a8)
            bash-1540  [000] d...    44.002338: <stack trace>

Which made me check the stack tracer which did not work anymore.

> But anyway, I'm curious, does this fix the issue for you?
> 
> -- Steve
> 
> diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
> index dda9e6742950..db1c26c385c7 100644
> --- a/kernel/trace/trace_stack.c
> +++ b/kernel/trace/trace_stack.c
> @@ -125,6 +125,9 @@ check_stack(unsigned long ip, unsigned long *stack)
>  			break;
>  	}
> 
> +	if (i == stack_trace_max.nr_entries)
> +		i = 0;
> +

With this patch the trace file now contains:

            bash-1543  [001] d...    31.273255: p_kfree_0: (kfree+0x0/0x1c0)
            bash-1543  [001] d...    31.273256: <stack trace>
 => pipe_release
 => __fput
 => task_work_run
 => do_notify_resume
 => system_call
            bash-1543  [001] d...    31.273400: p_kfree_0: (kfree+0x0/0x1c0)
            bash-1543  [001] d...    31.273400: <stack trace>
 => load_elf_binary
 => search_binary_handler
 => do_execveat_common.isra.14
 => SyS_execve
 => system_call

Which looks much better. The stack tracer also works again!

If the above is supposed to be the final fix, please feel free to add

Tested-by: Heiko Carstens <heiko.carstens@de.ibm.com>

Thanks a lot, Steven!

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] s390:ftrace: add save_stack_trace_regs() Pratyush Anand <panand@redhat.com> - 2016-01-29 06:30 +0100
  Re: [PATCH] s390:ftrace: add save_stack_trace_regs() Heiko Carstens <heiko.carstens@de.ibm.com> - 2016-01-29 10:00 +0100
    Re: [PATCH] s390:ftrace: add save_stack_trace_regs() Heiko Carstens <heiko.carstens@de.ibm.com> - 2016-01-29 14:00 +0100
      Re: [PATCH] s390:ftrace: add save_stack_trace_regs() Steven Rostedt <rostedt@goodmis.org> - 2016-01-29 15:00 +0100
        Re: [PATCH] s390:ftrace: add save_stack_trace_regs() Heiko Carstens <heiko.carstens@de.ibm.com> - 2016-01-29 15:50 +0100
          Re: [PATCH] s390:ftrace: add save_stack_trace_regs() Steven Rostedt <rostedt@goodmis.org> - 2016-01-29 16:30 +0100
            Re: [PATCH] s390:ftrace: add save_stack_trace_regs() Heiko Carstens <heiko.carstens@de.ibm.com> - 2016-01-29 17:50 +0100
              Re: [PATCH] s390:ftrace: add save_stack_trace_regs() Steven Rostedt <rostedt@goodmis.org> - 2016-01-29 18:00 +0100
                Re: [PATCH] s390:ftrace: add save_stack_trace_regs() Heiko Carstens <heiko.carstens@de.ibm.com> - 2016-01-29 18:20 +0100
  Re: [PATCH] s390:ftrace: add save_stack_trace_regs() Heiko Carstens <heiko.carstens@de.ibm.com> - 2016-02-01 10:10 +0100

csiph-web