diff options
author | Alexander Z Lam <azl@google.com> | 2013-08-02 21:36:16 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-15 01:59:07 -0400 |
commit | e88512e77c0a22fc860cfb1100920cb1ca3705d3 (patch) | |
tree | 8d49e533e06cca6498dc0ff9bda8f0f811c5b1bd /kernel | |
parent | 2fd821ee4dd784a940d6840ebc85ecc8d7b80744 (diff) |
tracing: Fix reset of time stamps during trace_clock changes
commit 9457158bbc0ee04ecef76862d73eecd8076e9c7b upstream.
Fixed two issues with changing the timestamp clock with trace_clock:
- The global buffer was reset on instance clock changes. Change this to pass
the correct per-instance buffer
- ftrace_now() is used to set buf->time_start in tracing_reset_online_cpus().
This was incorrect because ftrace_now() used the global buffer's clock to
return the current time. Change this to use buffer_ftrace_now() which
returns the current time for the correct per-instance buffer.
Also removed tracing_reset_current() because it is not used anywhere
Link: http://lkml.kernel.org/r/1375493777-17261-2-git-send-email-azl@google.com
Signed-off-by: Alexander Z Lam <azl@google.com>
Cc: Vaibhav Nagarnaik <vnagarnaik@google.com>
Cc: David Sharp <dhsharp@google.com>
Cc: Alexander Z Lam <lambchop468@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/trace/trace.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index b2aebd62fd33..06a5bcef373f 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -232,20 +232,25 @@ int filter_current_check_discard(struct ring_buffer *buffer, | |||
232 | } | 232 | } |
233 | EXPORT_SYMBOL_GPL(filter_current_check_discard); | 233 | EXPORT_SYMBOL_GPL(filter_current_check_discard); |
234 | 234 | ||
235 | cycle_t ftrace_now(int cpu) | 235 | cycle_t buffer_ftrace_now(struct trace_buffer *buf, int cpu) |
236 | { | 236 | { |
237 | u64 ts; | 237 | u64 ts; |
238 | 238 | ||
239 | /* Early boot up does not have a buffer yet */ | 239 | /* Early boot up does not have a buffer yet */ |
240 | if (!global_trace.trace_buffer.buffer) | 240 | if (!buf->buffer) |
241 | return trace_clock_local(); | 241 | return trace_clock_local(); |
242 | 242 | ||
243 | ts = ring_buffer_time_stamp(global_trace.trace_buffer.buffer, cpu); | 243 | ts = ring_buffer_time_stamp(buf->buffer, cpu); |
244 | ring_buffer_normalize_time_stamp(global_trace.trace_buffer.buffer, cpu, &ts); | 244 | ring_buffer_normalize_time_stamp(buf->buffer, cpu, &ts); |
245 | 245 | ||
246 | return ts; | 246 | return ts; |
247 | } | 247 | } |
248 | 248 | ||
249 | cycle_t ftrace_now(int cpu) | ||
250 | { | ||
251 | return buffer_ftrace_now(&global_trace.trace_buffer, cpu); | ||
252 | } | ||
253 | |||
249 | /** | 254 | /** |
250 | * tracing_is_enabled - Show if global_trace has been disabled | 255 | * tracing_is_enabled - Show if global_trace has been disabled |
251 | * | 256 | * |
@@ -1194,7 +1199,7 @@ void tracing_reset_online_cpus(struct trace_buffer *buf) | |||
1194 | /* Make sure all commits have finished */ | 1199 | /* Make sure all commits have finished */ |
1195 | synchronize_sched(); | 1200 | synchronize_sched(); |
1196 | 1201 | ||
1197 | buf->time_start = ftrace_now(buf->cpu); | 1202 | buf->time_start = buffer_ftrace_now(buf, buf->cpu); |
1198 | 1203 | ||
1199 | for_each_online_cpu(cpu) | 1204 | for_each_online_cpu(cpu) |
1200 | ring_buffer_reset_cpu(buffer, cpu); | 1205 | ring_buffer_reset_cpu(buffer, cpu); |
@@ -1202,11 +1207,6 @@ void tracing_reset_online_cpus(struct trace_buffer *buf) | |||
1202 | ring_buffer_record_enable(buffer); | 1207 | ring_buffer_record_enable(buffer); |
1203 | } | 1208 | } |
1204 | 1209 | ||
1205 | void tracing_reset_current(int cpu) | ||
1206 | { | ||
1207 | tracing_reset(&global_trace.trace_buffer, cpu); | ||
1208 | } | ||
1209 | |||
1210 | /* Must have trace_types_lock held */ | 1210 | /* Must have trace_types_lock held */ |
1211 | void tracing_reset_all_online_cpus(void) | 1211 | void tracing_reset_all_online_cpus(void) |
1212 | { | 1212 | { |
@@ -4647,12 +4647,12 @@ static ssize_t tracing_clock_write(struct file *filp, const char __user *ubuf, | |||
4647 | * New clock may not be consistent with the previous clock. | 4647 | * New clock may not be consistent with the previous clock. |
4648 | * Reset the buffer so that it doesn't have incomparable timestamps. | 4648 | * Reset the buffer so that it doesn't have incomparable timestamps. |
4649 | */ | 4649 | */ |
4650 | tracing_reset_online_cpus(&global_trace.trace_buffer); | 4650 | tracing_reset_online_cpus(&tr->trace_buffer); |
4651 | 4651 | ||
4652 | #ifdef CONFIG_TRACER_MAX_TRACE | 4652 | #ifdef CONFIG_TRACER_MAX_TRACE |
4653 | if (tr->flags & TRACE_ARRAY_FL_GLOBAL && tr->max_buffer.buffer) | 4653 | if (tr->flags & TRACE_ARRAY_FL_GLOBAL && tr->max_buffer.buffer) |
4654 | ring_buffer_set_clock(tr->max_buffer.buffer, trace_clocks[i].func); | 4654 | ring_buffer_set_clock(tr->max_buffer.buffer, trace_clocks[i].func); |
4655 | tracing_reset_online_cpus(&global_trace.max_buffer); | 4655 | tracing_reset_online_cpus(&tr->max_buffer); |
4656 | #endif | 4656 | #endif |
4657 | 4657 | ||
4658 | mutex_unlock(&trace_types_lock); | 4658 | mutex_unlock(&trace_types_lock); |