[ltt-dev] [Autotest] [PATCH] LTTng trace destroy wait for readers to complete

Jiaying Zhang jiayingz at google.com
Mon Sep 15 16:09:35 EDT 2008


Yes. The patch solves the problem. We no longer need to
add the sleep after stop tracing with the patched kernel.

Jiaying

On Mon, Sep 15, 2008 at 12:08 PM, Mathieu Desnoyers <
compudj at krystal.dyndns.org> wrote:

> Hi John,
>
> Please try the following patch instead. It should make lttctl wait until
> all lttd instances release the trace kref.
>
> Mathieu
>
>
> LTTng trace destroy wait for readers to complete
>
> Make lttctl sleep until all the lttd readers complete.
>
> Hopefully this will brighten Martin's day.
>
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at polymtl.ca>
> CC: Martin J. Bligh <mbligh at google.com>
> CC: Jiaying Zhang <jiayingz at google.com>
> CC: John Admanski <jadmanski at google.com>
> ---
>  ltt/ltt-tracer.c |    9 +++++++++
>  1 file changed, 9 insertions(+)
>
> Index: linux-2.6-lttng/ltt/ltt-tracer.c
> ===================================================================
> --- linux-2.6-lttng.orig/ltt/ltt-tracer.c       2008-09-15
> 14:43:00.000000000 -0400
> +++ linux-2.6-lttng/ltt/ltt-tracer.c    2008-09-15 14:58:03.000000000 -0400
> @@ -40,6 +40,7 @@
>  #include <linux/fs.h>
>  #include <linux/cpu.h>
>  #include <linux/kref.h>
> +#include <linux/delay.h>
>  #include <asm/atomic.h>
>
>  static void async_wakeup(unsigned long data);
> @@ -635,6 +636,14 @@ static void __ltt_trace_destroy(struct l
>
>        module_put(trace->transport->owner);
>
> +       /*
> +        * Wait for lttd readers to release the files, therefore making
> sure
> +        * the last subbuffers have been read. Currently use a sleep,
> should
> +        * probably use a waitqueue.
> +        */
> +       while (atomic_read(&trace->kref.refcount) > 1)
> +               ssleep(1);
> +
>        kref_put(&trace->kref, ltt_release_trace);
>  }
>
>
> --
> Mathieu Desnoyers
> OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
> _______________________________________________
> Autotest mailing list
> Autotest at test.kernel.org
> http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.casi.polymtl.ca/pipermail/lttng-dev/attachments/20080915/5986865d/attachment-0002.htm>


More information about the lttng-dev mailing list