Skip to content

Commit aa997d2

Browse files
committed
ring-buffer: Do not warn in ring_buffer_map_get_reader() when reader catches up
The function ring_buffer_map_get_reader() is a bit more strict than the other get reader functions, and except for certain situations the rb_get_reader_page() should not return NULL. If it does, it triggers a warning. This warning was triggering but after looking at why, it was because another acceptable situation was happening and it wasn't checked for. If the reader catches up to the writer and there's still data to be read on the reader page, then the rb_get_reader_page() will return NULL as there's no new page to get. In this situation, the reader page should not be updated and no warning should trigger. Cc: [email protected] Cc: Masami Hiramatsu <[email protected]> Cc: Mathieu Desnoyers <[email protected]> Cc: Vincent Donnefort <[email protected]> Reported-by: [email protected] Closes: https://lore.kernel.org/all/[email protected]/ Link: https://lore.kernel.org/[email protected] Fixes: 117c392 ("ring-buffer: Introducing ring-buffer mapping functions") Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent dcb6fa3 commit aa997d2

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

kernel/trace/ring_buffer.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7344,6 +7344,10 @@ int ring_buffer_map_get_reader(struct trace_buffer *buffer, int cpu)
73447344
goto out;
73457345
}
73467346

7347+
/* Did the reader catch up with the writer? */
7348+
if (cpu_buffer->reader_page == cpu_buffer->commit_page)
7349+
goto out;
7350+
73477351
reader = rb_get_reader_page(cpu_buffer);
73487352
if (WARN_ON(!reader))
73497353
goto out;

0 commit comments

Comments
 (0)