From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@kernel.org>, "H . Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, linux-kernel@vger.kernel.org,
Andy Lutomirski <luto@amacapital.net>,
Linus Torvalds <torvalds@linux-foundation.org>,
Brian Gerst <brgerst@gmail.com>,
Kees Cook <keescook@chromium.org>,
Peter Zijlstra <peterz@infradead.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Byungchul Park <byungchul.park@lge.com>
Subject: Re: [PATCH 05/19] x86/dumpstack: fix function graph tracing stack dump reliability issues
Date: Tue, 2 Aug 2016 21:50:12 -0500 [thread overview]
Message-ID: <20160803025012.bmte6hjhcd6lotod@treble> (raw)
In-Reply-To: <20160802223011.6209e28c@grimm.local.home>
On Tue, Aug 02, 2016 at 10:30:11PM -0400, Steven Rostedt wrote:
> On Tue, 2 Aug 2016 20:56:56 -0500
> Josh Poimboeuf <jpoimboe@redhat.com> wrote:
>
> > It's not specific to NMIs. The problem is that dump_trace() is starting
> > from the frame pointed to by a pt_regs, rather than the current frame.
> > Instead of starting with the current frame, the first 10 functions on
> > the stack are skipped by the unwinder, but they're *not* skipped on the
> > ret_stack. So it starts out out-of-sync.
>
> OK, I see what you mean. If we do a dumpstack from interrupt passing in
> the pt_regs of the kernel thread that was interrupted, even though
> functions up to the interrupt was called and traced, which will show up
> in the dump stack that shouldn't.
>
> OK, you convinced me. Add the extra pointer, then we will have 4 longs
> and 2 long longs in ftrace_ret_stack. That's not that bad.
Hm, since 'fp' is only used for mcount, I guess we could avoid
allocating it for fentry? That would save a long when a modern compiler
is used. Like:
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 1e814ae..fc508a7 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -795,7 +795,9 @@ struct ftrace_ret_stack {
unsigned long func;
unsigned long long calltime;
unsigned long long subtime;
+#if defined(CONFIG_HAVE_FUNCTION_GRAPH_FP_TEST) && !defined(CC_USING_FENTRY)
unsigned long fp;
+#endif
};
/*
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index 9caa9b2..86b2719 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -171,7 +171,9 @@ ftrace_push_return_trace(unsigned long ret, unsigned long func, int *depth,
current->ret_stack[index].func = func;
current->ret_stack[index].calltime = calltime;
current->ret_stack[index].subtime = 0;
+#if defined(CONFIG_HAVE_FUNCTION_GRAPH_FP_TEST) && !defined(CC_USING_FENTRY)
current->ret_stack[index].fp = frame_pointer;
+#endif
*depth = current->curr_ret_stack;
return 0;
next prev parent reply other threads:[~2016-08-03 2:50 UTC|newest]
Thread overview: 91+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-21 21:21 [PATCH 00/19] x86/dumpstack: rewrite x86 stack dump code Josh Poimboeuf
2016-07-21 21:21 ` [PATCH 01/19] x86/dumpstack: remove show_trace() Josh Poimboeuf
2016-07-21 21:49 ` Andy Lutomirski
2016-07-21 21:21 ` [PATCH 02/19] x86/dumpstack: add get_stack_pointer() and get_frame_pointer() Josh Poimboeuf
2016-07-21 21:53 ` Andy Lutomirski
2016-07-21 21:21 ` [PATCH 03/19] x86/dumpstack: remove unnecessary stack pointer arguments Josh Poimboeuf
2016-07-21 21:56 ` Andy Lutomirski
2016-07-22 1:41 ` Josh Poimboeuf
2016-07-22 2:29 ` Andy Lutomirski
2016-07-22 3:08 ` Brian Gerst
2016-07-21 21:21 ` [PATCH 04/19] x86/dumpstack: make printk_stack_address() more generally useful Josh Poimboeuf
2016-07-21 21:21 ` [PATCH 05/19] x86/dumpstack: fix function graph tracing stack dump reliability issues Josh Poimboeuf
2016-07-29 22:55 ` Steven Rostedt
2016-07-30 0:50 ` Josh Poimboeuf
2016-07-30 2:20 ` Steven Rostedt
2016-07-30 13:51 ` Josh Poimboeuf
2016-08-01 14:28 ` Steven Rostedt
2016-08-01 15:36 ` Josh Poimboeuf
2016-08-02 21:00 ` Josh Poimboeuf
2016-08-02 21:16 ` Steven Rostedt
2016-08-02 22:13 ` Josh Poimboeuf
2016-08-02 23:16 ` Steven Rostedt
2016-08-03 1:56 ` Josh Poimboeuf
2016-08-03 2:30 ` Steven Rostedt
2016-08-03 2:50 ` Josh Poimboeuf [this message]
2016-08-03 2:59 ` Steven Rostedt
2016-08-03 3:12 ` Josh Poimboeuf
2016-08-03 3:18 ` Steven Rostedt
2016-08-03 3:21 ` Steven Rostedt
2016-08-03 3:31 ` Josh Poimboeuf
2016-08-03 3:45 ` Steven Rostedt
2016-08-03 14:13 ` Josh Poimboeuf
2016-08-03 3:30 ` Josh Poimboeuf
2016-08-01 15:59 ` Josh Poimboeuf
2016-08-01 16:05 ` Steven Rostedt
2016-08-01 16:19 ` Josh Poimboeuf
2016-08-01 16:24 ` Josh Poimboeuf
2016-08-01 16:56 ` Steven Rostedt
2016-07-21 21:21 ` [PATCH 06/19] x86/dumpstack: remove extra brackets around "EOE" Josh Poimboeuf
2016-07-21 21:21 ` [PATCH 07/19] x86/dumpstack: add IRQ_USABLE_STACK_SIZE define Josh Poimboeuf
2016-07-21 22:01 ` Andy Lutomirski
2016-07-22 1:48 ` Josh Poimboeuf
2016-07-22 8:24 ` Ingo Molnar
2016-07-21 21:21 ` [PATCH 08/19] x86/dumpstack: don't disable preemption in show_stack_log_lvl() and dump_trace() Josh Poimboeuf
2016-07-21 21:21 ` [PATCH 09/19] x86/dumpstack: simplify in_exception_stack() Josh Poimboeuf
2016-07-21 22:05 ` Andy Lutomirski
2016-07-21 21:21 ` [PATCH 10/19] x86/dumpstack: add get_stack_info() interface Josh Poimboeuf
2016-07-22 23:26 ` Andy Lutomirski
2016-07-22 23:52 ` Andy Lutomirski
2016-07-23 13:09 ` Josh Poimboeuf
2016-07-22 23:54 ` Josh Poimboeuf
2016-07-23 0:15 ` Andy Lutomirski
2016-07-23 14:04 ` Josh Poimboeuf
2016-07-26 0:09 ` Andy Lutomirski
2016-07-26 16:26 ` Josh Poimboeuf
2016-07-26 17:51 ` Steven Rostedt
2016-07-26 18:56 ` Josh Poimboeuf
2016-07-26 20:59 ` Andy Lutomirski
2016-07-26 22:24 ` Josh Poimboeuf
2016-07-26 22:31 ` Steven Rostedt
2016-07-26 22:37 ` Andy Lutomirski
2016-07-26 16:47 ` Josh Poimboeuf
2016-07-26 17:49 ` Brian Gerst
2016-07-26 18:59 ` Josh Poimboeuf
2016-07-21 21:21 ` [PATCH 11/19] x86/dumptrace: add new unwind interface and implementations Josh Poimboeuf
2016-07-21 21:21 ` [PATCH 12/19] perf/x86: convert perf_callchain_kernel() to the new unwinder Josh Poimboeuf
2016-07-21 21:21 ` [PATCH 13/19] x86/stacktrace: convert save_stack_trace_*() " Josh Poimboeuf
2016-07-21 21:21 ` [PATCH 14/19] oprofile/x86: convert x86_backtrace() " Josh Poimboeuf
2016-07-21 21:21 ` [PATCH 15/19] x86/dumpstack: convert show_trace_log_lvl() " Josh Poimboeuf
2016-07-21 21:49 ` Byungchul Park
2016-07-22 1:38 ` Josh Poimboeuf
2016-07-21 21:21 ` [PATCH 16/19] x86/dumpstack: remove dump_trace() Josh Poimboeuf
2016-07-21 21:21 ` [PATCH 17/19] x86/entry/dumpstack: encode pt_regs pointer in frame pointer Josh Poimboeuf
2016-07-21 22:27 ` Andy Lutomirski
2016-07-21 21:21 ` [PATCH 18/19] x86/dumpstack: print stack identifier on its own line Josh Poimboeuf
2016-07-21 21:21 ` [PATCH 19/19] x86/dumpstack: print any pt_regs found on the stack Josh Poimboeuf
2016-07-21 22:32 ` Andy Lutomirski
2016-07-22 3:30 ` Josh Poimboeuf
2016-07-22 5:13 ` Andy Lutomirski
2016-07-22 15:57 ` Josh Poimboeuf
2016-07-22 21:46 ` Andy Lutomirski
2016-07-22 22:20 ` Josh Poimboeuf
2016-07-22 23:18 ` Andy Lutomirski
2016-07-22 23:30 ` Josh Poimboeuf
2016-07-22 23:39 ` Andy Lutomirski
2016-07-23 0:00 ` Josh Poimboeuf
2016-07-23 0:22 ` [PATCH 00/19] x86/dumpstack: rewrite x86 stack dump code Linus Torvalds
2016-07-23 0:31 ` Andy Lutomirski
2016-07-23 5:35 ` Josh Poimboeuf
2016-07-23 5:39 ` Linus Torvalds
2016-07-23 12:53 ` Josh Poimboeuf
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=20160803025012.bmte6hjhcd6lotod@treble \
--to=jpoimboe@redhat.com \
--cc=brgerst@gmail.com \
--cc=byungchul.park@lge.com \
--cc=fweisbec@gmail.com \
--cc=hpa@zytor.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=x86@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®