[lttng-dev] Help getting Loglevel from Babeltrace C API

2018-01-09 Thread Ronan Amorim
Hi,

Sorry if this being asked before or if this is not the right mailing list
for babeltrace questions.

I am trying to use babeltrace to read traces written using Lttng.
However, I cannot  find a way of reading the loglevel from Babeltrace C API.
I see that babeltrace CLI is able to retrieve this information but the API
does no expose the same things that are used in the cli code.

I appreciate any help or pointers.

Thanks,
Ronan
___
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


Re: [lttng-dev] lttng-dev Digest, Vol 117, Issue 3

2018-01-09 Thread Majid Rezazadeh
coredump?
> >
> > "thread apply all bt" in gdb with the corefile loaded.
> >
> > Make sure to compile with debug symbol and rerun your test.
>
> Forgot to mention that you should open a bug here:
>
> https://bugs.lttng.org/
>
> Make sure to read the bug reporting guidelines.
>
> Cheers!
>
> --
> Jonathan Rajotte-Julien
> EfficiOS
>
>
> --
>
> Message: 3
> Date: Tue, 9 Jan 2018 10:34:18 -0500
> From: Genevieve Bastien <gbastien+lt...@versatic.net>
> To: lttng-dev@lists.lttng.org
> Subject: Re: [lttng-dev] LD_PRELOAD applications using
> lttng-ust-pthread
> Message-ID: <bfd757ed-4b3e-1294-f476-34a2b373a...@versatic.net>
> Content-Type: text/plain; charset="utf-8"
>
> Hi Majid,
>
>
> See the documentation here:
> http://lttng.org/docs/v2.10/#doc-using-lttng-ust-with-daemons and
> http://lttng.org/docs/v2.10/#doc-liblttng-ust-fd. Firefox requires at
> least one of those extra libraries to be preloaded, the one for fork I
> think.
>
>
> I recall trying to trace firefox with lttng-cyg-profile without much
> success. Without the liblttng-ust-fork.so preloaded, my tabs had
> segfaults. But when I tried with both libraries, it seemed there was a
> conflict between cyg-profile and the other preloaded libraries, I don't
> remember exactly what happened. Maybe you won't have this problem with
> lttng-ust-libc-wrapper.
>
>
> I hope this helps,
>
> Geneviève
>
>
> On 2018-01-08 10:35 PM, Majid Rezazadeh wrote:
> > Hi all
> >
> > I am using lttng-ust-libc-wrapper for instrumenting some calls to libc
> > for some applications like Firefox and Chrome, but I receive
> > "Segmentation fault (core dumped)". I compile lttng-ust-pthread.c (gcc
> > -fPIC -shared  -o test.so lttng-ust-pthread.c -ldl) and then I use
> > "LD_PRELOAD=test.so firefox" but I receive segmentation fault (I have
> > exported LD_LIBRARY_PATH to the absolute path of test.so file). I
> > found out that when I replace tracepoints with printf in
> > lttng_ust_pthread.c, I receive no error. It seems that hooking
> > tracepoints in this wrapper makes some problems. Do you have any idea
> > in this regard?
> >
> > Thanks
> >
> > Majid
> >
> >
> > ___
> > lttng-dev mailing list
> > lttng-dev@lists.lttng.org
> > https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
>
> -- next part --
> An HTML attachment was scrubbed...
> URL: <https://lists.lttng.org/pipermail/lttng-dev/attachments/
> 20180109/3b570b98/attachment-0001.html>
>
> --
>
> Message: 4
> Date: Tue,  9 Jan 2018 15:43:21 -0500
> From: Michael Jeanson <mjean...@efficios.com>
> To: lttng-dev@lists.lttng.org
> Subject: [lttng-dev] [PATCH lttng-modules 3/3] Fix: Update btrfs
> instrumentation for v4.15
> Message-ID: <1515530601-19259-3-git-send-email-mjean...@efficios.com>
>
> See upstream commit:
>
>   commit d278850eff3053ef166cf64c16f798dfe36278a2
>   Author: Josef Bacik <jo...@toxicpanda.com>
>   Date:   Fri Sep 29 15:43:57 2017 -0400
>
> btrfs: remove delayed_ref_node from ref_head
>
> This is just excessive information in the ref_head, and makes the code
> complicated.  It is a relic from when we had the heads and the refs in
> the same tree, which is no longer the case.  With this removal I've
> cleaned up a bunch of the cruft around this old assumption as well.
>
> Signed-off-by: Michael Jeanson <mjean...@efficios.com>
> ---
>  instrumentation/events/lttng-module/btrfs.h | 18 +-
>  1 file changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/instrumentation/events/lttng-module/btrfs.h
> b/instrumentation/events/lttng-module/btrfs.h
> index b529e8e..7901f05 100644
> --- a/instrumentation/events/lttng-module/btrfs.h
> +++ b/instrumentation/events/lttng-module/btrfs.h
> @@ -680,7 +680,23 @@ LTTNG_TRACEPOINT_EVENT(btrfs_delayed_data_ref,
> )
>  )
>
> -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0))
> +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0))
> +LTTNG_TRACEPOINT_EVENT(btrfs_delayed_ref_head,
> +
> +   TP_PROTO(struct btrfs_fs_info *fs_info,
> +struct btrfs_delayed_ref_head *head_ref,
> +int action),
> +
> +   TP_ARGS(fs_info, head_ref, action),
> +
> +   TP_FIELDS(
> +   ctf_integer(u64, bytenr, head_ref->bytenr)
> +   ctf_integer(u64, num_bytes, head_ref->num_bytes)
> +   

Re: [lttng-dev] [PATCH lttng-modules v2] Fix: btrfs_delayed_ref_head was unwired since v3.12

2018-01-09 Thread Mathieu Desnoyers
merged into master, 2.10, 2.9, thanks!

Mathieu

- On Jan 9, 2018, at 5:40 PM, Michael Jeanson mjean...@efficios.com wrote:

> See upstream commit:
> 
>  commit 599c75ec3f7f3b606e8a0a684c00f12190712de8
>  Author: Liu Bo 
>  Date:   Tue Jul 16 19:03:36 2013 +0800
> 
>Btrfs/tracepoint: update delayed ref tracepoints
> 
>This shows exactly how btrfs processes the delayed refs onto disks,
>which is very helpful on understanding delayed ref mechanism and
>debugging related bugs.
> 
> Signed-off-by: Michael Jeanson 
> ---
> instrumentation/events/lttng-module/btrfs.h | 132 +++-
> 1 file changed, 130 insertions(+), 2 deletions(-)
> 
> diff --git a/instrumentation/events/lttng-module/btrfs.h
> b/instrumentation/events/lttng-module/btrfs.h
> index b529e8e..e7b4b0c 100644
> --- a/instrumentation/events/lttng-module/btrfs.h
> +++ b/instrumentation/events/lttng-module/btrfs.h
> @@ -680,8 +680,81 @@ LTTNG_TRACEPOINT_EVENT(btrfs_delayed_data_ref,
>   )
> )
> 
> -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0))
> -LTTNG_TRACEPOINT_EVENT(btrfs_delayed_ref_head,
> +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0))
> +LTTNG_TRACEPOINT_EVENT_CLASS(btrfs_delayed_ref_head,
> +
> + TP_PROTO(const struct btrfs_fs_info *fs_info,
> +  const struct btrfs_delayed_ref_head *head_ref,
> +  int action),
> +
> + TP_ARGS(fs_info, head_ref, action),
> +
> + TP_FIELDS(
> + ctf_integer(u64, bytenr, head_ref->bytenr)
> + ctf_integer(u64, num_bytes, head_ref->num_bytes)
> + ctf_integer(int, action, action)
> + ctf_integer(int, is_data, head_ref->is_data)
> + )
> +)
> +
> +LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs_delayed_ref_head, add_delayed_ref_head,
> +
> + TP_PROTO(const struct btrfs_fs_info *fs_info,
> +  const struct btrfs_delayed_ref_head *head_ref,
> +  int action),
> +
> + TP_ARGS(fs_info, head_ref, action)
> +)
> +
> +LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs_delayed_ref_head, run_delayed_ref_head,
> +
> + TP_PROTO(const struct btrfs_fs_info *fs_info,
> +  const struct btrfs_delayed_ref_head *head_ref,
> +  int action),
> +
> + TP_ARGS(fs_info, head_ref, action)
> +)
> +
> +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
> +LTTNG_TRACEPOINT_EVENT_CLASS(btrfs_delayed_ref_head,
> +
> + TP_PROTO(const struct btrfs_fs_info *fs_info,
> +  const struct btrfs_delayed_ref_node *ref,
> +  const struct btrfs_delayed_ref_head *head_ref,
> +  int action),
> +
> + TP_ARGS(fs_info, ref, head_ref, action),
> +
> + TP_FIELDS(
> + ctf_integer(u64, bytenr, ref->bytenr)
> + ctf_integer(u64, num_bytes, ref->num_bytes)
> + ctf_integer(int, action, action)
> + ctf_integer(int, is_data, head_ref->is_data)
> + )
> +)
> +
> +LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs_delayed_ref_head, add_delayed_ref_head,
> +
> + TP_PROTO(const struct btrfs_fs_info *fs_info,
> +  const struct btrfs_delayed_ref_node *ref,
> +  const struct btrfs_delayed_ref_head *head_ref,
> +  int action),
> +
> + TP_ARGS(fs_info, ref, head_ref, action)
> +)
> +
> +LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs_delayed_ref_head, run_delayed_ref_head,
> +
> + TP_PROTO(const struct btrfs_fs_info *fs_info,
> +  const struct btrfs_delayed_ref_node *ref,
> +  const struct btrfs_delayed_ref_head *head_ref,
> +  int action),
> +
> + TP_ARGS(fs_info, ref, head_ref, action)
> +)
> +
> +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0))
> +LTTNG_TRACEPOINT_EVENT_CLASS(btrfs_delayed_ref_head,
> 
>   TP_PROTO(struct btrfs_fs_info *fs_info,
>struct btrfs_delayed_ref_node *ref,
> @@ -698,6 +771,61 @@ LTTNG_TRACEPOINT_EVENT(btrfs_delayed_ref_head,
>   )
> )
> 
> +LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs_delayed_ref_head, add_delayed_ref_head,
> +
> + TP_PROTO(struct btrfs_fs_info *fs_info,
> +  struct btrfs_delayed_ref_node *ref,
> +  struct btrfs_delayed_ref_head *head_ref,
> +  int action),
> +
> + TP_ARGS(fs_info, ref, head_ref, action)
> +)
> +
> +LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs_delayed_ref_head, run_delayed_ref_head,
> +
> + TP_PROTO(struct btrfs_fs_info *fs_info,
> +  struct btrfs_delayed_ref_node *ref,
> +  struct btrfs_delayed_ref_head *head_ref,
> +  int action),
> +
> + TP_ARGS(fs_info, ref, head_ref, action)
> +)
> +
> +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
> +LTTNG_TRACEPOINT_EVENT_CLASS(btrfs_delayed_ref_head,
> +
> + TP_PROTO(struct btrfs_delayed_ref_node *ref,
> +  struct btrfs_delayed_ref_head *head_ref,
> +  int action),
> +
> + TP_ARGS(ref, head_ref, action),
> +
> + TP_FIELDS(
> + ctf_integer(u64, 

[lttng-dev] [PATCH lttng-modules v2] Fix: btrfs_delayed_ref_head was unwired since v3.12

2018-01-09 Thread Michael Jeanson
See upstream commit:

  commit 599c75ec3f7f3b606e8a0a684c00f12190712de8
  Author: Liu Bo 
  Date:   Tue Jul 16 19:03:36 2013 +0800

Btrfs/tracepoint: update delayed ref tracepoints

This shows exactly how btrfs processes the delayed refs onto disks,
which is very helpful on understanding delayed ref mechanism and
debugging related bugs.

Signed-off-by: Michael Jeanson 
---
 instrumentation/events/lttng-module/btrfs.h | 132 +++-
 1 file changed, 130 insertions(+), 2 deletions(-)

diff --git a/instrumentation/events/lttng-module/btrfs.h 
b/instrumentation/events/lttng-module/btrfs.h
index b529e8e..e7b4b0c 100644
--- a/instrumentation/events/lttng-module/btrfs.h
+++ b/instrumentation/events/lttng-module/btrfs.h
@@ -680,8 +680,81 @@ LTTNG_TRACEPOINT_EVENT(btrfs_delayed_data_ref,
)
 )
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0))
-LTTNG_TRACEPOINT_EVENT(btrfs_delayed_ref_head,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0))
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs_delayed_ref_head,
+
+   TP_PROTO(const struct btrfs_fs_info *fs_info,
+const struct btrfs_delayed_ref_head *head_ref,
+int action),
+
+   TP_ARGS(fs_info, head_ref, action),
+
+   TP_FIELDS(
+   ctf_integer(u64, bytenr, head_ref->bytenr)
+   ctf_integer(u64, num_bytes, head_ref->num_bytes)
+   ctf_integer(int, action, action)
+   ctf_integer(int, is_data, head_ref->is_data)
+   )
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs_delayed_ref_head, add_delayed_ref_head,
+
+   TP_PROTO(const struct btrfs_fs_info *fs_info,
+const struct btrfs_delayed_ref_head *head_ref,
+int action),
+
+   TP_ARGS(fs_info, head_ref, action)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs_delayed_ref_head, run_delayed_ref_head,
+
+   TP_PROTO(const struct btrfs_fs_info *fs_info,
+const struct btrfs_delayed_ref_head *head_ref,
+int action),
+
+   TP_ARGS(fs_info, head_ref, action)
+)
+
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs_delayed_ref_head,
+
+   TP_PROTO(const struct btrfs_fs_info *fs_info,
+const struct btrfs_delayed_ref_node *ref,
+const struct btrfs_delayed_ref_head *head_ref,
+int action),
+
+   TP_ARGS(fs_info, ref, head_ref, action),
+
+   TP_FIELDS(
+   ctf_integer(u64, bytenr, ref->bytenr)
+   ctf_integer(u64, num_bytes, ref->num_bytes)
+   ctf_integer(int, action, action)
+   ctf_integer(int, is_data, head_ref->is_data)
+   )
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs_delayed_ref_head, add_delayed_ref_head,
+
+   TP_PROTO(const struct btrfs_fs_info *fs_info,
+const struct btrfs_delayed_ref_node *ref,
+const struct btrfs_delayed_ref_head *head_ref,
+int action),
+
+   TP_ARGS(fs_info, ref, head_ref, action)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs_delayed_ref_head, run_delayed_ref_head,
+
+   TP_PROTO(const struct btrfs_fs_info *fs_info,
+const struct btrfs_delayed_ref_node *ref,
+const struct btrfs_delayed_ref_head *head_ref,
+int action),
+
+   TP_ARGS(fs_info, ref, head_ref, action)
+)
+
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0))
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs_delayed_ref_head,
 
