Commit 74e7ff8c authored by Lai Jiangshan's avatar Lai Jiangshan Committed by Frederic Weisbecker

tracing: Fix missing function_graph events when we splice_read from trace_pipe

About a half events are missing when we splice_read
from trace_pipe. They are unexpectedly consumed because we ignore
the TRACE_TYPE_NO_CONSUME return value used by the function graph
tracer when it needs to consume the events by itself to walk on
the ring buffer.

The same problem appears with ftrace_dump()

Example of an output before this patch:

1)               |      ktime_get_real() {
1)   2.846 us    |          read_hpet();
1)   4.558 us    |        }
1)   6.195 us    |      }

After this patch:

0)               |      ktime_get_real() {
0)               |        getnstimeofday() {
0)   1.960 us    |          read_hpet();
0)   3.597 us    |        }
0)   5.196 us    |      }

The fix also applies on 2.6.30
Signed-off-by: default avatarLai Jiangshan <laijs@cn.fujitsu.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: stable@kernel.org
LKML-Reference: <4A6EEC52.90704@cn.fujitsu.com>
Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
parent 38ceb592
...@@ -3085,7 +3085,8 @@ tracing_fill_pipe_page(size_t rem, struct trace_iterator *iter) ...@@ -3085,7 +3085,8 @@ tracing_fill_pipe_page(size_t rem, struct trace_iterator *iter)
break; break;
} }
trace_consume(iter); if (ret != TRACE_TYPE_NO_CONSUME)
trace_consume(iter);
rem -= count; rem -= count;
if (!find_next_entry_inc(iter)) { if (!find_next_entry_inc(iter)) {
rem = 0; rem = 0;
...@@ -4233,8 +4234,11 @@ static void __ftrace_dump(bool disable_tracing) ...@@ -4233,8 +4234,11 @@ static void __ftrace_dump(bool disable_tracing)
iter.pos = -1; iter.pos = -1;
if (find_next_entry_inc(&iter) != NULL) { if (find_next_entry_inc(&iter) != NULL) {
print_trace_line(&iter); int ret;
trace_consume(&iter);
ret = print_trace_line(&iter);
if (ret != TRACE_TYPE_NO_CONSUME)
trace_consume(&iter);
} }
trace_printk_seq(&iter.seq); trace_printk_seq(&iter.seq);
......
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