linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ftrace: cover new frame pointer semantics
@ 2010-01-22 13:12 Mike Frysinger
  2010-01-22 14:45 ` Steven Rostedt
  2010-01-27 13:15 ` [tip:tracing/urgent] tracing/documentation: Cover " tip-bot for Mike Frysinger
  0 siblings, 2 replies; 3+ messages in thread
From: Mike Frysinger @ 2010-01-22 13:12 UTC (permalink / raw)
  To: linux-kernel, Steven Rostedt, Frederic Weisbecker, Ingo Molnar

Update the graph tracer examples to cover the new frame pointer semantics
(in terms of passing it along).  Move the HAVE_FUNCTION_GRAPH_FP_TEST docs
out of the Kconfig, into the right place, and expand on the details.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 Documentation/trace/ftrace-design.txt |   26 +++++++++++++++++++++++---
 kernel/trace/Kconfig                  |    4 +---
 2 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/Documentation/trace/ftrace-design.txt b/Documentation/trace/ftrace-design.txt
index 239f14b..6a5a579 100644
--- a/Documentation/trace/ftrace-design.txt
+++ b/Documentation/trace/ftrace-design.txt
@@ -1,5 +1,6 @@
 		function tracer guts
 		====================
+		By Mike Frysinger
 
 Introduction
 ------------
@@ -173,14 +174,16 @@ void ftrace_graph_caller(void)
 
 	unsigned long *frompc = &...;
 	unsigned long selfpc = <return address> - MCOUNT_INSN_SIZE;
-	prepare_ftrace_return(frompc, selfpc);
+	/* passing frame pointer up is optional -- see below */
+	prepare_ftrace_return(frompc, selfpc, frame_pointer);
 
 	/* restore all state needed by the ABI */
 }
 #endif
 
-For information on how to implement prepare_ftrace_return(), simply look at
-the x86 version.  The only architecture-specific piece in it is the setup of
+For information on how to implement prepare_ftrace_return(), simply look at the
+x86 version (the frame pointer passing is optional; see the next section for
+more information).  The only architecture-specific piece in it is the setup of
 the fault recovery table (the asm(...) code).  The rest should be the same
 across architectures.
 
@@ -205,6 +208,23 @@ void return_to_handler(void)
 #endif
 
 
+HAVE_FUNCTION_GRAPH_FP_TEST
+---------------------------
+
+An arch may pass in a unique value (frame pointer) to both the entering and
+exiting of a function.  On exit, the value is compared and if it does not
+match, then it will panic the kernel.  This is largely a sanity check for bad
+code generation with gcc.  If gcc for your port sanely updates the frame
+pointer under different opitmization levels, then ignore this option.
+
+However, adding support for it isn't terribly difficult.  In your assembly code
+that calls prepare_ftrace_return(), pass the frame pointer as the 3rd argument.
+Then in the C version of that function, do what the x86 port does and pass it
+along to ftrace_push_return_trace() instead of a stub value of 0.
+
+Similarly, when you call ftrace_return_to_handler(), pass it the frame pointer.
+
+
 HAVE_FTRACE_NMI_ENTER
 ---------------------
 
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index 6c22d8a..60e2ce0 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -27,9 +27,7 @@ config HAVE_FUNCTION_GRAPH_TRACER
 config HAVE_FUNCTION_GRAPH_FP_TEST
 	bool
 	help
-	 An arch may pass in a unique value (frame pointer) to both the
-	 entering and exiting of a function. On exit, the value is compared
-	 and if it does not match, then it will panic the kernel.
+	  See Documentation/trace/ftrace-design.txt
 
 config HAVE_FUNCTION_TRACE_MCOUNT_TEST
 	bool
-- 
1.6.6.1


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

* Re: [PATCH] ftrace: cover new frame pointer semantics
  2010-01-22 13:12 [PATCH] ftrace: cover new frame pointer semantics Mike Frysinger
@ 2010-01-22 14:45 ` Steven Rostedt
  2010-01-27 13:15 ` [tip:tracing/urgent] tracing/documentation: Cover " tip-bot for Mike Frysinger
  1 sibling, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2010-01-22 14:45 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: linux-kernel, Frederic Weisbecker, Ingo Molnar

