diff options
author | Steven Rostedt <srostedt@redhat.com> | 2008-11-07 22:36:02 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-11-08 03:51:18 -0500 |
commit | e168e0516e476070faa9e8e7b23dfcba79b76d82 (patch) | |
tree | 21b1bad3def7f6cd88d9adfe1b09973fc70f864a /kernel/trace/trace_sched_switch.c | |
parent | 75f5c47da386445ba0c5a8b7e3ca0c906e763369 (diff) |
ftrace: fix sched_switch API
Impact: fix for sched_switch that broke dynamic ftrace startup
The commit: tracing/fastboot: use sched switch tracer from boot tracer
broke the API of the sched_switch trace. The use of the
tracing_start/stop_cmdline record is for only recording the cmdline,
NOT recording the schedule switches themselves.
Seeing that the boot tracer broke the API to do something that it
wanted, this patch adds a new interface for the API while
puting back the original interface of the old API.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace/trace_sched_switch.c')
-rw-r--r-- | kernel/trace/trace_sched_switch.c | 50 |
1 files changed, 40 insertions, 10 deletions
diff --git a/kernel/trace/trace_sched_switch.c b/kernel/trace/trace_sched_switch.c index fbf05df7134d..79410db64d6f 100644 --- a/kernel/trace/trace_sched_switch.c +++ b/kernel/trace/trace_sched_switch.c | |||
@@ -125,20 +125,16 @@ static void tracing_sched_unregister(void) | |||
125 | static void tracing_start_sched_switch(void) | 125 | static void tracing_start_sched_switch(void) |
126 | { | 126 | { |
127 | mutex_lock(&sched_register_mutex); | 127 | mutex_lock(&sched_register_mutex); |
128 | if (!(sched_ref++)) { | 128 | if (!(sched_ref++)) |
129 | tracer_enabled = 1; | ||
130 | tracing_sched_register(); | 129 | tracing_sched_register(); |
131 | } | ||
132 | mutex_unlock(&sched_register_mutex); | 130 | mutex_unlock(&sched_register_mutex); |
133 | } | 131 | } |
134 | 132 | ||
135 | static void tracing_stop_sched_switch(void) | 133 | static void tracing_stop_sched_switch(void) |
136 | { | 134 | { |
137 | mutex_lock(&sched_register_mutex); | 135 | mutex_lock(&sched_register_mutex); |
138 | if (!(--sched_ref)) { | 136 | if (!(--sched_ref)) |
139 | tracing_sched_unregister(); | 137 | tracing_sched_unregister(); |
140 | tracer_enabled = 0; | ||
141 | } | ||
142 | mutex_unlock(&sched_register_mutex); | 138 | mutex_unlock(&sched_register_mutex); |
143 | } | 139 | } |
144 | 140 | ||
@@ -153,14 +149,48 @@ void tracing_stop_cmdline_record(void) | |||
153 | } | 149 | } |
154 | 150 | ||
155 | /** | 151 | /** |
156 | * tracing_cmdline_assign_trace - assign a trace array for ctx switch | 152 | * tracing_start_sched_switch_record - start tracing context switches |
153 | * | ||
154 | * Turns on context switch tracing for a tracer. | ||
155 | */ | ||
156 | void tracing_start_sched_switch_record(void) | ||
157 | { | ||
158 | if (unlikely(!ctx_trace)) { | ||
159 | WARN_ON(1); | ||
160 | return; | ||
161 | } | ||
162 | |||
163 | tracing_start_sched_switch(); | ||
164 | |||
165 | mutex_lock(&sched_register_mutex); | ||
166 | tracer_enabled++; | ||
167 | mutex_unlock(&sched_register_mutex); | ||
168 | } | ||
169 | |||
170 | /** | ||
171 | * tracing_stop_sched_switch_record - start tracing context switches | ||
172 | * | ||
173 | * Turns off context switch tracing for a tracer. | ||
174 | */ | ||
175 | void tracing_stop_sched_switch_record(void) | ||
176 | { | ||
177 | mutex_lock(&sched_register_mutex); | ||
178 | tracer_enabled--; | ||
179 | WARN_ON(tracer_enabled < 0); | ||
180 | mutex_unlock(&sched_register_mutex); | ||
181 | |||
182 | tracing_stop_sched_switch(); | ||
183 | } | ||
184 | |||
185 | /** | ||
186 | * tracing_sched_switch_assign_trace - assign a trace array for ctx switch | ||
157 | * @tr: trace array pointer to assign | 187 | * @tr: trace array pointer to assign |
158 | * | 188 | * |
159 | * Some tracers might want to record the context switches in their | 189 | * Some tracers might want to record the context switches in their |
160 | * trace. This function lets those tracers assign the trace array | 190 | * trace. This function lets those tracers assign the trace array |
161 | * to use. | 191 | * to use. |
162 | */ | 192 | */ |
163 | void tracing_cmdline_assign_trace(struct trace_array *tr) | 193 | void tracing_sched_switch_assign_trace(struct trace_array *tr) |
164 | { | 194 | { |
165 | ctx_trace = tr; | 195 | ctx_trace = tr; |
166 | } | 196 | } |
@@ -168,12 +198,12 @@ void tracing_cmdline_assign_trace(struct trace_array *tr) | |||
168 | static void start_sched_trace(struct trace_array *tr) | 198 | static void start_sched_trace(struct trace_array *tr) |
169 | { | 199 | { |
170 | sched_switch_reset(tr); | 200 | sched_switch_reset(tr); |
171 | tracing_start_cmdline_record(); | 201 | tracing_start_sched_switch_record(); |
172 | } | 202 | } |
173 | 203 | ||
174 | static void stop_sched_trace(struct trace_array *tr) | 204 | static void stop_sched_trace(struct trace_array *tr) |
175 | { | 205 | { |
176 | tracing_stop_cmdline_record(); | 206 | tracing_stop_sched_switch_record(); |
177 | } | 207 | } |
178 | 208 | ||
179 | static void sched_switch_trace_init(struct trace_array *tr) | 209 | static void sched_switch_trace_init(struct trace_array *tr) |