Skip to content

Commit f1dc672

Browse files
Steven Rostedt (Red Hat)rostedt
authored andcommitted
ring-buffer: Init waitqueue for blocked readers
The move of blocked readers to the ring buffer left out the init of the wait queue that is used. Tests missed this due to running stress tests against the buffers, which didn't allow for any readers to end up waiting. Running a simple read and wait triggered a bug. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
1 parent 523c811 commit f1dc672

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kernel/trace/ring_buffer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,6 +1185,7 @@ rb_allocate_cpu_buffer(struct ring_buffer *buffer, int nr_pages, int cpu)
11851185
INIT_WORK(&cpu_buffer->update_pages_work, update_pages_handler);
11861186
init_completion(&cpu_buffer->update_done);
11871187
init_irq_work(&cpu_buffer->irq_work.work, rb_wake_up_waiters);
1188+
init_waitqueue_head(&cpu_buffer->irq_work.waiters);
11881189

11891190
bpage = kzalloc_node(ALIGN(sizeof(*bpage), cache_line_size()),
11901191
GFP_KERNEL, cpu_to_node(cpu));
@@ -1281,6 +1282,7 @@ struct ring_buffer *__ring_buffer_alloc(unsigned long size, unsigned flags,
12811282
buffer->reader_lock_key = key;
12821283

12831284
init_irq_work(&buffer->irq_work.work, rb_wake_up_waiters);
1285+
init_waitqueue_head(&buffer->irq_work.waiters);
12841286

12851287
/* need at least two pages */
12861288
if (nr_pages < 2)

0 commit comments

Comments
 (0)