On Fri, 2010-01-22 at 08:12 -0500, Mike Frysinger wrote:
> Update the graph tracer examples to cover the new frame pointer semantics
> (in terms of passing it along).  Move the HAVE_FUNCTION_GRAPH_FP_TEST docs
> out of the Kconfig, into the right place, and expand on the details.
> 
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>

Thanks! I'll queue this up for 34. and maybe 33 if there's a fix that is
needed. Not sure if Doc only changes can still make 33, if so, I may
send this patch by itself.

-- Steve

> ---
>  Documentation/trace/ftrace-design.txt |   26 +++++++++++++++++++++++---
>  kernel/trace/Kconfig                  |    4 +---
>  2 files changed, 24 insertions(+), 6 deletions(-)
> 
> diff --git a/Documentation/trace/ftrace-design.txt b/Documentation/trace/ftrace-design.txt
> index 239f14b..6a5a579 100644
> --- a/Documentation/trace/ftrace-design.txt
> +++ b/Documentation/trace/ftrace-design.txt
> @@ -1,5 +1,6 @@
>  		function tracer guts
>  		====================
> +		By Mike Frysinger
>  
>  Introduction
>  ------------
> @@ -173,14 +174,16 @@ void ftrace_graph_caller(void)
>  
>  	unsigned long *frompc = &...;
>  	unsigned long selfpc = <return address> - MCOUNT_INSN_SIZE;
> -	prepare_ftrace_return(frompc, selfpc);
> +	/* passing frame pointer up is optional -- see below */
> +	prepare_ftrace_return(frompc, selfpc, frame_pointer);
>  
>  	/* restore all state needed by the ABI */
>  }
>  #endif
>  
> -For information on how to implement prepare_ftrace_return(), simply look at
> -the x86 version.  The only architecture-specific piece in it is the setup of
> +For information on how to implement prepare_ftrace_return(), simply look at the
> +x86 version (the frame pointer passing is optional; see the next section for
> +more information).  The only architecture-specific piece in it is the setup of
>  the fault recovery table (the asm(...) code).  The rest should be the same
>  across architectures.
>  
> @@ -205,6 +208,23 @@ void return_to_handler(void)
>  #endif
>  
> 
> +HAVE_FUNCTION_GRAPH_FP_TEST
> +---------------------------
> +
> +An arch may pass in a unique value (frame pointer) to both the entering and
> +exiting of a function.  On exit, the value is compared and if it does not
> +match, then it will panic the kernel.  This is largely a sanity check for bad
> +code generation with gcc.  If gcc for your port sanely updates the frame
> +pointer under different opitmization levels, then ignore this option.
> +
> +However, adding support for it isn't terribly difficult.  In your assembly code
> +that calls prepare_ftrace_return(), pass the frame pointer as the 3rd argument.
> +Then in the C version of that function, do what the x86 port does and pass it
> +along to ftrace_push_return_trace() instead of a stub value of 0.
> +
> +Similarly, when you call ftrace_return_to_handler(), pass it the frame pointer.
> +
> +
>  HAVE_FTRACE_NMI_ENTER
>  ---------------------
>  
> diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
> index 6c22d8a..60e2ce0 100644
> --- a/kernel/trace/Kconfig
> +++ b/kernel/trace/Kconfig
> @@ -27,9 +27,7 @@ config HAVE_FUNCTION_GRAPH_TRACER
>  config HAVE_FUNCTION_GRAPH_FP_TEST
>  	bool
>  	help
> -	 An arch may pass in a unique value (frame pointer) to both the
> -	 entering and exiting of a function. On exit, the value is compared
> -	 and if it does not match, then it will panic the kernel.
> +	  See Documentation/trace/ftrace-design.txt
>  
>  config HAVE_FUNCTION_TRACE_MCOUNT_TEST
>  	bool



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

* [tip:tracing/urgent] tracing/documentation: Cover new frame pointer semantics
  2010-01-22 13:12 [PATCH] ftrace: cover new frame pointer semantics Mike Frysinger
  2010-01-22 14:45 ` Steven Rostedt
@ 2010-01-27 13:15 ` tip-bot for Mike Frysinger
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Mike Frysinger @ 2010-01-27 13:15 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, rostedt, vapier, tglx