TP_PROTO(struct btrfs_fs_info *fs_info,
 struct btrfs_delayed_ref_node *ref,
@@ -698,6 +771,61 @@ LTTNG_TRACEPOINT_EVENT(btrfs_delayed_ref_head,
)
 )
 
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs_delayed_ref_head, add_delayed_ref_head,
+
+   TP_PROTO(struct btrfs_fs_info *fs_info,
+struct btrfs_delayed_ref_node *ref,
+struct btrfs_delayed_ref_head *head_ref,
+int action),
+
+   TP_ARGS(fs_info, ref, head_ref, action)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs_delayed_ref_head, run_delayed_ref_head,
+
+   TP_PROTO(struct btrfs_fs_info *fs_info,
+struct btrfs_delayed_ref_node *ref,
+struct btrfs_delayed_ref_head *head_ref,
+int action),
+
+   TP_ARGS(fs_info, ref, head_ref, action)
+)
+
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs_delayed_ref_head,
+
+   TP_PROTO(struct btrfs_delayed_ref_node *ref,
+struct btrfs_delayed_ref_head *head_ref,
+int action),
+
+   TP_ARGS(ref, head_ref, action),
+
+   TP_FIELDS(
+   ctf_integer(u64, bytenr, ref->bytenr)
+   ctf_integer(u64, num_bytes, ref->num_bytes)
+   ctf_integer(int, action, action)
+   ctf_integer(int, is_data, head_ref->is_data)
+   )
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs_delayed_ref_head, 

