This is a note to let you know that I've just added the patch titled tracing: Wake up waiters when tracing is disabled to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: tracing-wake-up-waiters-when-tracing-is-disabled.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 2b0fd9a59b7990c161fa1cb7b79edb22847c87c2 Mon Sep 17 00:00:00 2001 From: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx> Date: Wed, 28 Sep 2022 18:22:20 -0400 Subject: tracing: Wake up waiters when tracing is disabled From: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx> commit 2b0fd9a59b7990c161fa1cb7b79edb22847c87c2 upstream. When tracing is disabled, there's no reason that waiters should stay waiting, wake them up, otherwise tasks get stuck when they should be flushing the buffers. Cc: stable@xxxxxxxxxxxxxxx Fixes: e30f53aad2202 ("tracing: Do not busy wait in buffer splice") Signed-off-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- kernel/trace/trace.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -8291,6 +8291,10 @@ tracing_buffers_splice_read(struct file if (ret) goto out; + /* No need to wait after waking up when tracing is off */ + if (!tracer_tracing_is_on(iter->tr)) + goto out; + /* Make sure we see the new wait_index */ smp_rmb(); if (wait_index != iter->wait_index) @@ -9000,6 +9004,8 @@ rb_simple_write(struct file *filp, const tracer_tracing_off(tr); if (tr->current_trace->stop) tr->current_trace->stop(tr); + /* Wake up any waiters */ + ring_buffer_wake_waiters(buffer, RING_BUFFER_ALL_CPUS); } mutex_unlock(&trace_types_lock); } Patches currently in stable-queue which might be from rostedt@xxxxxxxxxxx are queue-5.15/tracing-fix-reading-strings-from-synthetic-events.patch queue-5.15/tracing-add-ioctl-to-force-ring-buffer-waiters-to-wake-up.patch queue-5.15/ring-buffer-have-the-shortest_full-queue-be-the-shortest-not-longest.patch queue-5.15/ring-buffer-add-ring_buffer_wake_waiters.patch queue-5.15/tracing-move-duplicate-code-of-trace_kprobe-eprobe.c-into-header.patch queue-5.15/tracing-add-fault-name-injection-to-kernel-probes.patch queue-5.15/ring-buffer-fix-race-between-reset-page-and-reading-page.patch queue-5.15/tracing-wake-up-ring-buffer-waiters-on-closing-of-the-file.patch queue-5.15/tracing-disable-interrupt-or-preemption-before-acquiring-arch_spinlock_t.patch queue-5.15/tracing-wake-up-waiters-when-tracing-is-disabled.patch queue-5.15/ring-buffer-allow-splice-to-read-previous-partially-read-pages.patch queue-5.15/ring-buffer-check-pending-waiters-when-doing-wake-ups-as-well.patch queue-5.15/ftrace-properly-unset-ftrace_hash_fl_mod.patch