|
Petr Pavlu |
d91da9 |
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
|
|
Petr Pavlu |
d91da9 |
Date: Wed, 28 Sep 2022 18:22:20 -0400
|
|
Petr Pavlu |
d91da9 |
Subject: tracing: Wake up waiters when tracing is disabled
|
|
Petr Pavlu |
d91da9 |
Git-commit: 2b0fd9a59b7990c161fa1cb7b79edb22847c87c2
|
|
Petr Pavlu |
d91da9 |
Patch-mainline: v6.1-rc1
|
|
Petr Pavlu |
d91da9 |
References: git-fixes
|
|
Petr Pavlu |
d91da9 |
|
|
Petr Pavlu |
d91da9 |
When tracing is disabled, there's no reason that waiters should stay
|
|
Petr Pavlu |
d91da9 |
waiting, wake them up, otherwise tasks get stuck when they should be
|
|
Petr Pavlu |
d91da9 |
flushing the buffers.
|
|
Petr Pavlu |
d91da9 |
|
|
Petr Pavlu |
d91da9 |
Cc: stable@vger.kernel.org
|
|
Petr Pavlu |
d91da9 |
Fixes: e30f53aad2202 ("tracing: Do not busy wait in buffer splice")
|
|
Petr Pavlu |
d91da9 |
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
|
|
Petr Pavlu |
d91da9 |
Acked-by: Petr Pavlu <petr.pavlu@suse.com>
|
|
Petr Pavlu |
d91da9 |
---
|
|
Petr Pavlu |
d91da9 |
kernel/trace/trace.c | 6 ++++++
|
|
Petr Pavlu |
d91da9 |
1 file changed, 6 insertions(+)
|
|
Petr Pavlu |
d91da9 |
|
|
Petr Pavlu |
d91da9 |
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
|
|
Petr Pavlu |
d91da9 |
index 58afc83afc9d..bb5597c6bfc1 100644
|
|
Petr Pavlu |
d91da9 |
--- a/kernel/trace/trace.c
|
|
Petr Pavlu |
d91da9 |
+++ b/kernel/trace/trace.c
|
|
Petr Pavlu |
d91da9 |
@@ -8334,6 +8334,10 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos,
|
|
Petr Pavlu |
d91da9 |
if (ret)
|
|
Petr Pavlu |
d91da9 |
goto out;
|
|
Petr Pavlu |
d91da9 |
|
|
Petr Pavlu |
d91da9 |
+ /* No need to wait after waking up when tracing is off */
|
|
Petr Pavlu |
d91da9 |
+ if (!tracer_tracing_is_on(iter->tr))
|
|
Petr Pavlu |
d91da9 |
+ goto out;
|
|
Petr Pavlu |
d91da9 |
+
|
|
Petr Pavlu |
d91da9 |
/* Make sure we see the new wait_index */
|
|
Petr Pavlu |
d91da9 |
smp_rmb();
|
|
Petr Pavlu |
d91da9 |
if (wait_index != iter->wait_index)
|
|
Petr Pavlu |
d91da9 |
@@ -9065,6 +9069,8 @@ rb_simple_write(struct file *filp, const char __user *ubuf,
|
|
Petr Pavlu |
d91da9 |
tracer_tracing_off(tr);
|
|
Petr Pavlu |
d91da9 |
if (tr->current_trace->stop)
|
|
Petr Pavlu |
d91da9 |
tr->current_trace->stop(tr);
|
|
Petr Pavlu |
d91da9 |
+ /* Wake up any waiters */
|
|
Petr Pavlu |
d91da9 |
+ ring_buffer_wake_waiters(buffer, RING_BUFFER_ALL_CPUS);
|
|
Petr Pavlu |
d91da9 |
}
|
|
Petr Pavlu |
d91da9 |
mutex_unlock(&trace_types_lock);
|
|
Petr Pavlu |
d91da9 |
}
|
|
Petr Pavlu |
d91da9 |
|