aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-07-14 09:58:35 -0400
committerIngo Molnar <mingo@elte.hu>2008-07-14 09:58:35 -0400
commit6712e299b7dc78aa4971b85e803435ee6d49a9dd (patch)
treeb3d17a2d068737ec07727b28e93c7d374c27721b /kernel/trace/trace.c
parentec1bb60bbff0386c3ec25360e7a8c72f467a6ff1 (diff)
parentb2613e370dbeb69edbff989382fa54f2395aa471 (diff)
Merge branch 'tracing/ftrace' into auto-ftrace-next
Diffstat (limited to 'kernel/trace/trace.c')
-rw-r--r--kernel/trace/trace.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index e46de641ea..868e121c8e 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -96,6 +96,9 @@ static DEFINE_PER_CPU(struct trace_array_cpu, max_data);
96/* tracer_enabled is used to toggle activation of a tracer */ 96/* tracer_enabled is used to toggle activation of a tracer */
97static int tracer_enabled = 1; 97static int tracer_enabled = 1;
98 98
99/* function tracing enabled */
100int ftrace_function_enabled;
101
99/* 102/*
100 * trace_nr_entries is the number of entries that is allocated 103 * trace_nr_entries is the number of entries that is allocated
101 * for a buffer. Note, the number of entries is always rounded 104 * for a buffer. Note, the number of entries is always rounded
@@ -134,6 +137,7 @@ static notrace void no_trace_init(struct trace_array *tr)
134{ 137{
135 int cpu; 138 int cpu;
136 139
140 ftrace_function_enabled = 0;
137 if(tr->ctrl) 141 if(tr->ctrl)
138 for_each_online_cpu(cpu) 142 for_each_online_cpu(cpu)
139 tracing_reset(tr->data[cpu]); 143 tracing_reset(tr->data[cpu]);
@@ -1027,7 +1031,7 @@ function_trace_call(unsigned long ip, unsigned long parent_ip)
1027 long disabled; 1031 long disabled;
1028 int cpu; 1032 int cpu;
1029 1033
1030 if (unlikely(!tracer_enabled)) 1034 if (unlikely(!ftrace_function_enabled))
1031 return; 1035 return;
1032 1036
1033 if (skip_trace(ip)) 1037 if (skip_trace(ip))
@@ -1052,11 +1056,15 @@ static struct ftrace_ops trace_ops __read_mostly =
1052 1056
1053void tracing_start_function_trace(void) 1057void tracing_start_function_trace(void)
1054{ 1058{
1059 ftrace_function_enabled = 0;
1055 register_ftrace_function(&trace_ops); 1060 register_ftrace_function(&trace_ops);
1061 if (tracer_enabled)
1062 ftrace_function_enabled = 1;
1056} 1063}
1057 1064
1058void tracing_stop_function_trace(void) 1065void tracing_stop_function_trace(void)
1059{ 1066{
1067 ftrace_function_enabled = 0;
1060 unregister_ftrace_function(&trace_ops); 1068 unregister_ftrace_function(&trace_ops);
1061} 1069}
1062#endif 1070#endif
@@ -1383,7 +1391,7 @@ print_trace_header(struct seq_file *m, struct trace_iterator *iter)
1383 "server", 1391 "server",
1384#elif defined(CONFIG_PREEMPT_VOLUNTARY) 1392#elif defined(CONFIG_PREEMPT_VOLUNTARY)
1385 "desktop", 1393 "desktop",
1386#elif defined(CONFIG_PREEMPT_DESKTOP) 1394#elif defined(CONFIG_PREEMPT)
1387 "preempt", 1395 "preempt",
1388#else 1396#else
1389 "unknown", 1397 "unknown",
@@ -1892,8 +1900,10 @@ __tracing_open(struct inode *inode, struct file *file, int *ret)
1892 m->private = iter; 1900 m->private = iter;
1893 1901
1894 /* stop the trace while dumping */ 1902 /* stop the trace while dumping */
1895 if (iter->tr->ctrl) 1903 if (iter->tr->ctrl) {
1896 tracer_enabled = 0; 1904 tracer_enabled = 0;
1905 ftrace_function_enabled = 0;
1906 }
1897 1907
1898 if (iter->trace && iter->trace->open) 1908 if (iter->trace && iter->trace->open)
1899 iter->trace->open(iter); 1909 iter->trace->open(iter);
@@ -1926,8 +1936,14 @@ int tracing_release(struct inode *inode, struct file *file)
1926 iter->trace->close(iter); 1936 iter->trace->close(iter);
1927 1937
1928 /* reenable tracing if it was previously enabled */ 1938 /* reenable tracing if it was previously enabled */
1929 if (iter->tr->ctrl) 1939 if (iter->tr->ctrl) {
1930 tracer_enabled = 1; 1940 tracer_enabled = 1;
1941 /*
1942 * It is safe to enable function tracing even if it
1943 * isn't used
1944 */
1945 ftrace_function_enabled = 1;
1946 }
1931 mutex_unlock(&trace_types_lock); 1947 mutex_unlock(&trace_types_lock);
1932 1948
1933 seq_release(inode, file); 1949 seq_release(inode, file);