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>
This commit is contained in:
Родитель
652567aa20
Коммит
5a90f577e5
|
@ -1117,9 +1117,8 @@ trace_entry_idx(struct trace_array *tr, struct trace_array_cpu *data,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Increment the index counter of an iterator by one */
|
/* Increment the index counter of an iterator by one */
|
||||||
static void trace_iterator_increment(struct trace_iterator *iter, int cpu)
|
static void __trace_iterator_increment(struct trace_iterator *iter, int cpu)
|
||||||
{
|
{
|
||||||
iter->idx++;
|
|
||||||
iter->next_idx[cpu]++;
|
iter->next_idx[cpu]++;
|
||||||
iter->next_page_idx[cpu]++;
|
iter->next_page_idx[cpu]++;
|
||||||
|
|
||||||
|
@ -1132,6 +1131,12 @@ static void trace_iterator_increment(struct trace_iterator *iter, int cpu)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void trace_iterator_increment(struct trace_iterator *iter, int cpu)
|
||||||
|
{
|
||||||
|
iter->idx++;
|
||||||
|
__trace_iterator_increment(iter, cpu);
|
||||||
|
}
|
||||||
|
|
||||||
static struct trace_entry *
|
static struct trace_entry *
|
||||||
trace_entry_next(struct trace_array *tr, struct trace_array_cpu *data,
|
trace_entry_next(struct trace_array *tr, struct trace_array_cpu *data,
|
||||||
struct trace_iterator *iter, int cpu)
|
struct trace_iterator *iter, int cpu)
|
||||||
|
@ -1153,7 +1158,7 @@ trace_entry_next(struct trace_array *tr, struct trace_array_cpu *data,
|
||||||
|
|
||||||
/* find a real entry */
|
/* find a real entry */
|
||||||
do {
|
do {
|
||||||
trace_iterator_increment(iter, cpu);
|
__trace_iterator_increment(iter, cpu);
|
||||||
ent = trace_entry_idx(tr, tr->data[cpu], iter, cpu);
|
ent = trace_entry_idx(tr, tr->data[cpu], iter, cpu);
|
||||||
} while (ent && ent->type != TRACE_CONT);
|
} while (ent && ent->type != TRACE_CONT);
|
||||||
|
|
||||||
|
@ -1187,7 +1192,7 @@ __find_next_entry(struct trace_iterator *iter, int *ent_cpu, int inc)
|
||||||
ent = trace_entry_next(tr, data, iter, cpu);
|
ent = trace_entry_next(tr, data, iter, cpu);
|
||||||
else {
|
else {
|
||||||
while (ent && ent->type == TRACE_CONT) {
|
while (ent && ent->type == TRACE_CONT) {
|
||||||
trace_iterator_increment(iter, cpu);
|
__trace_iterator_increment(iter, cpu);
|
||||||
ent = trace_entry_idx(tr, tr->data[cpu],
|
ent = trace_entry_idx(tr, tr->data[cpu],
|
||||||
iter, cpu);
|
iter, cpu);
|
||||||
}
|
}
|
||||||
|
@ -1566,7 +1571,7 @@ trace_seq_print_cont(struct trace_seq *s, struct trace_iterator *iter)
|
||||||
|
|
||||||
do {
|
do {
|
||||||
trace_seq_printf(s, "%s", ent->cont.buf);
|
trace_seq_printf(s, "%s", ent->cont.buf);
|
||||||
trace_iterator_increment(iter, iter->cpu);
|
__trace_iterator_increment(iter, iter->cpu);
|
||||||
ent = trace_entry_idx(tr, data, iter, iter->cpu);
|
ent = trace_entry_idx(tr, data, iter, iter->cpu);
|
||||||
} while (ent && ent->type == TRACE_CONT);
|
} while (ent && ent->type == TRACE_CONT);
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче