aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ftrace.h
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2011-05-03 13:25:24 -0400
committerSteven Rostedt <rostedt@goodmis.org>2011-05-18 15:29:47 -0400
commited926f9b35cda0988234c356e16a7cb30f4e5338 (patch)
tree32169b7aaf6b0ef7815b095a544cce93e884bb73 /include/linux/ftrace.h
parent33dc9b1267d59cef46ff0bd6bc043190845dc919 (diff)
ftrace: Use counters to enable functions to trace
Every function has its own record that stores the instruction pointer and flags for the function to be traced. There are only two flags: enabled and free. The enabled flag states that tracing for the function has been enabled (actively traced), and the free flag states that the record no longer points to a function and can be used by new functions (loaded modules). These flags are now moved to the MSB of the flags (actually just the top 32bits). The rest of the bits (30 bits) are now used as a ref counter. Everytime a tracer register functions to trace, those functions will have its counter incremented. When tracing is enabled, to determine if a function should be traced, the counter is examined, and if it is non-zero it is set to trace. When a ftrace_ops is registered to trace functions, its hashes are examined. If the ftrace_ops filter_hash count is zero, then all functions are set to be traced, otherwise only the functions in the hash are to be traced. The exception to this is if a function is also in the ftrace_ops notrace_hash. Then that function's counter is not incremented for this ftrace_ops. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'include/linux/ftrace.h')
-rw-r--r--include/linux/ftrace.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 6658a51390fe..ab1c46e70bb6 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -37,6 +37,7 @@ struct ftrace_ops {
37#ifdef CONFIG_DYNAMIC_FTRACE 37#ifdef CONFIG_DYNAMIC_FTRACE
38 struct ftrace_hash *notrace_hash; 38 struct ftrace_hash *notrace_hash;
39 struct ftrace_hash *filter_hash; 39 struct ftrace_hash *filter_hash;
40 unsigned long flags;
40#endif 41#endif
41}; 42};
42 43
@@ -152,10 +153,13 @@ extern void unregister_ftrace_function_probe_all(char *glob);
152extern int ftrace_text_reserved(void *start, void *end); 153extern int ftrace_text_reserved(void *start, void *end);
153 154
154enum { 155enum {
155 FTRACE_FL_FREE = (1 << 0), 156 FTRACE_FL_ENABLED = (1 << 30),
156 FTRACE_FL_ENABLED = (1 << 1), 157 FTRACE_FL_FREE = (1 << 31),
157}; 158};
158 159
160#define FTRACE_FL_MASK (0x3UL << 30)
161#define FTRACE_REF_MAX ((1 << 30) - 1)
162
159struct dyn_ftrace { 163struct dyn_ftrace {
160 union { 164 union {
161 unsigned long ip; /* address of mcount call-site */ 165 unsigned long ip; /* address of mcount call-site */