Re: [lttng-dev] [PATCH babeltrace] Fix: lttng-live discarded event count after inactivity

2018-01-09 Thread Mathieu Desnoyers
- On Jan 9, 2018, at 5:12 PM, Julien Desfossez jdesfos...@efficios.com 
wrote:

> When a stream is inactive, the consumer produces fake indexes which are
> beacons to let the viewer know a stream has not produced any data up to
> a certain timestamp. These beacon are actually real packet indexes with
> all the fields set to 0 except for the timestamp_end. Currently we keep
> these beacons just like we keep real indexes. The problem is that when
> we switch packet, we compare the events_discarded field in the index we
> just received with the same field in the previous index. In the case
> where a stream has been inactive, we have received inactivity beacons,
> and set the discarded_event field to 0, so the difference with the next
> real index might be wrong.
> 
> In fact, since the inactivity beacons are only used to push the
> timestamp end of a stream, we don't need to keep them and we actually
> need to keep most of the data from the real previous index. So we now
> copy the entire prev_index into the cur_index when we receive an
> inactivity beacon. We could refactor the code to avoid performing the
> pointer swap of cur and prev indexes, but this implies a redesign of
> much of the packet switching code which would affect other code paths.
> 
> Signed-off-by: Julien Desfossez 

Acked-by: Mathieu Desnoyers 

