All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Carstens <heiko.carstens@de.ibm.com>
To: Pratyush Anand <panand@redhat.com>
Cc: schwidefsky@de.ibm.com, rostedt@goodmis.org,
	linux-s390@vger.kernel.org, Chunyu Hu <chuhu@redhat.com>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] s390:ftrace: add save_stack_trace_regs()
Date: Mon, 1 Feb 2016 10:00:11 +0100	[thread overview]
Message-ID: <20160201090011.GA4166@osiris> (raw)
In-Reply-To: <86d380d172bba0416aef64448b0e1b6a50fad326.1454044645.git.panand@redhat.com>

On Fri, Jan 29, 2016 at 10:50:28AM +0530, Pratyush Anand wrote:
> Implement save_stack_trace_regs, so that stacktrace of a kprobe events can
> be obtained.
> 
> Without this we see following warning:
> "save_stack_trace_regs() not implemented yet."
> when we execute:
> 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
> 
> Reported-by: Chunyu Hu <chuhu@redhat.com>
> Signed-off-by: Pratyush Anand <panand@redhat.com>
> ---
>  arch/s390/kernel/stacktrace.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/arch/s390/kernel/stacktrace.c b/arch/s390/kernel/stacktrace.c
> index 1785cd82253c..586da400f931 100644
> --- a/arch/s390/kernel/stacktrace.c
> +++ b/arch/s390/kernel/stacktrace.c
> @@ -94,3 +94,16 @@ void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
>  		trace->entries[trace->nr_entries++] = ULONG_MAX;
>  }
>  EXPORT_SYMBOL_GPL(save_stack_trace_tsk);
> +
> +void save_stack_trace_regs(struct pt_regs *regs, struct stack_trace *trace)
> +{
> +	unsigned long sp, low, high;
> +
> +	sp = kernel_stack_pointer(regs);
> +	low = (unsigned long) task_stack_page(current);
> +	high = (unsigned long) task_pt_regs(current);
> +	save_context_stack(trace, sp, low, high, 0);
> +	if (trace->nr_entries < trace->max_entries)
> +		trace->entries[trace->nr_entries++] = ULONG_MAX;
> +}
> +EXPORT_SYMBOL_GPL(save_stack_trace_regs);

While playing around with this, I discovered a couple of bugs in our
stacktrace code. However this patch is also not correct, since it will save
a stacktrace only if being called in process context, but not for interrupt
context.
I will fix this within this patch.

      parent reply	other threads:[~2016-02-01  9:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-29  5:20 [PATCH] s390:ftrace: add save_stack_trace_regs() Pratyush Anand
2016-01-29  5:20 ` Pratyush Anand
2016-01-29  8:54 ` Heiko Carstens
2016-01-29 12:57   ` Heiko Carstens
2016-01-29 13:59     ` Steven Rostedt
2016-01-29 14:45       ` Heiko Carstens
2016-01-29 15:22         ` Steven Rostedt
2016-01-29 16:49           ` Heiko Carstens
2016-01-29 16:56             ` Steven Rostedt
2016-01-29 17:12               ` Heiko Carstens
2016-02-01  9:00 ` Heiko Carstens [this message]

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=20160201090011.GA4166@osiris \
    --to=heiko.carstens@de.ibm.com \
    --cc=chuhu@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=panand@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=schwidefsky@de.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.