aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/trace/trace.c')
-rw-r--r--kernel/trace/trace.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 1281969103b8..b9126ef46a9e 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -609,6 +609,7 @@ void unregister_tracer(struct tracer *type)
609void tracing_reset(struct trace_array_cpu *data) 609void tracing_reset(struct trace_array_cpu *data)
610{ 610{
611 data->trace_idx = 0; 611 data->trace_idx = 0;
612 data->overrun = 0;
612 data->trace_head = data->trace_tail = head_page(data); 613 data->trace_head = data->trace_tail = head_page(data);
613 data->trace_head_idx = 0; 614 data->trace_head_idx = 0;
614 data->trace_tail_idx = 0; 615 data->trace_tail_idx = 0;
@@ -750,6 +751,7 @@ tracing_get_trace_entry(struct trace_array *tr, struct trace_array_cpu *data)
750 if (data->trace_head == data->trace_tail && 751 if (data->trace_head == data->trace_tail &&
751 idx_next == data->trace_tail_idx) { 752 idx_next == data->trace_tail_idx) {
752 /* overrun */ 753 /* overrun */
754 data->overrun++;
753 data->trace_tail_idx++; 755 data->trace_tail_idx++;
754 if (data->trace_tail_idx >= ENTRIES_PER_PAGE) { 756 if (data->trace_tail_idx >= ENTRIES_PER_PAGE) {
755 data->trace_tail = 757 data->trace_tail =
@@ -2353,8 +2355,6 @@ tracing_read_pipe(struct file *filp, char __user *ubuf,
2353{ 2355{
2354 struct trace_iterator *iter = filp->private_data; 2356 struct trace_iterator *iter = filp->private_data;
2355 struct trace_array_cpu *data; 2357 struct trace_array_cpu *data;
2356 struct trace_array *tr = iter->tr;
2357 struct tracer *tracer = iter->trace;
2358 static cpumask_t mask; 2358 static cpumask_t mask;
2359 static int start; 2359 static int start;
2360 unsigned long flags; 2360 unsigned long flags;
@@ -2433,10 +2433,11 @@ tracing_read_pipe(struct file *filp, char __user *ubuf,
2433 if (cnt >= PAGE_SIZE) 2433 if (cnt >= PAGE_SIZE)
2434 cnt = PAGE_SIZE - 1; 2434 cnt = PAGE_SIZE - 1;
2435 2435
2436 memset(iter, 0, sizeof(*iter)); 2436 /* reset all but tr, trace, and overruns */
2437 iter->tr = tr;
2438 iter->trace = tracer;
2439 iter->pos = -1; 2437 iter->pos = -1;
2438 memset(&iter->seq, 0,
2439 sizeof(struct trace_iterator) -
2440 offsetof(struct trace_iterator, seq));
2440 2441
2441 /* 2442 /*
2442 * We need to stop all tracing on all CPUS to read the 2443 * We need to stop all tracing on all CPUS to read the
@@ -2465,6 +2466,11 @@ tracing_read_pipe(struct file *filp, char __user *ubuf,
2465 for_each_cpu_mask(cpu, mask) { 2466 for_each_cpu_mask(cpu, mask) {
2466 data = iter->tr->data[cpu]; 2467 data = iter->tr->data[cpu];
2467 __raw_spin_lock(&data->lock); 2468 __raw_spin_lock(&data->lock);
2469
2470 if (data->overrun > iter->last_overrun[cpu])
2471 iter->overrun[cpu] +=
2472 data->overrun - iter->last_overrun[cpu];
2473 iter->last_overrun[cpu] = data->overrun;
2468 } 2474 }
2469 2475
2470 while (find_next_entry_inc(iter) != NULL) { 2476 while (find_next_entry_inc(iter) != NULL) {