public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Frederic Weisbecker <fweisbec@gmail.com>
Subject: [PATCH 0/2] [GIT PULL][for 2.6.31] function graph gcc issue
Date: Thu, 18 Jun 2009 18:44:09 -0400	[thread overview]
Message-ID: <20090618224409.916725341@goodmis.org> (raw)


Ingo,

The bug I spent two days debugging that Jake found was due to gcc
making a copy of the return address into the stack frame and not
using it to actually return. The function graph tracer would modify
the copy and not the actual location that was used to return to.
Thus the accounting of the function graph tracer was corrupted and
a nasty crash followed.

I found that 32bit x86 when compiled with optimize for size caused
this issue in the latest gcc (4.4.0). The first patch makes the
function graph tracer depend on !X86_32 || !CC_OPTIMIZE_FOR_SIZE.
This way we keep from getting into trouble with a know configuration
that breaks.

Then next patch adds to x86 (both 32bit and 64bit) a test of the
frame pointer to make sure that the return actually goes to where
we expect it to.

When debugging Jakes bug, The first instance was easy to find. It was
the timer_stats_update_stats that had a forced cacheline struct as a local.
I changed that and it seemed to fix the boot up test. When I enabled
function graph at run time, the system crashed again, but this time the
crash was hard to find where the issue was. I wrote up this test (patch 2)
and I found the problem immediately. In case gcc changes, we want to be
able to detect it right away before the tracer does anything dangerous.


Please pull the latest tip/tracing/urgent-1 tree, which can be found at:

  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
tip/tracing/urgent-1


Steven Rostedt (2):
      function-graph: disable when both x86_32 and optimize for size are configured
      function-graph: add stack frame test

----
 arch/powerpc/kernel/ftrace.c         |    2 +-
 arch/s390/kernel/ftrace.c            |    2 +-
 arch/x86/Kconfig                     |    1 +
 arch/x86/kernel/entry_32.S           |    2 +
 arch/x86/kernel/entry_64.S           |    2 +
 arch/x86/kernel/ftrace.c             |    6 +++-
 include/linux/ftrace.h               |    4 ++-
 kernel/trace/Kconfig                 |    8 +++++++
 kernel/trace/trace_functions_graph.c |   36 ++++++++++++++++++++++++++++++---
 9 files changed, 54 insertions(+), 9 deletions(-)
-- 

             reply	other threads:[~2009-06-18 22:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-18 22:44 Steven Rostedt [this message]
2009-06-18 22:44 ` [PATCH 1/2] function-graph: disable when both x86_32 and optimize for size are configured Steven Rostedt
2009-06-20 16:25   ` Ingo Molnar
2009-06-20 22:24     ` Steven Rostedt
2009-06-21 10:45       ` Ingo Molnar
2009-06-18 22:44 ` [PATCH 2/2] function-graph: add stack frame test Steven Rostedt
2009-06-19  4:11   ` Frederic Weisbecker
2009-06-20 16:26 ` [PATCH 0/2] [GIT PULL][for 2.6.31] function graph gcc issue Ingo Molnar

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=20090618224409.916725341@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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