aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/trace/ftrace-design.txt26
-rw-r--r--kernel/trace/Kconfig4
2 files changed, 24 insertions, 6 deletions
diff --git a/Documentation/trace/ftrace-design.txt b/Documentation/trace/ftrace-design.txt
index 239f14b2b55a..6a5a579126b0 100644
--- a/Documentation/trace/ftrace-design.txt
+++ b/Documentation/trace/ftrace-design.txt
@@ -1,5 +1,6 @@
1 function tracer guts 1 function tracer guts
2 ==================== 2 ====================
3 By Mike Frysinger
3 4
4Introduction 5Introduction
5------------ 6------------
@@ -173,14 +174,16 @@ void ftrace_graph_caller(void)
173 174
174 unsigned long *frompc = &...; 175 unsigned long *frompc = &...;
175 unsigned long selfpc = <return address> - MCOUNT_INSN_SIZE; 176 unsigned long selfpc = <return address> - MCOUNT_INSN_SIZE;
176 prepare_ftrace_return(frompc, selfpc); 177 /* passing frame pointer up is optional -- see below */
178 prepare_ftrace_return(frompc, selfpc, frame_pointer);
177 179
178 /* restore all state needed by the ABI */ 180 /* restore all state needed by the ABI */
179} 181}
180#endif 182#endif
181 183
182For information on how to implement prepare_ftrace_return(), simply look at 184For information on how to implement prepare_ftrace_return(), simply look at the
183the x86 version. The only architecture-specific piece in it is the setup of 185x86 version (the frame pointer passing is optional; see the next section for
186more information). The only architecture-specific piece in it is the setup of
184the fault recovery table (the asm(...) code). The rest should be the same 187the fault recovery table (the asm(...) code). The rest should be the same
185across architectures. 188across architectures.
186 189
@@ -205,6 +208,23 @@ void return_to_handler(void)
205#endif 208#endif
206 209
207 210
211HAVE_FUNCTION_GRAPH_FP_TEST
212---------------------------
213
214An arch may pass in a unique value (frame pointer) to both the entering and
215exiting of a function. On exit, the value is compared and if it does not
216match, then it will panic the kernel. This is largely a sanity check for bad
217code generation with gcc. If gcc for your port sanely updates the frame
218pointer under different opitmization levels, then ignore this option.
219
220However, adding support for it isn't terribly difficult. In your assembly code
221that calls prepare_ftrace_return(), pass the frame pointer as the 3rd argument.
222Then in the C version of that function, do what the x86 port does and pass it
223along to ftrace_push_return_trace() instead of a stub value of 0.
224
225Similarly, when you call ftrace_return_to_handler(), pass it the frame pointer.
226
227
208HAVE_FTRACE_NMI_ENTER 228HAVE_FTRACE_NMI_ENTER
209--------------------- 229---------------------
210 230
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index 6c22d8a2f289..60e2ce0181ee 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -27,9 +27,7 @@ config HAVE_FUNCTION_GRAPH_TRACER
27config HAVE_FUNCTION_GRAPH_FP_TEST 27config HAVE_FUNCTION_GRAPH_FP_TEST
28 bool 28 bool
29 help 29 help
30 An arch may pass in a unique value (frame pointer) to both the 30 See Documentation/trace/ftrace-design.txt
31 entering and exiting of a function. On exit, the value is compared
32 and if it does not match, then it will panic the kernel.
33 31
34config HAVE_FUNCTION_TRACE_MCOUNT_TEST 32config HAVE_FUNCTION_TRACE_MCOUNT_TEST
35 bool 33 bool