> ---
> formats/lttng-live/lttng-live-comm.c | 16 
> 1 file changed, 16 insertions(+)
> 
> diff --git a/formats/lttng-live/lttng-live-comm.c
> b/formats/lttng-live/lttng-live-comm.c
> index 77bf34a..3ffa257 100644
> --- a/formats/lttng-live/lttng-live-comm.c
> +++ b/formats/lttng-live/lttng-live-comm.c
> @@ -1275,6 +1275,7 @@ retry:
>   pos->offset = 0;
>   }
> 
> + /* Beacon packet index */
>   if (cur_index->content_size == 0) {
>   if (file_stream->parent.stream_class) {
>   file_stream->parent.cycles_timestamp =
> @@ -1282,8 +1283,23 @@ retry:
>   file_stream->parent.real_timestamp = 
> ctf_get_real_timestamp(
>   _stream->parent,
>   cur_index->ts_cycles.timestamp_end);
> +
> + /*
> +  * Duplicate the data from the previous index, because
> +  * the one we just received is only a beacon with no
> +  * relevant information except the timestamp_end. We
> +  * don't need to keep this timestamp_end because we 
> already
> +  * updated the file_stream timestamps, so we only need
> +  * to keep the last real index data as prev_index. That
> +  * way, we keep the original prev timestamps and
> +  * discarded events counter. This is the same behaviour
> +  * as if we were reading a local trace, we would not
> +  * have fake indexes between real indexes.
> +  */
> + memcpy(cur_index, prev_index, sizeof(struct 
> packet_index));
>   }
>   } else {
> + /* Real packet index */
>   if (file_stream->parent.stream_class) {
>   /* Convert the timestamps and append to the real_index. 
> */
>   cur_index->ts_real.timestamp_begin = 
> ctf_get_real_timestamp(
> --
> 2.7.4
> 
> ___
> lttng-dev mailing list
> lttng-dev@lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
___
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


Re: [lttng-dev] LD_PRELOAD applications using lttng-ust-pthread

2018-01-09 Thread Majid Rezazadeh
Thanks for your response

I reran my test in gdb and got the following information:

(gdb) run
Starting program: /usr/bin/env LD_PRELOAD=test.so firefox
process 5288 is executing new program: /bin/dash
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x77de73a8 in ?? () from /lib64/ld-linux-x86-64.so.2

Does it provide enough information?

Thanks

On Tue, Jan 9, 2018 at 10:43 AM, Jonathan Rajotte-Julien <
jonathan.rajotte-jul...@efficios.com> wrote:

> Hi,
>
> On Mon, Jan 08, 2018 at 10:35:39PM -0500, Majid Rezazadeh wrote:
> > Hi all
> >
> > I am using lttng-ust-libc-wrapper for instrumenting some calls to libc
> for
> > some applications like Firefox and Chrome, but I receive "Segmentation
> > fault (core dumped)". I compile lttng-ust-pthread.c (gcc -fPIC -shared
> -o
> > test.so lttng-ust-pthread.c -ldl) and then I use "LD_PRELOAD=test.so
> > firefox" but I receive segmentation fault (I have exported
> LD_LIBRARY_PATH
> > to the absolute path of test.so file). I found out that when I replace
>
> Could you give us more information regarding the coredump?
>
> "thread apply all bt" in gdb with the corefile loaded.
>
> Make sure to compile with debug symbol and rerun your test.
>
> > tracepoints with printf in lttng_ust_pthread.c, I receive no error. It
> > seems that hooking tracepoints in this wrapper makes some problems. Do
> you
> > have any idea in this regard?
> >
> > Thanks
> >
> > Majid
>
> > ___
> > lttng-dev mailing list
> > lttng-dev@lists.lttng.org
> > https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
>
>
> --
> Jonathan Rajotte-Julien
> EfficiOS
>
___
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


Re: [lttng-dev] [PATCH babeltrace] Fix: lttng-live discarded event count after inactivity

2018-01-09 Thread Jonathan Rajotte-Julien
On Tue, Jan 09, 2018 at 05:12:54PM -0500, Julien Desfossez wrote:
> When a stream is inactive, the consumer produces fake indexes which are
> beacons to let the viewer know a stream has not produced any data up to
> a certain timestamp. These beacon are actually real packet indexes with
> all the fields set to 0 except for the timestamp_end. Currently we keep
> these beacons just like we keep real indexes. The problem is that when
> we switch packet, we compare the events_discarded field in the index we
> just received with the same field in the previous index. In the case
> where a stream has been inactive, we have received inactivity beacons,
> and set the discarded_event field to 0, so the difference with the next
> real index might be wrong.
> 
> In fact, since the inactivity beacons are only used to push the
> timestamp end of a stream, we don't need to keep them and we actually
> need to keep most of the data from the real previous index. So we now
> copy the entire prev_index into the cur_index when we receive an
> inactivity beacon. We could refactor the code to avoid performing the
> pointer swap of cur and prev indexes, but this implies a redesign of
> much of the packet switching code which would affect other code paths.
> 

Tested-by: Jonathan Rajotte-Julien 

> Signed-off-by: Julien Desfossez 
> ---
>  formats/lttng-live/lttng-live-comm.c | 16 
>  1 file changed, 16 insertions(+)
> 
> diff --git a/formats/lttng-live/lttng-live-comm.c 
> b/formats/lttng-live/lttng-live-comm.c
> index 77bf34a..3ffa257 100644
> --- a/formats/lttng-live/lttng-live-comm.c
> +++ b/formats/lttng-live/lttng-live-comm.c
> @@ -1275,6 +1275,7 @@ retry:
>   pos->offset = 0;
>   }
>  
> + /* Beacon packet index */
>   if (cur_index->content_size == 0) {
>   if (file_stream->parent.stream_class) {
>   file_stream->parent.cycles_timestamp =
> @@ -1282,8 +1283,23 @@ retry:
>   file_stream->parent.real_timestamp = 
> ctf_get_real_timestamp(
>   _stream->parent,
>   cur_index->ts_cycles.timestamp_end);
> +
> + /*
> +  * Duplicate the data from the previous index, because
> +  * the one we just received is only a beacon with no
> +  * relevant information except the timestamp_end. We
> +  * don't need to keep this timestamp_end because we 
> already
> +  * updated the file_stream timestamps, so we only need
> +  * to keep the last real index data as prev_index. That
> +  * way, we keep the original prev timestamps and
> +  * discarded events counter. This is the same behaviour
> +  * as if we were reading a local trace, we would not
> +  * have fake indexes between real indexes.
> +  */
> + memcpy(cur_index, prev_index, sizeof(struct 
> packet_index));
>   }
>   } else {
> + /* Real packet index */
>   if (file_stream->parent.stream_class) {
>   /* Convert the timestamps and append to the real_index. 
> */
>   cur_index->ts_real.timestamp_begin = 
> ctf_get_real_timestamp(
> -- 
> 2.7.4
> 

-- 
Jonathan Rajotte-Julien
EfficiOS
___
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


[lttng-dev] [PATCH babeltrace] Fix: lttng-live discarded event count after inactivity

2018-01-09 Thread Julien Desfossez
When a stream is inactive, the consumer produces fake indexes which are
beacons to let the viewer know a stream has not produced any data up to
a certain timestamp. These beacon are actually real packet indexes with
all the fields set to 0 except for the timestamp_end. Currently we keep
these beacons just like we keep real indexes. The problem is that when
we switch packet, we compare the events_discarded field in the index we
just received with the same field in the previous index. In the case
where a stream has been inactive, we have received inactivity beacons,
and set the discarded_event field to 0, so the difference with the next
real index might be wrong.

In fact, since the inactivity beacons are only used to push the
timestamp end of a stream, we don't need to keep them and we actually
need to keep most of the data from the real previous index. So we now
copy the entire prev_index into the cur_index when we receive an
inactivity beacon. We could refactor the code to avoid performing the
pointer swap of cur and prev indexes, but this implies a redesign of
much of the packet switching code which would affect other code paths.

Signed-off-by: Julien Desfossez 
---
 formats/lttng-live/lttng-live-comm.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/formats/lttng-live/lttng-live-comm.c 
b/formats/lttng-live/lttng-live-comm.c
index 77bf34a..3ffa257 100644
--- a/formats/lttng-live/lttng-live-comm.c
+++ b/formats/lttng-live/lttng-live-comm.c
@@ -1275,6 +1275,7 @@ retry:
pos->offset = 0;
}
 
+   /* Beacon packet index */
if (cur_index->content_size == 0) {
if (file_stream->parent.stream_class) {
file_stream->parent.cycles_timestamp =
@@ -1282,8 +1283,23 @@ retry:
file_stream->parent.real_timestamp = 
ctf_get_real_timestamp(
_stream->parent,
cur_index->ts_cycles.timestamp_end);
+
+   /*
+* Duplicate the data from the previous index, because
+* the one we just received is only a beacon with no
+* relevant information except the timestamp_end. We
+* don't need to keep this timestamp_end because we 
already
+* updated the file_stream timestamps, so we only need
+* to keep the last real index data as prev_index. That
+* way, we keep the original prev timestamps and
+* discarded events counter. This is the same behaviour
+* as if we were reading a local trace, we would not
+* have fake indexes between real indexes.
+*/
+   memcpy(cur_index, prev_index, sizeof(struct 
packet_index));
}
} else {
+   /* Real packet index */
if (file_stream->parent.stream_class) {
/* Convert the timestamps and append to the real_index. 
*/
cur_index->ts_real.timestamp_begin = 
ctf_get_real_timestamp(
-- 
2.7.4

___
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


[lttng-dev] [PATCH lttng-modules] Fix: btrfs_delayed_ref_head was unwired since v3.12

2018-01-09 Thread Michael Jeanson
See upstream commit:

  commit 599c75ec3f7f3b606e8a0a684c00f12190712de8
  Author: Liu Bo 
  Date:   Tue Jul 16 19:03:36 2013 +0800

Btrfs/tracepoint: update delayed ref tracepoints

This shows exactly how btrfs processes the delayed refs onto disks,
which is very helpful on understanding delayed ref mechanism and
debugging related bugs.

Signed-off-by: Michael Jeanson 
---
 instrumentation/events/lttng-module/btrfs.h | 114 +++-
 1 file changed, 112 insertions(+), 2 deletions(-)

diff --git a/instrumentation/events/lttng-module/btrfs.h 
b/instrumentation/events/lttng-module/btrfs.h
index b529e8e..ac202ff 100644
--- a/instrumentation/events/lttng-module/btrfs.h
+++ b/instrumentation/events/lttng-module/btrfs.h
@@ -680,8 +680,81 @@ LTTNG_TRACEPOINT_EVENT(btrfs_delayed_data_ref,
)
 )
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0))
-LTTNG_TRACEPOINT_EVENT(btrfs_delayed_ref_head,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0))
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs_delayed_ref_head,
+
+   TP_PROTO(const struct btrfs_fs_info *fs_info,
+const struct btrfs_delayed_ref_head *head_ref,
+int action),
+
+   TP_ARGS(fs_info, head_ref, action),
+
+   TP_FIELDS(
+   ctf_integer(u64, bytenr, head_ref->bytenr)
+   ctf_integer(u64, num_bytes, head_ref->num_bytes)
+   ctf_integer(int, action, action)
+   ctf_integer(int, is_data, head_ref->is_data)
+   )
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs_delayed_ref_head, add_delayed_ref_head,
+
+   TP_PROTO(const struct btrfs_fs_info *fs_info,
+const struct btrfs_delayed_ref_head *head_ref,
+int action),
+
+   TP_ARGS(fs_info, head_ref, action)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs_delayed_ref_head, run_delayed_ref_head,
+
+   TP_PROTO(const struct btrfs_fs_info *fs_info,
+const struct btrfs_delayed_ref_head *head_ref,
+int action),
+
+   TP_ARGS(fs_info, head_ref, action)
+)
+
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs_delayed_ref_head,
+
+   TP_PROTO(const struct btrfs_fs_info *fs_info,
+const struct btrfs_delayed_ref_node *ref,
+const struct btrfs_delayed_ref_head *head_ref,
+int action),
+
+   TP_ARGS(fs_info, ref, head_ref, action),
+
+   TP_FIELDS(
+   ctf_integer(u64, bytenr, ref->bytenr)
+   ctf_integer(u64, num_bytes, ref->num_bytes)
+   ctf_integer(int, action, action)
+   ctf_integer(int, is_data, head_ref->is_data)
+   )
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs_delayed_ref_head, add_delayed_ref_head,
+
+   TP_PROTO(const struct btrfs_fs_info *fs_info,
+const struct btrfs_delayed_ref_node *ref,
+const struct btrfs_delayed_ref_head *head_ref,
+int action),
+
+   TP_ARGS(fs_info, ref, head_ref, action)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs_delayed_ref_head, run_delayed_ref_head,
+
+   TP_PROTO(const struct btrfs_fs_info *fs_info,
+const struct btrfs_delayed_ref_node *ref,
+const struct btrfs_delayed_ref_head *head_ref,
+int action),
+
+   TP_ARGS(fs_info, ref, head_ref, action)
+)
+
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0))
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs_delayed_ref_head,
 
