linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] libtracefs: Fixups to tracefs_cpu_stop()
@ 2023-01-05 21:52 Steven Rostedt
  2023-01-05 21:52 ` [PATCH 1/2] libtracefs: Have tracefs_cpu_stop() do nothing only with PERM_NONBLOCK Steven Rostedt
  2023-01-05 21:52 ` [PATCH 2/2] libtracefs: Have tracefs_cpu_stop() always suggesting nudging Steven Rostedt
  0 siblings, 2 replies; 4+ messages in thread
From: Steven Rostedt @ 2023-01-05 21:52 UTC (permalink / raw)
  To: linux-trace-devel; +Cc: Steven Rostedt (Google)

From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

Working on trace-cmd stream, there were some issues with stopping the
recorders, as they were getting stuck in the read state. It appears that
tracefs_cpu_stop() doesn't guarantee that the readers are awake. Until it can
be straiten out, always tell the callers that there needs to be a nudge to the
readers (ie. a signal).

Steven Rostedt (Google) (2):
  libtracefs: Have tracefs_cpu_stop() do nothing only with PERM_NONBLOCK
  libtracefs: Have tracefs_cpu_stop() always suggesting nudging

 src/tracefs-record.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

-- 
2.35.1


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

* [PATCH 1/2] libtracefs: Have tracefs_cpu_stop() do nothing only with PERM_NONBLOCK
  2023-01-05 21:52 [PATCH 0/2] libtracefs: Fixups to tracefs_cpu_stop() Steven Rostedt
@ 2023-01-05 21:52 ` Steven Rostedt
  2023-01-05 21:52 ` [PATCH 2/2] libtracefs: Have tracefs_cpu_stop() always suggesting nudging Steven Rostedt
  1 sibling, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2023-01-05 21:52 UTC (permalink / raw)
  To: linux-trace-devel; +Cc: Steven Rostedt (Google)

From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

As NONBLOCK can be set temporarily, if that's the state do not skip trying
to wake up the reader if its set. It may still need a kick.

Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 src/tracefs-record.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/tracefs-record.c b/src/tracefs-record.c
index 428bec0dfe3d..f998883134b8 100644
--- a/src/tracefs-record.c
+++ b/src/tracefs-record.c
@@ -421,7 +421,7 @@ int tracefs_cpu_stop(struct tracefs_cpu *tcpu)
 {
 	int ret = 1;
 
-	if (tcpu->flags & TC_NONBLOCK)
+	if (tcpu->flags & TC_PERM_NONBLOCK)
 		return 0;
 
 	ret = write(tcpu->ctrl_pipe[1], &ret, 1);
-- 
2.35.1


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

* [PATCH 2/2] libtracefs: Have tracefs_cpu_stop() always suggesting nudging
  2023-01-05 21:52 [PATCH 0/2] libtracefs: Fixups to tracefs_cpu_stop() Steven Rostedt
  2023-01-05 21:52 ` [PATCH 1/2] libtracefs: Have tracefs_cpu_stop() do nothing only with PERM_NONBLOCK Steven Rostedt
@ 2023-01-05 21:52 ` Steven Rostedt
  2023-01-06  4:11   ` Steven Rostedt
  1 sibling, 1 reply; 4+ messages in thread
From: Steven Rostedt @ 2023-01-05 21:52 UTC (permalink / raw)
  To: linux-trace-devel; +Cc: Steven Rostedt (Google)

From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

The man page of tracefs_cpu_stop() states that if it returns 0 that it
guaranteed to wake up a reader. Well, that doesn't appear to always be the
case. Return 1 until we can figure it out.

Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 src/tracefs-record.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/tracefs-record.c b/src/tracefs-record.c
index f998883134b8..9baec6780974 100644
--- a/src/tracefs-record.c
+++ b/src/tracefs-record.c
@@ -429,15 +429,11 @@ int tracefs_cpu_stop(struct tracefs_cpu *tcpu)
 		return ret;
 
 	/* Calling ioctl() on recent kernels will wake up the waiters */
-	ret = ioctl(tcpu->fd, 0);
-	if (ret < 0)
-		ret = 1;
-	else
-		ret = 0;
+	ioctl(tcpu->fd, 0);
 
 	set_nonblock(tcpu);
 
-	return ret;
+	return 1;
 }
 
 /**
-- 
2.35.1


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

* Re: [PATCH 2/2] libtracefs: Have tracefs_cpu_stop() always suggesting nudging
  2023-01-05 21:52 ` [PATCH 2/2] libtracefs: Have tracefs_cpu_stop() always suggesting nudging Steven Rostedt
@ 2023-01-06  4:11   ` Steven Rostedt
  0 siblings, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2023-01-06  4:11 UTC (permalink / raw)
  To: linux-trace-devel

On Thu,  5 Jan 2023 16:52:52 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:

> From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
> 
> The man page of tracefs_cpu_stop() states that if it returns 0 that it
> guaranteed to wake up a reader. Well, that doesn't appear to always be the
> case. Return 1 until we can figure it out.
> 

Hmm, I got my application working again without this change.

I'll hold off from applying it. Perhaps it was the application fault and
not the library.

-- Steve

> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> ---
>  src/tracefs-record.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/src/tracefs-record.c b/src/tracefs-record.c
> index f998883134b8..9baec6780974 100644
> --- a/src/tracefs-record.c
> +++ b/src/tracefs-record.c
> @@ -429,15 +429,11 @@ int tracefs_cpu_stop(struct tracefs_cpu *tcpu)
>  		return ret;
>  
>  	/* Calling ioctl() on recent kernels will wake up the waiters */
> -	ret = ioctl(tcpu->fd, 0);
> -	if (ret < 0)
> -		ret = 1;
> -	else
> -		ret = 0;
> +	ioctl(tcpu->fd, 0);
>  
>  	set_nonblock(tcpu);
>  
> -	return ret;
> +	return 1;
>  }
>  
>  /**


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

end of thread, other threads:[~2023-01-06  4:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-05 21:52 [PATCH 0/2] libtracefs: Fixups to tracefs_cpu_stop() Steven Rostedt
2023-01-05 21:52 ` [PATCH 1/2] libtracefs: Have tracefs_cpu_stop() do nothing only with PERM_NONBLOCK Steven Rostedt
2023-01-05 21:52 ` [PATCH 2/2] libtracefs: Have tracefs_cpu_stop() always suggesting nudging Steven Rostedt
2023-01-06  4:11   ` 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).