]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
tracing/ring-buffer: Have polling block on watermark
authorSteven Rostedt (Google) <rostedt@goodmis.org>
Fri, 21 Oct 2022 03:14:27 +0000 (23:14 -0400)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 14 Dec 2022 12:59:29 +0000 (13:59 +0100)
commit570108ef93a939c39b7df5639140b3d6b60524e6
treee4b5aa2759f8de78ae5d15dedcbc025658459419
parent1dc995d3059c3a45415a50ae64c73ffcb546366e
tracing/ring-buffer: Have polling block on watermark

commit 42fb0a1e84ff525ebe560e2baf9451ab69127e2b upstream.

Currently the way polling works on the ring buffer is broken. It will
return immediately if there's any data in the ring buffer whereas a read
will block until the watermark (defined by the tracefs buffer_percent file)
is hit.

That is, a select() or poll() will return as if there's data available,
but then the following read will block. This is broken for the way
select()s and poll()s are supposed to work.

Have the polling on the ring buffer also block the same way reads and
splice does on the ring buffer.

Link: https://lkml.kernel.org/r/20221020231427.41be3f26@gandalf.local.home
Cc: Linux Trace Kernel <linux-trace-kernel@vger.kernel.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Primiano Tucci <primiano@google.com>
Cc: stable@vger.kernel.org
Fixes: 1e0d6714aceb7 ("ring-buffer: Do not wake up a splice waiter when page is not full")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 8b318f3032bf5395e1326380f7e04416386368b5)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
include/linux/ring_buffer.h
kernel/trace/ring_buffer.c
kernel/trace/trace.c