diff options
author | Steven Rostedt <rostedt@goodmis.org> | 2008-05-22 11:49:22 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2008-05-26 16:51:49 -0400 |
commit | 41bc8144d02028133bcd1d545023c6f49e8b2411 (patch) | |
tree | 382a6bbd0560df129c27b490aca36404edd7b19a /kernel | |
parent | 41c52c0db9607e59f90da7da5309489fa06e887f (diff) |
ftrace: fix up cmdline recording
The new work with converting the trace hooks over to markers broke the
command line recording of ftrace. This patch fixes it again.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/trace/trace.c | 3 | ||||
-rw-r--r-- | kernel/trace/trace.h | 4 | ||||
-rw-r--r-- | kernel/trace/trace_functions.c | 4 | ||||
-rw-r--r-- | kernel/trace/trace_sched_switch.c | 21 |
4 files changed, 19 insertions, 13 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 583fe24903d3..0feae23d9893 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -652,9 +652,6 @@ static char saved_cmdlines[SAVED_CMDLINES][TASK_COMM_LEN]; | |||
652 | static int cmdline_idx; | 652 | static int cmdline_idx; |
653 | static DEFINE_SPINLOCK(trace_cmdline_lock); | 653 | static DEFINE_SPINLOCK(trace_cmdline_lock); |
654 | 654 | ||
655 | /* trace in all context switches */ | ||
656 | atomic_t trace_record_cmdline_enabled __read_mostly; | ||
657 | |||
658 | /* temporary disable recording */ | 655 | /* temporary disable recording */ |
659 | atomic_t trace_record_cmdline_disabled __read_mostly; | 656 | atomic_t trace_record_cmdline_disabled __read_mostly; |
660 | 657 | ||
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index c460e85e94ed..6b8bd8800d04 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -218,6 +218,8 @@ void trace_function(struct trace_array *tr, | |||
218 | 218 | ||
219 | void tracing_start_function_trace(void); | 219 | void tracing_start_function_trace(void); |
220 | void tracing_stop_function_trace(void); | 220 | void tracing_stop_function_trace(void); |
221 | void tracing_start_cmdline_record(void); | ||
222 | void tracing_stop_cmdline_record(void); | ||
221 | int register_tracer(struct tracer *type); | 223 | int register_tracer(struct tracer *type); |
222 | void unregister_tracer(struct tracer *type); | 224 | void unregister_tracer(struct tracer *type); |
223 | 225 | ||
@@ -226,8 +228,6 @@ extern unsigned long nsecs_to_usecs(unsigned long nsecs); | |||
226 | extern unsigned long tracing_max_latency; | 228 | extern unsigned long tracing_max_latency; |
227 | extern unsigned long tracing_thresh; | 229 | extern unsigned long tracing_thresh; |
228 | 230 | ||
229 | extern atomic_t trace_record_cmdline_enabled; | ||
230 | |||
231 | void update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu); | 231 | void update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu); |
232 | void update_max_tr_single(struct trace_array *tr, | 232 | void update_max_tr_single(struct trace_array *tr, |
233 | struct task_struct *tsk, int cpu); | 233 | struct task_struct *tsk, int cpu); |
diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c index 0a084656d7cf..7ee7dcd76b7d 100644 --- a/kernel/trace/trace_functions.c +++ b/kernel/trace/trace_functions.c | |||
@@ -29,14 +29,14 @@ static void function_reset(struct trace_array *tr) | |||
29 | static void start_function_trace(struct trace_array *tr) | 29 | static void start_function_trace(struct trace_array *tr) |
30 | { | 30 | { |
31 | function_reset(tr); | 31 | function_reset(tr); |
32 | atomic_inc(&trace_record_cmdline_enabled); | 32 | tracing_start_cmdline_record(); |
33 | tracing_start_function_trace(); | 33 | tracing_start_function_trace(); |
34 | } | 34 | } |
35 | 35 | ||
36 | static void stop_function_trace(struct trace_array *tr) | 36 | static void stop_function_trace(struct trace_array *tr) |
37 | { | 37 | { |
38 | tracing_stop_function_trace(); | 38 | tracing_stop_function_trace(); |
39 | atomic_dec(&trace_record_cmdline_enabled); | 39 | tracing_stop_cmdline_record(); |
40 | } | 40 | } |
41 | 41 | ||
42 | static void function_trace_init(struct trace_array *tr) | 42 | static void function_trace_init(struct trace_array *tr) |
diff --git a/kernel/trace/trace_sched_switch.c b/kernel/trace/trace_sched_switch.c index 798ec0dc863c..c16935d3bc5c 100644 --- a/kernel/trace/trace_sched_switch.c +++ b/kernel/trace/trace_sched_switch.c | |||
@@ -29,6 +29,9 @@ sched_switch_func(void *private, void *__rq, struct task_struct *prev, | |||
29 | long disabled; | 29 | long disabled; |
30 | int cpu; | 30 | int cpu; |
31 | 31 | ||
32 | tracing_record_cmdline(prev); | ||
33 | tracing_record_cmdline(next); | ||
34 | |||
32 | if (!tracer_enabled) | 35 | if (!tracer_enabled) |
33 | return; | 36 | return; |
34 | 37 | ||
@@ -63,8 +66,6 @@ sched_switch_callback(void *probe_data, void *call_data, | |||
63 | prev = va_arg(*args, typeof(prev)); | 66 | prev = va_arg(*args, typeof(prev)); |
64 | next = va_arg(*args, typeof(next)); | 67 | next = va_arg(*args, typeof(next)); |
65 | 68 | ||
66 | tracing_record_cmdline(prev); | ||
67 | |||
68 | /* | 69 | /* |
69 | * If tracer_switch_func only points to the local | 70 | * If tracer_switch_func only points to the local |
70 | * switch func, it still needs the ptr passed to it. | 71 | * switch func, it still needs the ptr passed to it. |
@@ -213,18 +214,26 @@ void tracing_stop_sched_switch(void) | |||
213 | tracing_sched_unregister(); | 214 | tracing_sched_unregister(); |
214 | } | 215 | } |
215 | 216 | ||
217 | void tracing_start_cmdline_record(void) | ||
218 | { | ||
219 | tracing_start_sched_switch(); | ||
220 | } | ||
221 | |||
222 | void tracing_stop_cmdline_record(void) | ||
223 | { | ||
224 | tracing_stop_sched_switch(); | ||
225 | } | ||
226 | |||
216 | static void start_sched_trace(struct trace_array *tr) | 227 | static void start_sched_trace(struct trace_array *tr) |
217 | { | 228 | { |
218 | sched_switch_reset(tr); | 229 | sched_switch_reset(tr); |
219 | atomic_inc(&trace_record_cmdline_enabled); | ||
220 | tracer_enabled = 1; | 230 | tracer_enabled = 1; |
221 | tracing_start_sched_switch(); | 231 | tracing_start_cmdline_record(); |
222 | } | 232 | } |
223 | 233 | ||
224 | static void stop_sched_trace(struct trace_array *tr) | 234 | static void stop_sched_trace(struct trace_array *tr) |
225 | { | 235 | { |
226 | tracing_stop_sched_switch(); | 236 | tracing_stop_cmdline_record(); |
227 | atomic_dec(&trace_record_cmdline_enabled); | ||
228 | tracer_enabled = 0; | 237 | tracer_enabled = 0; |
229 | } | 238 | } |
230 | 239 | ||