Skip to content

Commit 12b5da3

Browse files
Steven Rostedtrostedt
authored andcommitted
tracing: Fix ent_size in trace output
When reading the trace file, the records of each of the per_cpu buffers are examined to find the next event to print out. At the point of looking at the event, the size of the event is recorded. But if the first event is chosen, the other events in the other CPU buffers will reset the event size that is stored in the iterator descriptor, causing the event size passed to the output functions to be incorrect. In most cases this is not a problem, but for the case of stack traces, it is. With the change to the stack tracing to record a dynamic number of back traces, the output depends on the size of the entry instead of the fixed 8 back traces. When the entry size is not correct, the back traces would not be fully printed. Note, reading from the per-cpu trace files were not affected. Reported-by: Thomas Gleixner <[email protected]> Tested-by: Thomas Gleixner <[email protected]> Cc: [email protected] Signed-off-by: Steven Rostedt <[email protected]>
1 parent 2c86bf1 commit 12b5da3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

kernel/trace/trace.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1698,6 +1698,7 @@ __find_next_entry(struct trace_iterator *iter, int *ent_cpu,
16981698
int cpu_file = iter->cpu_file;
16991699
u64 next_ts = 0, ts;
17001700
int next_cpu = -1;
1701+
int next_size = 0;
17011702
int cpu;
17021703

17031704
/*
@@ -1729,9 +1730,12 @@ __find_next_entry(struct trace_iterator *iter, int *ent_cpu,
17291730
next_cpu = cpu;
17301731
next_ts = ts;
17311732
next_lost = lost_events;
1733+
next_size = iter->ent_size;
17321734
}
17331735
}
17341736

1737+
iter->ent_size = next_size;
1738+
17351739
if (ent_cpu)
17361740
*ent_cpu = next_cpu;
17371741

0 commit comments

Comments
 (0)