All of lore.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>,
	Thomas Gleixner <tglx@linutronix.de>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Andi Kleen <andi@firstfloor.org>,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
	Michal Marek <mmarek@suse.cz>
Subject: [RFC][PATCH 2/4] ftrace: Add -mfentry to Makefile on function tracer
Date: Wed, 09 Feb 2011 15:02:51 -0500	[thread overview]
Message-ID: <20110209201029.772571775@goodmis.org> (raw)
In-Reply-To: 20110209200249.111932716@goodmis.org

[-- Attachment #1: 0002-ftrace-Add-mfentry-to-Makefile-on-function-tracer.patch --]
[-- Type: text/plain, Size: 1910 bytes --]

From: Steven Rostedt <srostedt@redhat.com>

Thanks to Andi Kleen, gcc 4.6.0 now supports -mfentry for x86
(and hopefully soon for other archs). What this does is to have
the function profiler start at the beginning of the function
instead of after the stack is set up. As plain -pg (mcount) is
called after the stack is set up, and in some cases can have issues
with the function graph tracer. It also requires frame pointers to
be enabled.

The -mfentry now calls __fentry__ at the beginning of the function.
This allows for compiling without frame pointers and even has the
ability to access parameters if needed.

If the architecture and the compiler both support -mfentry then
use that instead.

TODO: Allow for FUNCTION_TRACER to be set without FRAME_POINTERS

Cc: Michal Marek <mmarek@suse.cz>
Cc: Andi Kleen <andi@firstfloor.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 Makefile             |    6 +++++-
 kernel/trace/Kconfig |    5 +++++
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index c9c8c8f..915bf47 100644
--- a/Makefile
+++ b/Makefile
@@ -578,7 +578,11 @@ KBUILD_CFLAGS 	+= $(call cc-option, -femit-struct-debug-baseonly)
 endif
 
 ifdef CONFIG_FUNCTION_TRACER
-KBUILD_CFLAGS	+= -pg
+ifdef CONFIG_HAVE_FENTRY
+CC_HAS_FENTRY	:= $(call cc-option, -mfentry -DCC_HAS_FENTRY)
+endif
+KBUILD_CFLAGS	+= -pg $(CC_HAS_FENTRY)
+KBUILD_AFLAGS	+= $(CC_HAS_FENTRY)
 ifdef CONFIG_DYNAMIC_FTRACE
 	ifdef CONFIG_HAVE_C_RECORDMCOUNT
 		BUILD_C_RECORDMCOUNT := y
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index 14674dc..7ed3f17 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -49,6 +49,11 @@ config HAVE_SYSCALL_TRACEPOINTS
 	help
 	  See Documentation/trace/ftrace-design.txt
 
+config HAVE_FENTRY
+	bool
+	help
+	  Arch supports the gcc options -pg with -mfentry
+
 config HAVE_C_RECORDMCOUNT
 	bool
 	help
-- 
1.7.2.3



  parent reply	other threads:[~2011-02-09 20:10 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-09 20:02 [RFC][PATCH 0/4] ftrace: Use -mfentry when supported (this is for x86_64 right now) Steven Rostedt
2011-02-09 20:02 ` [RFC][PATCH 1/4] ftrace: Make recordmcount.c handle __fentry__ Steven Rostedt
2011-02-09 20:02 ` Steven Rostedt [this message]
2011-02-09 20:28   ` [RFC][PATCH 2/4] ftrace: Add -mfentry to Makefile on function tracer Steven Rostedt
2011-02-09 21:22     ` H. Peter Anvin
2011-02-09 20:02 ` [RFC][PATCH 3/4] ftrace: Do not test frame pointers if -mfentry is used Steven Rostedt
2011-02-09 20:02 ` [RFC][PATCH 4/4] ftrace/x86: Add support for -mfentry to x86_64 Steven Rostedt
2011-02-10  2:38 ` [RFC][PATCH 0/4] ftrace: Use -mfentry when supported (this is for x86_64 right now) Masami Hiramatsu
2011-02-17 12:37 ` Masami Hiramatsu
2011-02-17 13:18   ` Steven Rostedt
2011-02-17 15:34     ` Masami Hiramatsu
2011-02-17 15:46       ` Steven Rostedt
2011-02-17 16:07         ` Masami Hiramatsu
2011-02-17 20:11           ` Steven Rostedt
2011-02-18 11:45             ` Masami Hiramatsu
2011-02-18 15:07               ` Steven Rostedt
2011-02-18 15:19                 ` Mathieu Desnoyers
2011-02-18 20:10                   ` Dominique Toupin
2011-02-18 20:36                     ` Steven Rostedt
2011-02-18 21:45                       ` Dominique Toupin
2011-02-18 22:39                     ` Andi Kleen
2011-02-18 22:45                       ` H. Peter Anvin
2011-02-18 23:02                         ` Steven Rostedt
2011-02-19  5:07                           ` Masami Hiramatsu
2011-02-19  5:10                           ` hpas
  -- strict thread matches above, loose matches on Subject: below --
2012-08-07 19:38 [RFC PATCH 0/4] ftrace: Add use of -mfentry for x86_64 Steven Rostedt
2012-08-07 19:38 ` [RFC PATCH 2/4] ftrace: Add -mfentry to Makefile on function tracer Steven Rostedt

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=20110209201029.772571775@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@elte.hu \
    --cc=mmarek@suse.cz \
    --cc=tglx@linutronix.de \
    /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.