Bug 216369
Summary: | trace_read_pipe peek a PADDING event and trying to print it | ||
---|---|---|---|
Product: | Tracing/Profiling | Reporter: | Jiazi Li (jiazi.li) |
Component: | Ftrace | Assignee: | Steven Rostedt (rostedt) |
Status: | NEW --- | ||
Severity: | normal | ||
Priority: | P1 | ||
Hardware: | ARM | ||
OS: | Linux | ||
Kernel Version: | 4.19、5.10 | Subsystem: | |
Regression: | No | Bisected commit-id: |
Description
Jiazi Li
2022-08-16 06:39:26 UTC
hi, This issue has happened many times. Every time peek_next_entry return a padding event at end of page. Our reader task poll trace_pipe and other files. Maybe this issue will triggered in the following scenarios: 1. reader task wakeup by other file. 2. after read data from other file, call ring_buffer_poll_wait and find ring_buffer no empty because read != commit, but because of cpu out-of-order execution, next event has not been set to padding type. 3. in ring_buffer_peek, expired data in this event show it is not a padding event, and return event to peek_next_entry. 4. event is set to padding type and detected in rb_event_data, then print a warning. 5. print_trace_line use error type to print this event, eventually crash. Maybe we can add smp_wb to make ture padding type will be set first: --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -2681,6 +2681,7 @@ rb_move_tail(struct ring_buffer_per_cpu *cpu_buffer, rb_reset_tail(cpu_buffer, tail, info); + smp_wb(); /* Commit what we have for now. */ rb_end_commit(cpu_buffer); /* rb_end_commit() decs committing */ |