TP_PROTO(struct btrfs_fs_info *fs_info,
 struct btrfs_delayed_ref_node *ref,
@@ -698,6 +771,43 @@ LTTNG_TRACEPOINT_EVENT(btrfs_delayed_ref_head,
)
 )
 
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs_delayed_ref_head, add_delayed_ref_head,
+
+   TP_PROTO(struct btrfs_fs_info *fs_info,
+struct btrfs_delayed_ref_node *ref,
+struct btrfs_delayed_ref_head *head_ref,
+int action),
+
+   TP_ARGS(fs_info, ref, head_ref, action)
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs_delayed_ref_head, run_delayed_ref_head,
+
+   TP_PROTO(struct btrfs_fs_info *fs_info,
+struct btrfs_delayed_ref_node *ref,
+struct btrfs_delayed_ref_head *head_ref,
+int action),
+
+   TP_ARGS(fs_info, ref, head_ref, action)
+)
+
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
+LTTNG_TRACEPOINT_EVENT(btrfs_delayed_ref_head,
+
+   TP_PROTO(struct btrfs_delayed_ref_node *ref,
+struct btrfs_delayed_ref_head *head_ref,
+int action),
+
+   TP_ARGS(ref, head_ref, action),
+
+   TP_FIELDS(
+   ctf_integer(u64, bytenr, ref->bytenr)
+   ctf_integer(u64, num_bytes, ref->num_bytes)
+   ctf_integer(int, action, action)
+   ctf_integer(int, is_data, head_ref->is_data)
+   )
+)
+
 #else
 LTTNG_TRACEPOINT_EVENT(btrfs_delayed_ref_head,
 
-- 
2.7.4


Re: [lttng-dev] [PATCH lttng-modules 1/3] Fix: debian kernel version parsing

2018-01-09 Thread Mathieu Desnoyers
Merged patches 1 and 2 into master, 2.10, 2.9.

Patch 3 needs work, as detailed in a separate email.

Thanks,

Mathieu

- On Jan 9, 2018, at 3:43 PM, Michael Jeanson mjean...@efficios.com wrote:

> The debian version script only worked for ckt kernels and that was fine
> until now because we only had checks for those versions in the code.
> 
> ckt (Canonical Kernel Team) kernels were used for a while during the jessie
> cycle, their versionning is a bit different. They track the upstream vanilla
> stable updates but they don't update the minor version number and instead add
> an additionnal -cktX. They were all 3.16.7-cktX and after a while the version
> switched back to upstream style at 3.16.36.
> 
> Knowing that, we can compare regular debian and ckt kernel versions
> using this scheme :
> 
>  MAJOR.PATCHLEVEL.SUBLEVEL.CKT.DEBABI.DEBPATCH
> 
> And setting CKT to zero for non-ckt kernels.
> 
> Signed-off-by: Michael Jeanson 
> ---
> abi-debian-version.sh | 18 ++
> 1 file changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/abi-debian-version.sh b/abi-debian-version.sh
> index 310d6a8..36da212 100755
> --- a/abi-debian-version.sh
> +++ b/abi-debian-version.sh
> @@ -12,24 +12,26 @@ fi
> 
> # Assuming KPATH is the target kernel headers directory
> DEB_PACKAGE_VERSION=$(sed -rn 's/^#define LINUX_PACKAGE_ID " Debian 
> (.*)"/\1/p'
> ${KPATH}/include/generated/package.h)
> +
> # Ignore backports part
> DEB_PACKAGE_VERSION=$(echo ${DEB_PACKAGE_VERSION} | sed -r 's/~(bpo|deb).*//')
> +
> +# ckt (Canonical Kernel Team) kernels were used for a while during the jessie
> +# cycle, their versionning is a bit different. They track the upstream 
> vanilla
> +# stable updates but they don't update the minor version number and instead 
> add
> +# an additionnal -cktX. They were all 3.16.7-cktX and after a while the 
> version
> +# switched back to upstream style at 3.16.36.
> +
> # Get -ckt update number, if present
> KERNEL_CKT_UPDATE=$(echo ${DEB_PACKAGE_VERSION} | sed -rn
> 's/^[0-9]+\.[0-9]+\.[0-9]+-ckt([0-9]+).*/\1/p')
> -
> -# Only care about the rest if it is a -ckt kernel, making sure we do not
> -# clash with older Debian kernels (e.g. Debian 3.2.65-1+deb7u2).
> -if [ -z "${KERNEL_CKT_UPDATE}" ]; then
> - echo 0
> - exit 0
> -fi
> +test -n "${KERNEL_CKT_UPDATE}" || KERNEL_CKT_UPDATE=0
> 
> # Get package revision
> DEB_PACKAGE_REVISION=$(echo ${DEB_PACKAGE_VERSION} | sed -r 
> 's/.*-([^-]+)$/\1/')
> # Get non-sec update number
> DEB_PACKAGE_REVISION_BASE=$(echo ${DEB_PACKAGE_REVISION} | sed -r
> 's/^([0-9]+).*/\1/')
> # Get security update number, if present
> -DEB_PACKAGE_REVISION_SECURITY=$(echo ${DEB_PACKAGE_REVISION} | sed -rn
> 's/.*\+(squeeze|deb[0-9])+u([0-9]+)$/\1/p')
> +DEB_PACKAGE_REVISION_SECURITY=$(echo ${DEB_PACKAGE_REVISION} | sed -rn
> 's/.*\+(squeeze|deb[0-9]+)+u([0-9]+)$/\2/p')
> test -n "${DEB_PACKAGE_REVISION_SECURITY}" || DEB_PACKAGE_REVISION_SECURITY=0
> # Combine all update numbers into one
> DEB_API_VERSION=$((KERNEL_CKT_UPDATE * 1 + DEB_PACKAGE_REVISION_BASE * 
> 100 +
> DEB_PACKAGE_REVISION_SECURITY))
> --
> 2.7.4

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
___
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


Re: [lttng-dev] [PATCH lttng-modules 3/3] Fix: Update btrfs instrumentation for v4.15

2018-01-09 Thread Mathieu Desnoyers
- On Jan 9, 2018, at 3:43 PM, Michael Jeanson mjean...@efficios.com wrote:

> See upstream commit:
> 
>  commit d278850eff3053ef166cf64c16f798dfe36278a2
>  Author: Josef Bacik 
>  Date:   Fri Sep 29 15:43:57 2017 -0400
> 
>btrfs: remove delayed_ref_node from ref_head
> 
>This is just excessive information in the ref_head, and makes the code
>complicated.  It is a relic from when we had the heads and the refs in
>the same tree, which is no longer the case.  With this removal I've
>cleaned up a bunch of the cruft around this old assumption as well.

In 3.12, this becomes a DECLARE_EVENT_CLASS with associated DEFINE_EVENT
using the class. Example code snippet from a 4.15-rc kernel:

DECLARE_EVENT_CLASS(btrfs_delayed_ref_head,

TP_PROTO(const struct btrfs_fs_info *fs_info,
 const struct btrfs_delayed_ref_head *head_ref,
 int action),

TP_ARGS(fs_info, head_ref, action),

TP_STRUCT__entry_btrfs(
__field(u64,  bytenr)
__field(u64,  num_bytes )
__field(int,  action)
__field(int,  is_data   )
),

TP_fast_assign_btrfs(fs_info,
__entry->bytenr = head_ref->bytenr;
__entry->num_bytes  = head_ref->num_bytes;
__entry->action = action;
__entry->is_data= head_ref->is_data;
),

TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s is_data=%d",
  (unsigned long long)__entry->bytenr,
  (unsigned long long)__entry->num_bytes,
  show_ref_action(__entry->action),
  __entry->is_data)
);

