Commit 7ee1768d authored by Pekka Paalanen's avatar Pekka Paalanen Committed by Ingo Molnar

x86, mmiotrace: fix buffer overrun detection

Impact: fix mmiotrace overrun tracing

When ftrace framework moved to use the ring buffer facility, the buffer
overrun detection was broken after 2.6.27 by commit

| commit 3928a8a2
| Author: Steven Rostedt <rostedt@goodmis.org>
| Date:   Mon Sep 29 23:02:41 2008 -0400
|
|     ftrace: make work with new ring buffer
|
|     This patch ports ftrace over to the new ring buffer.

The detection is now fixed by using the ring buffer API.

When mmiotrace detects a buffer overrun, it will report the number of
lost events. People reading an mmiotrace log must know if something was
missed, otherwise the data may not make sense.
Signed-off-by: default avatarPekka Paalanen <pq@iki.fi>
Acked-by: default avatarSteven Rostedt <rostedt@goodmis.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 522a110b
...@@ -18,12 +18,14 @@ struct header_iter { ...@@ -18,12 +18,14 @@ struct header_iter {
static struct trace_array *mmio_trace_array; static struct trace_array *mmio_trace_array;
static bool overrun_detected; static bool overrun_detected;
static unsigned long prev_overruns;
static void mmio_reset_data(struct trace_array *tr) static void mmio_reset_data(struct trace_array *tr)
{ {
int cpu; int cpu;
overrun_detected = false; overrun_detected = false;
prev_overruns = 0;
tr->time_start = ftrace_now(tr->cpu); tr->time_start = ftrace_now(tr->cpu);
for_each_online_cpu(cpu) for_each_online_cpu(cpu)
...@@ -128,16 +130,12 @@ static void mmio_close(struct trace_iterator *iter) ...@@ -128,16 +130,12 @@ static void mmio_close(struct trace_iterator *iter)
static unsigned long count_overruns(struct trace_iterator *iter) static unsigned long count_overruns(struct trace_iterator *iter)
{ {
int cpu;
unsigned long cnt = 0; unsigned long cnt = 0;
/* FIXME: */ unsigned long over = ring_buffer_overruns(iter->tr->buffer);
#if 0
for_each_online_cpu(cpu) { if (over > prev_overruns)
cnt += iter->overrun[cpu]; cnt = over - prev_overruns;
iter->overrun[cpu] = 0; prev_overruns = over;
}
#endif
(void)cpu;
return cnt; return cnt;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment