All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] signal condition variable at end of stop_tracers
@ 2014-09-08  7:38 Robert Schiele
  2014-09-08 14:16 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Robert Schiele @ 2014-09-08  7:38 UTC (permalink / raw)
  To: linux-btrace

stop_tracers modifies tp->is_done and thus must signal the condition
variable tracer_wait_unblock is waiting on to monitor tp->is_done.
Not doing so might cause the tool to deadlock if stop_tracers is
called while a tracer thread is in tracer_wait_unblock.

Signed-off-by: Robert Schiele <rschiele@gmail.com>
---
 blktrace.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/blktrace.c b/blktrace.c
index 7e64c94..3c8fb4c 100644
--- a/blktrace.c
+++ b/blktrace.c
@@ -1913,6 +1913,7 @@ static void stop_tracers(void)
 		struct tracer *tp = list_entry(p, struct tracer, head);
 		tp->is_done = 1;
 	}
+	pthread_cond_broadcast(&mt_cond);
 }
 
 static void del_tracers(void)
-- 
1.8.4.5

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

* Re: [PATCH] signal condition variable at end of stop_tracers
  2014-09-08  7:38 [PATCH] signal condition variable at end of stop_tracers Robert Schiele
@ 2014-09-08 14:16 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2014-09-08 14:16 UTC (permalink / raw)
  To: linux-btrace

On 09/08/2014 01:38 AM, Robert Schiele wrote:
> stop_tracers modifies tp->is_done and thus must signal the condition
> variable tracer_wait_unblock is waiting on to monitor tp->is_done.
> Not doing so might cause the tool to deadlock if stop_tracers is
> called while a tracer thread is in tracer_wait_unblock.
> 
> Signed-off-by: Robert Schiele <rschiele@gmail.com>
> ---
>  blktrace.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/blktrace.c b/blktrace.c
> index 7e64c94..3c8fb4c 100644
> --- a/blktrace.c
> +++ b/blktrace.c
> @@ -1913,6 +1913,7 @@ static void stop_tracers(void)
>  		struct tracer *tp = list_entry(p, struct tracer, head);
>  		tp->is_done = 1;
>  	}
> +	pthread_cond_broadcast(&mt_cond);
>  }
>  
>  static void del_tracers(void)
> 

Good catch! Applied.

-- 
Jens Axboe


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

end of thread, other threads:[~2014-09-08 14:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-08  7:38 [PATCH] signal condition variable at end of stop_tracers Robert Schiele
2014-09-08 14:16 ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.