linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] s390:ftrace: add save_stack_trace_regs()
@ 2016-01-29  5:20 Pratyush Anand
  2016-01-29  8:54 ` Heiko Carstens
  2016-02-01  9:00 ` Heiko Carstens
  0 siblings, 2 replies; 10+ messages in thread
From: Pratyush Anand @ 2016-01-29  5:20 UTC (permalink / raw)
  To: schwidefsky, heiko.carstens
  Cc: rostedt, linux-s390, Pratyush Anand, Chunyu Hu, open list

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);
-- 
2.5.0

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

end of thread, other threads:[~2016-02-01  9:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-29  5:20 [PATCH] s390:ftrace: add save_stack_trace_regs() 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 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).