DEFINE_EVENT(btrfs_delayed_ref_head,  add_delayed_ref_head,

TP_PROTO(const struct btrfs_fs_info *fs_info,
 const struct btrfs_delayed_ref_head *head_ref,
 int action),

TP_ARGS(fs_info, head_ref, action)
);

DEFINE_EVENT(btrfs_delayed_ref_head,  run_delayed_ref_head,

TP_PROTO(const struct btrfs_fs_info *fs_info,
 const struct btrfs_delayed_ref_head *head_ref,
 int action),

TP_ARGS(fs_info, head_ref, action)
);

It appears that this instrumentation has not been hooked on any actual
tracepoint for quite some time in lttng-modules.

We should adapt the lttng-modules instrumentation accordingly. I would
not be surprised that the 4.8.0 kernel version range is also incorrect:
it should apply to the "new" events based on the tracepoint class.

Thanks,

Mathieu

> 
> Signed-off-by: Michael Jeanson 
> ---
> instrumentation/events/lttng-module/btrfs.h | 18 +-
> 1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/instrumentation/events/lttng-module/btrfs.h
> b/instrumentation/events/lttng-module/btrfs.h
> index b529e8e..7901f05 100644
> --- a/instrumentation/events/lttng-module/btrfs.h
> +++ b/instrumentation/events/lttng-module/btrfs.h
> @@ -680,7 +680,23 @@ LTTNG_TRACEPOINT_EVENT(btrfs_delayed_data_ref,
>   )
> )
> 
> -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0))
> +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0))
> +LTTNG_TRACEPOINT_EVENT(btrfs_delayed_ref_head,
> +
> + TP_PROTO(struct btrfs_fs_info *fs_info,
> +  struct btrfs_delayed_ref_head *head_ref,
> +  int action),
> +
> + TP_ARGS(fs_info, head_ref, action),
> +
> + TP_FIELDS(
> + ctf_integer(u64, bytenr, head_ref->bytenr)
> + ctf_integer(u64, num_bytes, head_ref->num_bytes)
> + ctf_integer(int, action, action)
> + ctf_integer(int, is_data, head_ref->is_data)
> + )
> +)
> +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0))
> LTTNG_TRACEPOINT_EVENT(btrfs_delayed_ref_head,
> 
>   TP_PROTO(struct btrfs_fs_info *fs_info,
> --
> 2.7.4

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
___
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


[lttng-dev] [PATCH lttng-modules 2/3] Update kvm instrumentation for debian kernel 4.9.65-3

2018-01-09 Thread Michael Jeanson
Signed-off-by: Michael Jeanson 
---
 instrumentation/events/lttng-module/kvm.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/instrumentation/events/lttng-module/kvm.h 
b/instrumentation/events/lttng-module/kvm.h
index ea63e88..d9d0300 100644
--- a/instrumentation/events/lttng-module/kvm.h
+++ b/instrumentation/events/lttng-module/kvm.h
@@ -86,7 +86,8 @@ LTTNG_TRACEPOINT_EVENT(kvm_ack_irq,
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0) \
|| LTTNG_KERNEL_RANGE(3,16,52, 3,17,0) \
-   || LTTNG_KERNEL_RANGE(3,2,97, 3,3,0))
+   || LTTNG_KERNEL_RANGE(3,2,97, 3,3,0) \
+   || LTTNG_DEBIAN_KERNEL_RANGE(4,9,65,0,3,0, 4,10,0,0,0,0))
 
 LTTNG_TRACEPOINT_EVENT(kvm_mmio,
TP_PROTO(int type, int len, u64 gpa, void *val),
-- 
2.7.4

___
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


[lttng-dev] [PATCH lttng-modules 1/3] Fix: debian kernel version parsing

2018-01-09 Thread Michael Jeanson
The debian version script only worked for ckt kernels and that was fine
until now because we only had checks for those versions in the code.

ckt (Canonical Kernel Team) kernels were used for a while during the jessie
cycle, their versionning is a bit different. They track the upstream vanilla
stable updates but they don't update the minor version number and instead add
an additionnal -cktX. They were all 3.16.7-cktX and after a while the version
switched back to upstream style at 3.16.36.

Knowing that, we can compare regular debian and ckt kernel versions
using this scheme :

  MAJOR.PATCHLEVEL.SUBLEVEL.CKT.DEBABI.DEBPATCH

And setting CKT to zero for non-ckt kernels.

Signed-off-by: Michael Jeanson 
---
 abi-debian-version.sh | 18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/abi-debian-version.sh b/abi-debian-version.sh
index 310d6a8..36da212 100755
--- a/abi-debian-version.sh
+++ b/abi-debian-version.sh
@@ -12,24 +12,26 @@ fi
 
 # Assuming KPATH is the target kernel headers directory
 DEB_PACKAGE_VERSION=$(sed -rn 's/^#define LINUX_PACKAGE_ID " Debian 
(.*)"/\1/p' ${KPATH}/include/generated/package.h)
+
 # Ignore backports part
 DEB_PACKAGE_VERSION=$(echo ${DEB_PACKAGE_VERSION} | sed -r 's/~(bpo|deb).*//')
+
+# ckt (Canonical Kernel Team) kernels were used for a while during the jessie
+# cycle, their versionning is a bit different. They track the upstream vanilla
+# stable updates but they don't update the minor version number and instead add
+# an additionnal -cktX. They were all 3.16.7-cktX and after a while the version
+# switched back to upstream style at 3.16.36.
+
 # Get -ckt update number, if present
 KERNEL_CKT_UPDATE=$(echo ${DEB_PACKAGE_VERSION} | sed -rn 
's/^[0-9]+\.[0-9]+\.[0-9]+-ckt([0-9]+).*/\1/p')
-
-# Only care about the rest if it is a -ckt kernel, making sure we do not
-# clash with older Debian kernels (e.g. Debian 3.2.65-1+deb7u2).
-if [ -z "${KERNEL_CKT_UPDATE}" ]; then
-   echo 0
-   exit 0
-fi
+test -n "${KERNEL_CKT_UPDATE}" || KERNEL_CKT_UPDATE=0
 
 # Get package revision
 DEB_PACKAGE_REVISION=$(echo ${DEB_PACKAGE_VERSION} | sed -r 
's/.*-([^-]+)$/\1/')
 # Get non-sec update number
 DEB_PACKAGE_REVISION_BASE=$(echo ${DEB_PACKAGE_REVISION} | sed -r 
's/^([0-9]+).*/\1/')
 # Get security update number, if present
-DEB_PACKAGE_REVISION_SECURITY=$(echo ${DEB_PACKAGE_REVISION} | sed -rn 
's/.*\+(squeeze|deb[0-9])+u([0-9]+)$/\1/p')
+DEB_PACKAGE_REVISION_SECURITY=$(echo ${DEB_PACKAGE_REVISION} | sed -rn 
's/.*\+(squeeze|deb[0-9]+)+u([0-9]+)$/\2/p')
 test -n "${DEB_PACKAGE_REVISION_SECURITY}" || DEB_PACKAGE_REVISION_SECURITY=0
 # Combine all update numbers into one
 DEB_API_VERSION=$((KERNEL_CKT_UPDATE * 1 + DEB_PACKAGE_REVISION_BASE * 100 
+ DEB_PACKAGE_REVISION_SECURITY))
-- 
2.7.4

___
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


[lttng-dev] [PATCH lttng-modules 3/3] Fix: Update btrfs instrumentation for v4.15

2018-01-09 Thread Michael Jeanson
See upstream commit:

  commit d278850eff3053ef166cf64c16f798dfe36278a2
  Author: Josef Bacik 
  Date:   Fri Sep 29 15:43:57 2017 -0400

btrfs: remove delayed_ref_node from ref_head

This is just excessive information in the ref_head, and makes the code
complicated.  It is a relic from when we had the heads and the refs in
the same tree, which is no longer the case.  With this removal I've
cleaned up a bunch of the cruft around this old assumption as well.

Signed-off-by: Michael Jeanson 
---
 instrumentation/events/lttng-module/btrfs.h | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/instrumentation/events/lttng-module/btrfs.h 
b/instrumentation/events/lttng-module/btrfs.h
index b529e8e..7901f05 100644
--- a/instrumentation/events/lttng-module/btrfs.h
+++ b/instrumentation/events/lttng-module/btrfs.h
@@ -680,7 +680,23 @@ LTTNG_TRACEPOINT_EVENT(btrfs_delayed_data_ref,
)
 )
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0))
+LTTNG_TRACEPOINT_EVENT(btrfs_delayed_ref_head,
+
+   TP_PROTO(struct btrfs_fs_info *fs_info,
+struct btrfs_delayed_ref_head *head_ref,
+int action),
+
+   TP_ARGS(fs_info, head_ref, action),
+
+   TP_FIELDS(
+   ctf_integer(u64, bytenr, head_ref->bytenr)
+   ctf_integer(u64, num_bytes, head_ref->num_bytes)
+   ctf_integer(int, action, action)
+   ctf_integer(int, is_data, head_ref->is_data)
+   )
+)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0))
 LTTNG_TRACEPOINT_EVENT(btrfs_delayed_ref_head,
 
TP_PROTO(struct btrfs_fs_info *fs_info,
-- 
2.7.4

___
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


Re: [lttng-dev] LD_PRELOAD applications using lttng-ust-pthread

2018-01-09 Thread Genevieve Bastien
Hi Majid,


See the documentation here:
http://lttng.org/docs/v2.10/#doc-using-lttng-ust-with-daemons and
http://lttng.org/docs/v2.10/#doc-liblttng-ust-fd. Firefox requires at
least one of those extra libraries to be preloaded, the one for fork I
think.


I recall trying to trace firefox with lttng-cyg-profile without much
success. Without the liblttng-ust-fork.so preloaded, my tabs had
segfaults. But when I tried with both libraries, it seemed there was a
conflict between cyg-profile and the other preloaded libraries, I don't
remember exactly what happened. Maybe you won't have this problem with
lttng-ust-libc-wrapper.


I hope this helps,

Geneviève


On 2018-01-08 10:35 PM, Majid Rezazadeh wrote:
> Hi all
>
> I am using lttng-ust-libc-wrapper for instrumenting some calls to libc
> for some applications like Firefox and Chrome, but I receive
> "Segmentation fault (core dumped)". I compile lttng-ust-pthread.c (gcc
> -fPIC -shared  -o test.so lttng-ust-pthread.c -ldl) and then I use
> "LD_PRELOAD=test.so firefox" but I receive segmentation fault (I have
> exported LD_LIBRARY_PATH to the absolute path of test.so file). I
> found out that when I replace tracepoints with printf in
> lttng_ust_pthread.c, I receive no error. It seems that hooking
> tracepoints in this wrapper makes some problems. Do you have any idea
> in this regard?
>
> Thanks
>
> Majid
>
>
> ___
> lttng-dev mailing list
> lttng-dev@lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

___
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


Re: [lttng-dev] LD_PRELOAD applications using lttng-ust-pthread

2018-01-09 Thread Jonathan Rajotte-Julien
On Tue, Jan 09, 2018 at 10:43:51AM -0500, Jonathan Rajotte-Julien wrote:
> Hi,
> 
> On Mon, Jan 08, 2018 at 10:35:39PM -0500, Majid Rezazadeh wrote:
> > Hi all
> > 
> > I am using lttng-ust-libc-wrapper for instrumenting some calls to libc for
> > some applications like Firefox and Chrome, but I receive "Segmentation
> > fault (core dumped)". I compile lttng-ust-pthread.c (gcc -fPIC -shared  -o
> > test.so lttng-ust-pthread.c -ldl) and then I use "LD_PRELOAD=test.so
> > firefox" but I receive segmentation fault (I have exported LD_LIBRARY_PATH
> > to the absolute path of test.so file). I found out that when I replace
> 
> Could you give us more information regarding the coredump?
> 
> "thread apply all bt" in gdb with the corefile loaded.
> 
> Make sure to compile with debug symbol and rerun your test.

