aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace.c
diff options
context:
space:
mode:
authorSteven Rostedt <rostedt@goodmis.org>2008-09-03 17:42:51 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-14 04:36:42 -0400
commit5a90f577e5369a84b720ead42e621fcb1b8a8b21 (patch)
tree55263f6d25613ce1ba98062ca96635aaac5dd426 /kernel/trace/trace.c
parent652567aa2000f1d4a1fd434382a30d8dd4a7c980 (diff)
ftrace: print continue index fix
An item in the trace buffer that is bigger than one entry may be split up using the TRACE_CONT entry. This makes it a virtual single entry. The current code increments the iterator index even while traversing TRACE_CONT entries, making it look like the iterator is further than it actually is. This patch adds code to not increment the iterator index while skipping over TRACE_CONT entries. Signed-off-by: Steven Rostedt <srostedt@redhat.com> Acked-by: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace/trace.c')
-rw-r--r--kernel/trace/trace.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 9639e45f0860..d24101cfc425 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1117,9 +1117,8 @@ trace_entry_idx(struct trace_array *tr, struct trace_array_cpu *data,
1117} 1117}
1118 1118
1119/* Increment the index counter of an iterator by one */ 1119/* Increment the index counter of an iterator by one */
1120static void trace_iterator_increment(struct trace_iterator *iter, int cpu) 1120static void __trace_iterator_increment(struct trace_iterator *iter, int cpu)
1121{ 1121{
1122 iter->idx++;
1123 iter->next_idx[cpu]++; 1122 iter->next_idx[cpu]++;
1124 iter->next_page_idx[cpu]++; 1123 iter->next_page_idx[cpu]++;
1125 1124
@@ -1132,6 +1131,12 @@ static void trace_iterator_increment(struct trace_iterator *iter, int cpu)
1132 } 1131 }
1133} 1132}
1134 1133
1134static void trace_iterator_increment(struct trace_iterator *iter, int cpu)
1135{
1136 iter->idx++;
1137 __trace_iterator_increment(iter, cpu);
1138}
1139
1135static struct trace_entry * 1140static struct trace_entry *
1136trace_entry_next(struct trace_array *tr, struct trace_array_cpu *data, 1141trace_entry_next(struct trace_array *tr, struct trace_array_cpu *data,
1137 struct trace_iterator *iter, int cpu) 1142 struct trace_iterator *iter, int cpu)
@@ -1153,7 +1158,7 @@ trace_entry_next(struct trace_array *tr, struct trace_array_cpu *data,
1153 1158
1154 /* find a real entry */ 1159 /* find a real entry */
1155 do { 1160 do {
1156 trace_iterator_increment(iter, cpu); 1161 __trace_iterator_increment(iter, cpu);
1157 ent = trace_entry_idx(tr, tr->data[cpu], iter, cpu); 1162 ent = trace_entry_idx(tr, tr->data[cpu], iter, cpu);
1158 } while (ent && ent->type != TRACE_CONT); 1163 } while (ent && ent->type != TRACE_CONT);
1159 1164
@@ -1187,7 +1192,7 @@ __find_next_entry(struct trace_iterator *iter, int *ent_cpu, int inc)
1187 ent = trace_entry_next(tr, data, iter, cpu); 1192 ent = trace_entry_next(tr, data, iter, cpu);
1188 else { 1193 else {
1189 while (ent && ent->type == TRACE_CONT) { 1194 while (ent && ent->type == TRACE_CONT) {
1190 trace_iterator_increment(iter, cpu); 1195 __trace_iterator_increment(iter, cpu);
1191 ent = trace_entry_idx(tr, tr->data[cpu], 1196 ent = trace_entry_idx(tr, tr->data[cpu],
1192 iter, cpu); 1197 iter, cpu);
1193 } 1198 }
@@ -1566,7 +1571,7 @@ trace_seq_print_cont(struct trace_seq *s, struct trace_iterator *iter)
1566 1571
1567 do { 1572 do {
1568 trace_seq_printf(s, "%s", ent->cont.buf); 1573 trace_seq_printf(s, "%s", ent->cont.buf);
1569 trace_iterator_increment(iter, iter->cpu); 1574 __trace_iterator_increment(iter, iter->cpu);
1570 ent = trace_entry_idx(tr, data, iter, iter->cpu); 1575 ent = trace_entry_idx(tr, data, iter, iter->cpu);
1571 } while (ent && ent->type == TRACE_CONT); 1576 } while (ent && ent->type == TRACE_CONT);
1572} 1577}