diff options
author | Steven Rostedt <srostedt@redhat.com> | 2008-11-05 16:05:44 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-11-06 01:50:51 -0500 |
commit | 60a7ecf42661f2b22168751298592da6ee210c9e (patch) | |
tree | 050fd052c546c92f8aac10ee71d5bb6d98a21fc8 /include | |
parent | 79c81d220c8e25163f56edcdfaf23f83a4c88e6b (diff) |
ftrace: add quick function trace stop
Impact: quick start and stop of function tracer
This patch adds a way to disable the function tracer quickly without
the need to run kstop_machine. It adds a new variable called
function_trace_stop which will stop the calls to functions from mcount
when set. This is just an on/off switch and does not handle recursion
like preempt_disable().
It's main purpose is to help other tracers/debuggers start and stop tracing
fuctions without the need to call kstop_machine.
The config option HAVE_FUNCTION_TRACE_MCOUNT_TEST is added for archs
that implement the testing of the function_trace_stop in the mcount
arch dependent code. Otherwise, the test is done in the C code.
x86 is the only arch at the moment that supports this.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/ftrace.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index 4642959e5bda..794ab907dbfe 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h | |||
@@ -23,6 +23,34 @@ struct ftrace_ops { | |||
23 | struct ftrace_ops *next; | 23 | struct ftrace_ops *next; |
24 | }; | 24 | }; |
25 | 25 | ||
26 | extern int function_trace_stop; | ||
27 | |||
28 | /** | ||
29 | * ftrace_stop - stop function tracer. | ||
30 | * | ||
31 | * A quick way to stop the function tracer. Note this an on off switch, | ||
32 | * it is not something that is recursive like preempt_disable. | ||
33 | * This does not disable the calling of mcount, it only stops the | ||
34 | * calling of functions from mcount. | ||
35 | */ | ||
36 | static inline void ftrace_stop(void) | ||
37 | { | ||
38 | function_trace_stop = 1; | ||
39 | } | ||
40 | |||
41 | /** | ||
42 | * ftrace_start - start the function tracer. | ||
43 | * | ||
44 | * This function is the inverse of ftrace_stop. This does not enable | ||
45 | * the function tracing if the function tracer is disabled. This only | ||
46 | * sets the function tracer flag to continue calling the functions | ||
47 | * from mcount. | ||
48 | */ | ||
49 | static inline void ftrace_start(void) | ||
50 | { | ||
51 | function_trace_stop = 0; | ||
52 | } | ||
53 | |||
26 | /* | 54 | /* |
27 | * The ftrace_ops must be a static and should also | 55 | * The ftrace_ops must be a static and should also |
28 | * be read_mostly. These functions do modify read_mostly variables | 56 | * be read_mostly. These functions do modify read_mostly variables |
@@ -41,6 +69,8 @@ extern void ftrace_stub(unsigned long a0, unsigned long a1); | |||
41 | # define unregister_ftrace_function(ops) do { } while (0) | 69 | # define unregister_ftrace_function(ops) do { } while (0) |
42 | # define clear_ftrace_function(ops) do { } while (0) | 70 | # define clear_ftrace_function(ops) do { } while (0) |
43 | static inline void ftrace_kill(void) { } | 71 | static inline void ftrace_kill(void) { } |
72 | static inline void ftrace_stop(void) { } | ||
73 | static inline void ftrace_start(void) { } | ||
44 | #endif /* CONFIG_FUNCTION_TRACER */ | 74 | #endif /* CONFIG_FUNCTION_TRACER */ |
45 | 75 | ||
46 | #ifdef CONFIG_DYNAMIC_FTRACE | 76 | #ifdef CONFIG_DYNAMIC_FTRACE |