]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ring-buffer: Check pending waiters when doing wake ups as well
authorSteven Rostedt (Google) <rostedt@goodmis.org>
Tue, 27 Sep 2022 23:15:25 +0000 (19:15 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Oct 2022 11:22:19 +0000 (13:22 +0200)
commit c841c1109d4d921d29d82a0eaea617de578cdf9f upstream.

The wake up waiters only checks the "wakeup_full" variable and not the
"full_waiters_pending". The full_waiters_pending is set when a waiter is
added to the wait queue. The wakeup_full is only set when an event is
triggered, and it clears the full_waiters_pending to avoid multiple calls
to irq_work_queue().

The irq_work callback really needs to check both wakeup_full as well as
full_waiters_pending such that this code can be used to wake up waiters
when a file is closed that represents the ring buffer and the waiters need
to be woken up.

Link: https://lkml.kernel.org/r/20220927231824.209460321@goodmis.org
Cc: stable@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Fixes: e11d4b2da5958 ("tracing/ring-buffer: Move poll wake ups into ring buffer code")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/trace/ring_buffer.c

index fd017dd7e43ea67b085b6f2ef57e29cea49d23f2..f6d28d444ed841f705f9250a33ce5a036f3e837f 100644 (file)
@@ -568,8 +568,9 @@ static void rb_wake_up_waiters(struct irq_work *work)
        struct rb_irq_work *rbwork = container_of(work, struct rb_irq_work, work);
 
        wake_up_all(&rbwork->waiters);
-       if (rbwork->wakeup_full) {
+       if (rbwork->full_waiters_pending || rbwork->wakeup_full) {
                rbwork->wakeup_full = false;
+               rbwork->full_waiters_pending = false;
                wake_up_all(&rbwork->full_waiters);
        }
 }