Commit-ID:  03688970347bfea32823953a7ce5886d1713205f
Gitweb:     http://git.kernel.org/tip/03688970347bfea32823953a7ce5886d1713205f
Author:     Mike Frysinger <vapier@gentoo.org>
AuthorDate: Fri, 22 Jan 2010 08:12:47 -0500
Committer:  Steven Rostedt <rostedt@goodmis.org>
CommitDate: Tue, 26 Jan 2010 17:00:39 -0500

tracing/documentation: Cover new frame pointer semantics

Update the graph tracer examples to cover the new frame pointer semantics
(in terms of passing it along).  Move the HAVE_FUNCTION_GRAPH_FP_TEST docs
out of the Kconfig, into the right place, and expand on the details.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
LKML-Reference: <1264165967-18938-1-git-send-email-vapier@gentoo.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 Documentation/trace/ftrace-design.txt |   26 +++++++++++++++++++++++---
 kernel/trace/Kconfig                  |    4 +---
 2 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/Documentation/trace/ftrace-design.txt b/Documentation/trace/ftrace-design.txt
index 239f14b..6a5a579 100644
--- a/Documentation/trace/ftrace-design.txt
+++ b/Documentation/trace/ftrace-design.txt
@@ -1,5 +1,6 @@
 		function tracer guts
 		====================
+		By Mike Frysinger
 
 Introduction
 ------------
@@ -173,14 +174,16 @@ void ftrace_graph_caller(void)
 
 	unsigned long *frompc = &...;
 	unsigned long selfpc = <return address> - MCOUNT_INSN_SIZE;
-	prepare_ftrace_return(frompc, selfpc);
+	/* passing frame pointer up is optional -- see below */
+	prepare_ftrace_return(frompc, selfpc, frame_pointer);
 
 	/* restore all state needed by the ABI */
 }
 #endif
 
-For information on how to implement prepare_ftrace_return(), simply look at
-the x86 version.  The only architecture-specific piece in it is the setup of
+For information on how to implement prepare_ftrace_return(), simply look at the
+x86 version (the frame pointer passing is optional; see the next section for
+more information).  The only architecture-specific piece in it is the setup of
 the fault recovery table (the asm(...) code).  The rest should be the same
 across architectures.
 
@@ -205,6 +208,23 @@ void return_to_handler(void)
 #endif
 
 
+HAVE_FUNCTION_GRAPH_FP_TEST
+---------------------------
+
+An arch may pass in a unique value (frame pointer) to both the entering and
+exiting of a function.  On exit, the value is compared and if it does not
+match, then it will panic the kernel.  This is largely a sanity check for bad
+code generation with gcc.  If gcc for your port sanely updates the frame
+pointer under different opitmization levels, then ignore this option.
+
+However, adding support for it isn't terribly difficult.  In your assembly code
+that calls prepare_ftrace_return(), pass the frame pointer as the 3rd argument.
+Then in the C version of that function, do what the x86 port does and pass it
+along to ftrace_push_return_trace() instead of a stub value of 0.
+
+Similarly, when you call ftrace_return_to_handler(), pass it the frame pointer.
+
+
 HAVE_FTRACE_NMI_ENTER
 ---------------------
 
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index 6c22d8a..60e2ce0 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -27,9 +27,7 @@ config HAVE_FUNCTION_GRAPH_TRACER
 config HAVE_FUNCTION_GRAPH_FP_TEST
 	bool
 	help
-	 An arch may pass in a unique value (frame pointer) to both the
-	 entering and exiting of a function. On exit, the value is compared
-	 and if it does not match, then it will panic the kernel.
+	  See Documentation/trace/ftrace-design.txt
 
 config HAVE_FUNCTION_TRACE_MCOUNT_TEST
 	bool

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

end of thread, other threads:[~2010-01-27 13:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-22 13:12 [PATCH] ftrace: cover new frame pointer semantics Mike Frysinger
2010-01-22 14:45 ` Steven Rostedt
2010-01-27 13:15 ` [tip:tracing/urgent] tracing/documentation: Cover " tip-bot for Mike Frysinger

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).