Forgot to mention that you should open a bug here:

https://bugs.lttng.org/

Make sure to read the bug reporting guidelines.

Cheers!

--
Jonathan Rajotte-Julien
EfficiOS
___
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


Re: [lttng-dev] LD_PRELOAD applications using lttng-ust-pthread

2018-01-09 Thread Jonathan Rajotte-Julien
Hi,

On Mon, Jan 08, 2018 at 10:35:39PM -0500, Majid Rezazadeh wrote:
> Hi all
> 
> I am using lttng-ust-libc-wrapper for instrumenting some calls to libc for
> some applications like Firefox and Chrome, but I receive "Segmentation
> fault (core dumped)". I compile lttng-ust-pthread.c (gcc -fPIC -shared  -o
> test.so lttng-ust-pthread.c -ldl) and then I use "LD_PRELOAD=test.so
> firefox" but I receive segmentation fault (I have exported LD_LIBRARY_PATH
> to the absolute path of test.so file). I found out that when I replace

Could you give us more information regarding the coredump?

"thread apply all bt" in gdb with the corefile loaded.

Make sure to compile with debug symbol and rerun your test.

> tracepoints with printf in lttng_ust_pthread.c, I receive no error. It
> seems that hooking tracepoints in this wrapper makes some problems. Do you
> have any idea in this regard?
> 
> Thanks
> 
> Majid

> ___
> lttng-dev mailing list
> lttng-dev@lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


-- 
Jonathan Rajotte-Julien
EfficiOS
___
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev