linux-edac.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 1/1] tracing: Fix poll() and select() do not work on per_cpu trace_pipe and trace_pipe_raw
@ 2023-02-02 18:23 shiju.jose
  2023-02-02 21:18 ` Steven Rostedt
  0 siblings, 1 reply; 2+ messages in thread
From: shiju.jose @ 2023-02-02 18:23 UTC (permalink / raw)
  To: rostedt, mhiramat, mchehab, linux-edac, linux-kernel, linux-trace-kernel
  Cc: linuxarm, jonathan.cameron, tanxiaofei, shiju.jose

From: Shiju Jose <shiju.jose@huawei.com>

poll() and select() on per_cpu trace_pipe and trace_pipe_raw do not work
since kernel 6.1-rc6. This issue is seen after the commit
42fb0a1e84ff525ebe560e2baf9451ab69127e2b ("tracing/ring-buffer: Have
polling block on watermark").

This issue is firstly detected and reported, when testing the CXL error
events in the rasdaemon and also erified using the test application for poll()
and select().

This issue occurs for the per_cpu case, when calling the ring_buffer_poll_wait(),
in kernel/trace/ring_buffer.c, with the buffer_percent > 0 and then wait until the
percentage of pages are available. The default value set for the buffer_percent is 50
in the kernel/trace/trace.c.

As a fix, allow userspace application could set buffer_percent as 0 through
the buffer_percent_fops, so that the task will wake up as soon as data is added
to any of the specific cpu buffer.

Fixes: 42fb0a1e84ff5 ("tracing/ring-buffer: Have polling block on watermark")
Signed-off-by: Shiju Jose <shiju.jose@huawei.com>
---
 kernel/trace/trace.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index a555a861b978..01164c78483a 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -9148,9 +9148,6 @@ buffer_percent_write(struct file *filp, const char __user *ubuf,
 	if (val > 100)
 		return -EINVAL;
 
-	if (!val)
-		val = 1;
-
 	tr->buffer_percent = val;
 
 	(*ppos)++;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [RFC PATCH 1/1] tracing: Fix poll() and select() do not work on per_cpu trace_pipe and trace_pipe_raw
  2023-02-02 18:23 [RFC PATCH 1/1] tracing: Fix poll() and select() do not work on per_cpu trace_pipe and trace_pipe_raw shiju.jose
@ 2023-02-02 21:18 ` Steven Rostedt
  0 siblings, 0 replies; 2+ messages in thread
From: Steven Rostedt @ 2023-02-02 21:18 UTC (permalink / raw)
  To: shiju.jose
  Cc: mhiramat, mchehab, linux-edac, linux-kernel, linux-trace-kernel,
	linuxarm, jonathan.cameron, tanxiaofei

On Thu, 2 Feb 2023 18:23:09 +0000
<shiju.jose@huawei.com> wrote:

> From: Shiju Jose <shiju.jose@huawei.com>
> 
> poll() and select() on per_cpu trace_pipe and trace_pipe_raw do not work
> since kernel 6.1-rc6. This issue is seen after the commit
> 42fb0a1e84ff525ebe560e2baf9451ab69127e2b ("tracing/ring-buffer: Have
> polling block on watermark").
> 
> This issue is firstly detected and reported, when testing the CXL error
> events in the rasdaemon and also erified using the test application for poll()
> and select().
> 
> This issue occurs for the per_cpu case, when calling the ring_buffer_poll_wait(),
> in kernel/trace/ring_buffer.c, with the buffer_percent > 0 and then wait until the
> percentage of pages are available. The default value set for the buffer_percent is 50
> in the kernel/trace/trace.c.
> 
> As a fix, allow userspace application could set buffer_percent as 0 through
> the buffer_percent_fops, so that the task will wake up as soon as data is added
> to any of the specific cpu buffer.
> 
> Fixes: 42fb0a1e84ff5 ("tracing/ring-buffer: Have polling block on watermark")
> Signed-off-by: Shiju Jose <shiju.jose@huawei.com>
> ---

This makes sense to me. I'm going to run a bunch of tests on this and
see if anything else breaks.

Thanks!

-- Steve


>  kernel/trace/trace.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index a555a861b978..01164c78483a 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -9148,9 +9148,6 @@ buffer_percent_write(struct file *filp, const char __user *ubuf,
>  	if (val > 100)
>  		return -EINVAL;
>  
> -	if (!val)
> -		val = 1;
> -
>  	tr->buffer_percent = val;
>  
>  	(*ppos)++;


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-02-02 21:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-02 18:23 [RFC PATCH 1/1] tracing: Fix poll() and select() do not work on per_cpu trace_pipe and trace_pipe_raw shiju.jose
2023-02-02 21:18 ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).