lttng-modules.git
8 years agoFix: bump stable kernel version ranges for clock work-around
Mathieu Desnoyers [Thu, 13 Oct 2016 13:50:21 +0000 (15:50 +0200)] 
Fix: bump stable kernel version ranges for clock work-around

Linux commit 27727df240c7 ("Avoid taking lock in NMI path with
CONFIG_DEBUG_TIMEKEEPING"), changed the logic to open-code
the timekeeping_get_ns() function, but forgot to include
the unit conversion from cycles to nanoseconds, breaking the
function's output, which impacts LTTng.

We expected Linux commit 58bfea9532 "timekeeping: Fix
__ktime_get_fast_ns() regression" to make its way into stable
kernels promptly, but it appears new stable kernel releases were
done before the fix was cherry-picked from the master branch.

We therefore need to bump the version ranges for the work-around
in lttng-modules.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
CC: John Stultz <john.stultz@linaro.org>
8 years agoVersion 2.9.0-rc1 v2.9.0-rc1
Mathieu Desnoyers [Fri, 7 Oct 2016 19:19:52 +0000 (15:19 -0400)] 
Version 2.9.0-rc1

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: i2c: support kernels < 3.15
Mathieu Desnoyers [Fri, 7 Oct 2016 14:55:16 +0000 (10:55 -0400)] 
Fix: i2c: support kernels < 3.15

i2c instrumentation has only been added in kernel 3.15.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: show warning for broken clock work-around
Mathieu Desnoyers [Thu, 6 Oct 2016 11:45:35 +0000 (07:45 -0400)] 
Fix: show warning for broken clock work-around

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoBump minor ABI version
Mathieu Desnoyers [Wed, 5 Oct 2016 16:47:58 +0000 (12:47 -0400)] 
Bump minor ABI version

Command added: LTTNG_KERNEL_SESSION_STATEDUMP

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: work-around upstream Linux timekeeping bug
Mathieu Desnoyers [Wed, 5 Oct 2016 11:20:32 +0000 (07:20 -0400)] 
Fix: work-around upstream Linux timekeeping bug

Linux commit 27727df240c7 ("Avoid taking lock in NMI path with
CONFIG_DEBUG_TIMEKEEPING"), changed the logic to open-code
the timekeeping_get_ns() function, but forgot to include
the unit conversion from cycles to nanoseconds, breaking the
function's output, which impacts LTTng.

The following kernel versions are affected: 4.8, 4.7.4+, 4.4.20+,
4.1.32+

We expect that the upstream fix will reach the master and stable
branches timely before the next releases, so we use 4.8.1, 4.7.7,
4.4.24, and 4.1.34 as upper bounds (exclusive).

Fall-back to the non-NMI-safe trace clock for those kernel versions.
We simply discard events from NMI context with a in_nmi() check,
as we did before Linux 3.17.

Link: http://lkml.kernel.org/r/1475636148-26539-1-git-send-email-john.stultz@linaro.org
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoAdd support for i2c tracepoints
Simon Marchi [Tue, 4 Oct 2016 21:07:05 +0000 (17:07 -0400)] 
Add support for i2c tracepoints

This patch teaches lttng-modules about the i2c tracepoints in the Linux
kernel.

It contains the following tracepoints:

  * i2c_write
  * i2c_read
  * i2c_reply
  * i2c_result

I translated the fields and assignments from the kernel's
include/trace/events/i2c.h as well as I could.  I also tried building
this module against a kernel without CONFIG_I2C, and it built fine (the
required types are unconditionally defined).  So I don't think any "#if
CONFIG_I2C" or similar are required.

A module parameter (extract_sensitive_payload) controls the extraction
of possibly sensitive data from events.

[ With edit by Mathieu Desnoyers. ]

Signed-off-by: Simon Marchi <simon.marchi@ericsson.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoCleanup: makefile version checks with single "ge"
Mathieu Desnoyers [Mon, 3 Oct 2016 21:35:27 +0000 (17:35 -0400)] 
Cleanup: makefile version checks with single "ge"

Version checks in makefiles should always be a disjunctive normal form
where the conjunctions consist of one or more "equals" comparisons and
at most a single greater-or-equal comparison.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoPerformance: special-case NULL in lttng_strlen_user_inatomic
Mathieu Desnoyers [Mon, 26 Sep 2016 17:37:50 +0000 (13:37 -0400)] 
Performance: special-case NULL in lttng_strlen_user_inatomic

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: lttng_inline_memcpy does not take a __user argument
Mathieu Desnoyers [Sun, 25 Sep 2016 16:30:00 +0000 (12:30 -0400)] 
Fix: lttng_inline_memcpy does not take a __user argument

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoPerformance: implement lttng_inline_memcpy
Mathieu Desnoyers [Sun, 25 Sep 2016 16:27:01 +0000 (12:27 -0400)] 
Performance: implement lttng_inline_memcpy

Because all length parameters received for serializing data coming from
applications go through a callback, they are never constant, and it
hurts performance to perform a call to memcpy each time.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoPerformance: cache the backend pages pointer in context
Mathieu Desnoyers [Sun, 25 Sep 2016 16:02:25 +0000 (12:02 -0400)] 
Performance: cache the backend pages pointer in context

Getting the backend pages pointer requires pointer chasing through the
ring buffer backend tables. Cache the current value so it can be re-used
for all backend write operations writing fields for the same event.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoCleanup: libringbuffer: remove duplicate pointer chasing in slow paths
Mathieu Desnoyers [Sun, 25 Sep 2016 15:11:48 +0000 (11:11 -0400)] 
Cleanup: libringbuffer: remove duplicate pointer chasing in slow paths

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoPerformance: Only dereference commit index once
Mathieu Desnoyers [Sun, 25 Sep 2016 15:06:10 +0000 (11:06 -0400)] 
Performance: Only dereference commit index once

The commit fast path should not dereference the commit counter index
repeatedly for performance reasons.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoPerformance: Mark channel and buffer event disabled check unlikely
Mathieu Desnoyers [Sun, 25 Sep 2016 15:01:29 +0000 (11:01 -0400)] 
Performance: Mark channel and buffer event disabled check unlikely

Channel and buffer are typically enabled when tracing, else the probes
would not be connected. Ensure the compiler optimizes for the right
usual case.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoPerformance: Relax atomicity constraints for crash handling
Mathieu Desnoyers [Sun, 25 Sep 2016 15:00:08 +0000 (11:00 -0400)] 
Performance: Relax atomicity constraints for crash handling

Use a store rather than a cmpxchg() for the update of the
sequential commit counter. This speeds up commit. The downside
is that short race windows between the if() check to see if the
counter is larger than the new value and the update could result
in the counter going backwards, in unlikely preemption or signal
delivery scenarios.

Accept that we may lose a few events in a crash dump for the
benefit of tracing speed.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoPerformance: mark ring buffer do_copy callers always inline
Mathieu Desnoyers [Sun, 25 Sep 2016 14:46:44 +0000 (10:46 -0400)] 
Performance: mark ring buffer do_copy callers always inline

The underlying copy operation is more efficient if the size is a
constant, which only happens if this function is inlined in the caller.
Otherwise, we end up calling memcpy for each field.

Force inlining for performance reasons for:
  - lib_ring_buffer_do_strcpy,
  - lib_ring_buffer_do_strcpy_from_user_inatomic,
  - lib_ring_buffer_copy_from_user_inatomic.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoPerformance: mark lib_ring_buffer_write always inline
Mathieu Desnoyers [Sun, 25 Sep 2016 14:43:22 +0000 (10:43 -0400)] 
Performance: mark lib_ring_buffer_write always inline

The underlying copy operation is more efficient if the size is a
constant, which only happens if this function is inlined in the caller.
Otherwise, we end up calling memcpy for each field.

Force inlining for performance reasons.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoKconfig: select TRACEPOINTS when built-in
Mathieu Desnoyers [Tue, 20 Sep 2016 14:29:33 +0000 (10:29 -0400)] 
Kconfig: select TRACEPOINTS when built-in

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoPerformance: disable event counting by default
Mathieu Desnoyers [Fri, 9 Sep 2016 21:01:18 +0000 (17:01 -0400)] 
Performance: disable event counting by default

Performance improvement changelog from lttng-ust, ported back to
lttng-modules:

Disable event counting in the ring buffer, which can count the number of
events produced per ring-buffer, as well as the number of events
overwritten in overwrite mode.

This feature is currently unused anyway: it is not saved in the ring
buffer header, nor made available to lttng-tools.

This saves 70 ns/event in lttng-ust on the ARM32 Cubietruck.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: handle large number of pages or subbuffers per buffer
Mathieu Desnoyers [Thu, 1 Sep 2016 22:08:15 +0000 (18:08 -0400)] 
Fix: handle large number of pages or subbuffers per buffer

Do no trigger kernel console warnings when we try to allocate too many
pages, or a too large kmalloc area for page array (within a subbuffer),
or a sub-buffer array (within a buffer).

Use vmalloc/vfree for the "pages" local variable used only during
allocation, which is an array of nr_subbuf * nr_pages_per_subbuf
pointers. This ensures we do not limit the overall buffer size due to
kmalloc limitations.

Fixes #1031

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: unregister cpu hotplug notifier on buffer alloc error
Jonathan Rajotte [Thu, 1 Sep 2016 21:52:09 +0000 (17:52 -0400)] 
Fix: unregister cpu hotplug notifier on buffer alloc error

The cpu hotplug notifier needs to be unregistered in the error path of
buffer allocation, else it eventually causes kernel OOPS when the kernel
accesses freed memory of the notifier block.

Fixes #1031

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: sa_family is of type unsigned short
Jérémie Galarneau [Wed, 31 Aug 2016 04:21:14 +0000 (00:21 -0400)] 
Fix: sa_family is of type unsigned short

sa_family is an unsigned short in sockaddr definitions. For instance,
the kernel's unix_getname() function sets addrlen to sizeof(short) as it
only returns the socket's family.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: check for sizeof sa_family to save sa_family in accept and connect
Jérémie Galarneau [Wed, 31 Aug 2016 04:18:29 +0000 (00:18 -0400)] 
Fix: check for sizeof sa_family to save sa_family in accept and connect

The check of addrlen >= sizeof(struct sockaddr) is too restrictive
and causes sa_family to not be saved in the case of AF_UNIX sockets
as the addrlen returned by the syscall may be only sizeof(short).

Individual checks per socket family are performed anyhow in the
switch case, making this safe.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: use printk_once() for wrapper warning messages
Mathieu Desnoyers [Tue, 30 Aug 2016 22:42:10 +0000 (18:42 -0400)] 
Fix: use printk_once() for wrapper warning messages

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: btrfs instrumentation for 4.8 kernel
Mathieu Desnoyers [Tue, 30 Aug 2016 21:32:35 +0000 (17:32 -0400)] 
Fix: btrfs instrumentation for 4.8 kernel

Note: there are missing events.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: update mm_vmscan instrumentation for kernel 4.8
Mathieu Desnoyers [Tue, 30 Aug 2016 21:13:37 +0000 (17:13 -0400)] 
Fix: update mm_vmscan instrumentation for kernel 4.8

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: napi instrumentation for 4.8 kernels
Mathieu Desnoyers [Tue, 30 Aug 2016 21:02:09 +0000 (17:02 -0400)] 
Fix: napi instrumentation for 4.8 kernels

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: update block instrumentation to compile on 4.8 kernels
Mathieu Desnoyers [Tue, 30 Aug 2016 20:59:13 +0000 (16:59 -0400)] 
Fix: update block instrumentation to compile on 4.8 kernels

These 2 upstream Linux commits break the block instrumentation in lttng
modules master:

https://github.com/torvalds/linux/commit/4e1b2d52a80d79296a5d899d73249748dea71a53

https://github.com/torvalds/linux/commit/288dab8a35a0bde426a09870943c8d3ee3a50dab

The errors are :

lttng-modules/probes/../instrumentation/events/lttng-module/block.h:35:13:
error: ‘REQ_DISCARD’ undeclared (first use in this function)

lttng-modules/probes/../instrumentation/events/lttng-module/block.h:41:14:
error: ‘REQ_SECURE’ undeclared (first use in this function)

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoCleanup: reuse code in accept() and accept4() instrumentation
Jérémie Galarneau [Mon, 29 Aug 2016 20:02:10 +0000 (16:02 -0400)] 
Cleanup: reuse code in accept() and accept4() instrumentation

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoAdd x86-64 override for accept4 syscall
Jérémie Galarneau [Mon, 29 Aug 2016 20:02:09 +0000 (16:02 -0400)] 
Add x86-64 override for accept4 syscall

This patch adds an instrumentation override for the accept4() syscall
which is almost identical to accept(), except for an additional
"flags" parameter.

A follow-up patch refactors both overrides to minimize code
duplication as is done for the select/pselect6 overrides.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: timer wrapper: support kernels >= 4.8
Mathieu Desnoyers [Thu, 25 Aug 2016 21:39:47 +0000 (17:39 -0400)] 
Fix: timer wrapper: support kernels >= 4.8

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoPerformance: split check deliver fast/slow paths
Mathieu Desnoyers [Sat, 16 Jul 2016 14:07:55 +0000 (10:07 -0400)] 
Performance: split check deliver fast/slow paths

Performance improvement changelog from lttng-ust, ported back to
lttng-modules:

On ARMv7l (Cubietruck), the compiler generates a function call for each
lib_ring_buffer_check_deliver, even though it typically only do an
unlikely check. Split it into an inline fast path, and a function call
for the slow path. This brings a performance gain of about 500ns/event
on the Cubietruck.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: x86-64 accept instrumentation
Mathieu Desnoyers [Fri, 19 Aug 2016 14:58:26 +0000 (10:58 -0400)] 
Fix: x86-64 accept instrumentation

The ipv4/ipv6 addr are output parameters.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: Add support for 4.6.4-rt8 kernel
Michael Jeanson [Fri, 29 Jul 2016 14:52:47 +0000 (10:52 -0400)] 
Fix: Add support for 4.6.4-rt8 kernel

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: update scsi instrumentation for 4.7+ kernels
Michael Jeanson [Thu, 28 Jul 2016 16:12:37 +0000 (12:12 -0400)] 
Fix: update scsi instrumentation for 4.7+ kernels

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: Use fs_initcall instead of rootfs_initcall
Michael Jeanson [Thu, 28 Jul 2016 16:12:11 +0000 (12:12 -0400)] 
Fix: Use fs_initcall instead of rootfs_initcall

The rootfs_initcall for drivers built as modules was only introduced in
kernel 3.14 by commit b46d0c46ccaa366a5bb8ac709fdf2bcaa76221fd. Use
fs_initcall instead which comes just before and exists in older kernels.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: Add kernel configuration for lttng clock plugin
Anders Wallin [Fri, 22 Jul 2016 14:10:47 +0000 (16:10 +0200)] 
Fix: Add kernel configuration for lttng clock plugin

Only one lttng clock plugin can be used when building the lttng-modules
in the kernel. To make it possible to use a custom clock plugin it must
be possible to unconfigure the test clock plugin

Signed-off-by: Anders Wallin <wallinux@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: the clock plugin must be initiated before first use of the clock
Anders Wallin [Fri, 22 Jul 2016 13:56:59 +0000 (15:56 +0200)] 
Fix: the clock plugin must be initiated before first use of the clock

When building lttng inside the kernel the clock plugin must be initated
before the rest of the lttng code. Moved the module_init to
rootfs_initcall. The functionality will not change when built as a
module.

Signed-off-by: Anders Wallin <wallinux@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: tests/Kbuild for older kernels
Mathieu Desnoyers [Fri, 15 Jul 2016 15:29:33 +0000 (11:29 -0400)] 
Fix: tests/Kbuild for older kernels

Older kernels (e.g. 2.6.38.8) don't seem to handle subdirectory in the
same way as recent kernels (e.g. 4.6). As a result, building LTTng
out-of-tree within a kernel modified to have LTTng as a built-in addon
fails with CONFIG_LTTNG=m.

$ make all O=../kernel_builddir
.....
  CC [M]  lttng/probes/lttng-kprobes.o
  CC [M]  lttng/probes/lttng-kretprobes.o
  LD      lttng/tests/built-in.o
  CC [M]  lttng/tests/probes/lttng-test.o
Assembler messages:
Fatal error: can't create lttng/tests/probes/lttng-test.o: No such
file or directory
/media/awallin/sda1/home/awallin/src/lttng-test/linux-2.6/scripts/Makefile.build:264:
recipe for target 'lttng/tests/probes/lttng-test.o' failed
make[3]: *** [lttng/tests/probes/lttng-test.o] Error 2
/media/awallin/sda1/home/awallin/src/lttng-test/linux-2.6/scripts/Makefile.build:403:
recipe for target 'lttng/tests' failed
make[2]: *** [lttng/tests] Error 2
/media/awallin/sda1/home/awallin/src/lttng-test/linux-2.6/Makefile:946:
recipe for target 'lttng' failed
make[1]: *** [lttng] Error 2
make[1]: Leaving directory
'/media/awallin/sda1/home/awallin/src/lttng-test/kernel_builddir'
Makefile:146: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2

$tree ../kernel_builddir/lttng/tests/
../kernel_builddir/lttng/tests/
└── built-in.o

Reported-by: Anders Wallin <anders.wallin@windriver.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoCleanup: __dynamic_len_idx set but not used warning
Mathieu Desnoyers [Fri, 15 Jul 2016 15:25:29 +0000 (11:25 -0400)] 
Cleanup: __dynamic_len_idx set but not used warning

__dynamic_len_idx can be set but not used, which causes gcc to
emit a warning. Mark it as possibly unused.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoCleanup: coding style and comments of net.h
Mathieu Desnoyers [Thu, 14 Jul 2016 15:56:12 +0000 (11:56 -0400)] 
Cleanup: coding style and comments of net.h

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agonet: Add TCP header data to net_* tracepoints
Geneviève Bastien [Tue, 12 Jul 2016 17:26:14 +0000 (13:26 -0400)] 
net: Add TCP header data to net_* tracepoints

This patch adds the transport header variant field in the network types IPv4
and IPv6 using the corresponding next protocol field in both types. It adds
the detailed fields of the TCP header. Other transport headers are empty.

Example output from babeltrace:

[13:21:04.392017771] (+0.000588730) qemulttng0 net_dev_queue: { cpu_id = 1 },
{ skbaddr = 0xFFFF88003C8390E8, len = 370, name = "ens3",
  network_header_type = ( "_ipv4" : container = 1 ),
  network_header = { ipv4 = { version = 4, ihl = 5, tos = 16, tot_len = 356,
    id = 0xFA2F, frag_off = 16384, ttl = 64,
    protocol = ( "_tcp" : container = 6 ), checksum = 0x173C,
    saddr_padding = { }, saddr = [ [0] = 10, [1] = 0, [2] = 10, [3] = 24 ],
    daddr_padding = { }, daddr = [ [0] = 10, [1] = 0, [2] = 10, [3] = 1 ],
    transport_header = { tcp = { source_port = 22, dest_port = 47500,
      seq = 2784866942, ack_seq = 3750103494, data_offset = 8, reserved = 0,
      flags = 0x11, window_size = 305, checksum = 0x296F, urg_ptr = 0 }
} } } }

[13:21:04.429861105] (+0.037671848) qemulttng0 net_dev_queue: { cpu_id = 1 },
{ skbaddr = 0xFFFF88003DBFC800, len = 86, name = "ens3",
  network_header_type = ( "_ipv6" : container = 2 ),
  network_header = { ipv6 = { version = 6, prio = 0, flow_lbl_padding = { },
    flow_lbl = [ [0] = 0x84, [1] = 0x41, [2] = 0x6F ], payload_len = 32,
    nexthdr = ( "_tcp" : container = 6 ), hop_limit = 64,
    saddr_padding = { }, saddr = [ [0] = 0xFE80, [1] = 0x0, [2] = 0x0, [3] = 0x0,
      [4] = 0x5054, [5] = 0xFF, [6] = 0xFE12, [7] = 0x3456 ],
    daddr_padding = { }, daddr = [ [0] = 0xFE80, [1] = 0x0, [2] = 0x0, [3] = 0x0,
      [4] = 0x5054, [5] = 0xFF, [6] = 0xFE22, [7] = 0x3344 ],
    transport_header = { tcp = { source_port = 36972, dest_port = 22,
      seq = 3750103494, ack_seq = 2784866942, data_offset = 0, reserved = 0,
      flags = 0x11, window_size = 256, checksum = 0x39F, urg_ptr = 0 }
} } } }

[13:21:08.195490138] (+3.765629033) qemulttng0 net_if_receive_skb: { cpu_id = 0 },
{ skbaddr = 0xFFFF88003C0B8C00, len = 72, name = "ens3",
  network_header_type = ( "_ipv6" : container = 2 ),
  network_header = { ipv6 = { version = 6, prio = 0, flow_lbl_padding = { },
    flow_lbl = [ [0] = 0x84, [1] = 0xCB, [2] = 0x7F ], payload_len = 32,
    nexthdr = ( "_unknown" : container = 58 ), hop_limit = 255,
    saddr_padding = { }, saddr = [ [0] = 0xFE80, [1] = 0x0, [2] = 0x0, [3] = 0x0,
      [4] = 0x40C, [5] = 0xA9FF, [6] = 0xFEB5, [7] = 0xA75B ],
    daddr_padding = { }, daddr = [ [0] = 0xFE80, [1] = 0x0, [2] = 0x0, [3] = 0x0,
      [4] = 0x5054, [5] = 0xFF, [6] = 0xFE12, [7] = 0x3456 ],
    transport_header = { unknown = { }
} } } }

Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agonet: Add IPv4/IPv6 header data to net_* tracepoints
Geneviève Bastien [Mon, 11 Jul 2016 13:34:02 +0000 (09:34 -0400)] 
net: Add IPv4/IPv6 header data to net_* tracepoints

This patch adds an enum field for the type of network header and a variant
field for the details of IPv4 and IPv6 headers. Any other network header is
empty.

Example babeltrace output:

[16:04:07.443810277] (+0.110633000) host0 net_dev_queue: { cpu_id = 0 },
{ skbaddr = 0xFFFF88003D9F4B00, len = 1462, name = "ens3",
  network_header_type = ( "_ipv4" : container = 1 ),
  network_header = { ipv4 = { version = 4, ihl = 5, tos = 0, tot_len = 1448,
    id = 0x0, frag_off = 16384, ttl = 64, protocol = 6, checksum = 0xB04,
    saddr_padding = { }, saddr = [ [0] = 10, [1] = 0, [2] = 10, [3] = 24 ],
    daddr_padding = { }, daddr = [ [0] = 10, [1] = 0, [2] = 12, [3] = 42 ] }
} }
[16:04:10.452192462] (+0.000283214) host0 net_if_receive_skb: { cpu_id = 0 },
{ skbaddr = 0xFFFF88003D9F4900, len = 118, name = "ens3",
  network_header_type = ( "_ipv6" : container = 2 ),
  network_header = { ipv6 = { version = 6, prio = 0, flow_lbl_padding = { },
    flow_lbl = [ [0] = 0x88, [1] = 0x41, [2] = 0x6F ], payload_len = 64,
    nexthdr = 58, hop_limit = 64, saddr_padding = { },
    saddr = [ [0] = 0xFE80, [1] = 0x0, [2] = 0x0, [3] = 0x0, [4] = 0x5054,
              [5] = 0xFF, [6] = 0xFE12, [7] = 0x3456 ],
    daddr_padding = { },
    daddr = [ [0] = 0xFE80, [1] = 0x0, [2] = 0x0, [3] = 0x0, [4] = 0x40C,
              [5] = 0xA9FF, [6] = 0xFEB5, [7] = 0xA75B ] }
} }

Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: endianness for the container type of enum
Geneviève Bastien [Tue, 12 Jul 2016 16:21:51 +0000 (12:21 -0400)] 
Fix: endianness for the container type of enum

If the endianness is specified for an enumeration, it should be written
in the metadata like for any other integer type.

Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoenumeration autoincrement: use if/else logic
Mathieu Desnoyers [Mon, 4 Jul 2016 22:46:16 +0000 (18:46 -0400)] 
enumeration autoincrement: use if/else logic

Use if/else logic rather than "continue" on loop for clarity.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoCleanup trailing whitespaces
Philippe Proulx [Mon, 4 Jul 2016 19:16:10 +0000 (15:16 -0400)] 
Cleanup trailing whitespaces

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agolttng-test probe: test ctf_enum_auto()
Philippe Proulx [Mon, 4 Jul 2016 19:29:11 +0000 (15:29 -0400)] 
lttng-test probe: test ctf_enum_auto()

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoAdd ctf_enum_auto() for autoincrementing enumeration values
Philippe Proulx [Mon, 4 Jul 2016 19:14:54 +0000 (15:14 -0400)] 
Add ctf_enum_auto() for autoincrementing enumeration values

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoImplement session statedump command
Mathieu Desnoyers [Thu, 14 Apr 2016 19:41:15 +0000 (15:41 -0400)] 
Implement session statedump command

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: annotate bytecode interpreter for kernel stack validator
Mathieu Desnoyers [Wed, 15 Jun 2016 18:39:41 +0000 (14:39 -0400)] 
Fix: annotate bytecode interpreter for kernel stack validator

With gcc 6.1.1, kernel 4.6, with
CONFIG_STACK_VALIDATION=y, building lttng-modules master
at commit 6c09dd94 gives this warning:

lttng-modules/lttng-filter-interpreter.o: warning: objtool:
lttng_filter_interpret_bytecode()+0x58: sibling call from
callable instruction with changed frame pointer

This object implements a bytecode interpreter using an explicit
jump table.

If we define "INTERPRETER_USE_SWITCH" at the top of the file,
thus using the switch-case fallback implementation, the
warning vanishes.

We use an explicit jump table rather than a switch case whenever
possible for performance reasons.

Unfortunately objtool doesn't know how to validate this type of jump
table. So to avoid the warning we need to add an annotation to tell
objtool to ignore it.

Kernel developers has to annotate __bpf_prog_run() in the kernel for the
same reason.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoUpdate version to 2.9.0-pre
Michael Jeanson [Tue, 24 May 2016 20:11:11 +0000 (16:11 -0400)] 
Update version to 2.9.0-pre

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: ring buffer: honor switch parameter type in remote switch
Mathieu Desnoyers [Fri, 20 May 2016 01:32:06 +0000 (21:32 -0400)] 
Fix: ring buffer: honor switch parameter type in remote switch

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: only flush non-metadata channels
Mathieu Desnoyers [Fri, 20 May 2016 01:31:07 +0000 (21:31 -0400)] 
Fix: only flush non-metadata channels

Issue introduced by commit
"Fix: do not generate packet at destroy after stop".

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: don't perform extra flush on metadata channel
Mathieu Desnoyers [Fri, 20 May 2016 00:30:07 +0000 (20:30 -0400)] 
Fix: don't perform extra flush on metadata channel

The metadata channel requires that the LTTng client layer and the ring
buffer keep a notion of the amount of data produced in the channel.

This issue has been introduced recently by commit
"Fix: flush empty packets on snapshot channel".

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoselect, poll and epoll_wait overrides on ARM 32-bit
Julien Desfossez [Mon, 16 May 2016 19:36:11 +0000 (15:36 -0400)] 
select, poll and epoll_wait overrides on ARM 32-bit

The syscalls select, poll and epoll_wait exist on ARM 32-bit as well,
the overrides work on this platform.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: flush empty packets on snapshot channel
Mathieu Desnoyers [Wed, 18 May 2016 01:24:46 +0000 (21:24 -0400)] 
Fix: flush empty packets on snapshot channel

Snapshot operation on a non-stopped stream should use a "final" flush to
ensure empty packets are flushed, so we gather timestamps at the moment
where the snapshot is taken. This is important for streams that have a
low amount of activity.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: do not generate packet at destroy after stop
Mathieu Desnoyers [Wed, 18 May 2016 01:23:24 +0000 (21:23 -0400)] 
Fix: do not generate packet at destroy after stop

In the following scenario:
- create, enable events (kernel),
- start
- ...
- stop (await for data_pending to complete)
- destroy
- rm the trace directory

We would expect that the "rm" operation would not conflict with the
consumer daemon trying to output data into the trace files, since the
"stop" operation ensured that there was no data_pending.

However, the "destroy" operation currently generates an extra packet
after the data_pending check. This causes the consumer daemon to try to
perform trace file rotation concurrently with the trace directory
removal in the scenario above, which triggers errors. The main reason
why this empty packet is generated by "destroy" is to deal with trace
start/stop scenario which would otherwise generate a completely empty
stream.

Therefore, introduce the concept of a "quiescent stream". It is
initialized at false on stream creation (first packet is empty). When
tracing is started, it is set to false (for cases of start/stop/start).
When tracing is stopped, if the stream is not quiescent, perform a
"final" flush (which will generate an empty packet if the current packet
was empty), and set quiescent to true.  On "destroy" stream: if the
stream is not quiescent, perform a "final" flush, and set the quiescent
state to true.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: compat ioctl for flush/get metadata version
Mathieu Desnoyers [Wed, 18 May 2016 01:16:22 +0000 (21:16 -0400)] 
Fix: compat ioctl for flush/get metadata version

Unlike the non-compat version, the compat ioctl lttng ABI code for the
ring buffer flush operation does not invoke
lttng_metadata_output_channel before calling the ring buffer operation.
This could lead to incomplete metadata on 64-bit kernels running with
32-bit lttng userland.

There is also a discrepancy between the non-compat and compat code: the
GET_METADATA_VERSION operation is performed before calling the ring
buffer code. Ensure both non-compat and compat code are alike.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: ctf_string() should handle NULL pointers
Mathieu Desnoyers [Mon, 16 May 2016 20:45:24 +0000 (16:45 -0400)] 
Fix: ctf_string() should handle NULL pointers

The regmap instrumentation can send a NULL string (e.g. on ARM32).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: portability: no arith on void pointer
Mathieu Desnoyers [Mon, 16 May 2016 19:08:02 +0000 (15:08 -0400)] 
Fix: portability: no arith on void pointer

Reported by cppcheck.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: add missing tests/Kbuild
Mathieu Desnoyers [Wed, 11 May 2016 23:35:06 +0000 (19:35 -0400)] 
Fix: add missing tests/Kbuild

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoTest clock override plugin
Mathieu Desnoyers [Wed, 11 May 2016 14:10:17 +0000 (10:10 -0400)] 
Test clock override plugin

Fixes: #939
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: add modules target to base Makefile
Michael Jeanson [Wed, 11 May 2016 14:38:06 +0000 (10:38 -0400)] 
Fix: add modules target to base Makefile

This way running 'make modules' will indeed build the modules
like in the upstream build system.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: make clean does not include dot-config
Mathieu Desnoyers [Wed, 11 May 2016 14:37:12 +0000 (10:37 -0400)] 
Fix: make clean does not include dot-config

Skip the CONFIG_TRACEPOINT test if dot-config has not been included.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: trigger build error if CONFIG_TRACEPOINTS is not set
Mathieu Desnoyers [Wed, 11 May 2016 02:04:12 +0000 (22:04 -0400)] 
Fix: trigger build error if CONFIG_TRACEPOINTS is not set

Fixes: #1015
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoDocumentation: document that CONFIG_MODULES not required when builtin
Mathieu Desnoyers [Wed, 11 May 2016 02:03:23 +0000 (22:03 -0400)] 
Documentation: document that CONFIG_MODULES not required when builtin

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: add missing errno include in random wrapper
Mathieu Desnoyers [Wed, 11 May 2016 00:49:01 +0000 (20:49 -0400)] 
Fix: add missing errno include in random wrapper

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: mm_page_alloc_extfrag instrumentation for kernel 3.16.35
Michael Jeanson [Thu, 5 May 2016 20:10:36 +0000 (16:10 -0400)] 
Fix: mm_page_alloc_extfrag instrumentation for kernel 3.16.35

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: copy_from_user size when limited allocation
Julien Desfossez [Mon, 2 May 2016 20:48:08 +0000 (16:48 -0400)] 
Fix: copy_from_user size when limited allocation

We restrict the memory allocation to one page, but in two syscalls we were
using the wrong size in the copy_from_user.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoExtract the payload of epoll_wait/epoll_pwait
Julien Desfossez [Sat, 30 Apr 2016 15:09:30 +0000 (11:09 -0400)] 
Extract the payload of epoll_wait/epoll_pwait

When epoll_wait returns, extract the content of the "events" field
(events set and data payload).

Here is an example output:
syscall_entry_epoll_wait: { epfd = 3, maxevents = 32, timeout = 100 }
syscall_exit_epoll_wait: { ret = 1, fds_length = 1,
  fds = [ [0] = { raw_events = 0x1,
    events = { EPOLLIN = 1, EPOLLPRI = 0, EPOLLOUT = 0, EPOLLERR = 0,
      padding = 0 },
    data_union = { u64 = 0x100000005, fd = 5 } } ]
}

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoExtract the payload for epoll_ctl
Julien Desfossez [Sat, 30 Apr 2016 15:09:29 +0000 (11:09 -0400)] 
Extract the payload for epoll_ctl

Map the operation to its name (EPOLL_CTL_*), extract the standard event
flags (EPOLL*) and output the data in two different formats: FD as an
int in decimal, and u64 in hex. The less standard event flags are not
extracted yet, but we extract the raw value in hex for more advanced
analyses.

Here is an example output:
syscall_entry_epoll_ctl: {
  epfd = 4, op_enum = ( "EPOLL_CTL_ADD" : container = 1 ),
  fd = 0, event = { raw_events = 0x80000003,
  events = { EPOLLIN = 1, EPOLLPRI = 1, EPOLLOUT = 0, EPOLLERR = 0,
    padding = 0 },
  data_union = { u64 = 0x0, fd = 0 } }
}

syscall_exit_epoll_ctl: { ret = 0 }

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoExtract the FDs and flags from poll and ppoll
Julien Desfossez [Sat, 30 Apr 2016 15:09:28 +0000 (11:09 -0400)] 
Extract the FDs and flags from poll and ppoll

Instead of printing the pointer address of the poll set, extract all the
FDs and flags from the poll set. For now, we only output the
standardized set of events to limit the verbosity of the output, we also
extract the raw value. When we switch to CTF2 we will be able to hide
unset fields and then we will extract all the fields.

Here is an example of output with one FD:
syscall_entry_poll: {
  timeout_msecs = -1, nfds = 1, fds_length = 1,
  fds = [
    [0] = { fd = 4, raw_events = 0x5, events = { POLLIN = 1, POLLPRI = 0,
            POLLOUT = 1, POLLERR = 0, POLLHUP = 0, padding = 0 } } ]
}

syscall_exit_poll: {
  ret = 1, nfds = 1, fds_length = 1,
  fds = [ [0] = { fd = 4, raw_events = 0x4, events = { POLLIN = 0,
  POLLPRI = 0, POLLOUT = 1, POLLERR = 0, POLLHUP = 0, padding = 0 } } ] }

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoExtract the FD sets in select and pselect6
Julien Desfossez [Sat, 30 Apr 2016 15:09:27 +0000 (11:09 -0400)] 
Extract the FD sets in select and pselect6

Instead of extracting the user-space pointers of the 3 fd_set, we now
extract the bitmask of the FDs in the sets (in, out, ex) in the form of
an array of uint8_t (1024 FDs is the limit in the kernel).

In this example, we select in input FDs 5 to 19 (0xFFFF0), it returns
that one FD is ready: FD 12 (0x1000).

syscall_entry_select: {
  n = 20,
  _fdset_in_length = 3, fdset_in = [ [0] = 0xF0, [1] = 0xFF, [2] = 0xF ],
  _fdset_out_length = 0, fdset_out = [ ],
  _fdset_ex_length = 0, fdset_ex = [ ],
  tvp = 0
 }

syscall_exit_select: {
  ret = 1,
  _fdset_in_length = 3, fdset_in = [ [0] = 0x0, [1] = 0x10, [2] = 0x0 ],
  _fdset_out_length = 0, fdset_out = [ ],
  _fdset_ex_length = 0, fdset_ex = [ ],
  tvp = 0
}

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoAdd ctf_integer_bitfield_type
Julien Desfossez [Fri, 29 Apr 2016 22:53:20 +0000 (18:53 -0400)] 
Add ctf_integer_bitfield_type

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoImplement enumeration type
Mathieu Desnoyers [Fri, 18 Mar 2016 20:01:54 +0000 (16:01 -0400)] 
Implement enumeration type

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoImplement custom field support
Mathieu Desnoyers [Mon, 2 May 2016 16:33:13 +0000 (12:33 -0400)] 
Implement custom field support

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoImplement variant type
Mathieu Desnoyers [Fri, 18 Mar 2016 19:52:18 +0000 (15:52 -0400)] 
Implement variant type

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoImplement shadow stack for dynamic len
Mathieu Desnoyers [Thu, 17 Mar 2016 22:09:32 +0000 (18:09 -0400)] 
Implement shadow stack for dynamic len

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agolibringbuffer: implement event too big API
Mathieu Desnoyers [Sat, 19 Mar 2016 15:34:22 +0000 (11:34 -0400)] 
libringbuffer: implement event too big API

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoImplement structure, compound array/sequence types
Mathieu Desnoyers [Thu, 17 Mar 2016 16:16:09 +0000 (12:16 -0400)] 
Implement structure, compound array/sequence types

Only supports structure, and compound array/sequences
containing structures at this point.

Only supported within event fields, not contexts yet.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: integer endianness metadata generation
Mathieu Desnoyers [Mon, 2 May 2016 16:32:48 +0000 (12:32 -0400)] 
Fix: integer endianness metadata generation

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: endianness of integers received by filter
Mathieu Desnoyers [Tue, 26 Apr 2016 22:41:04 +0000 (18:41 -0400)] 
Fix: endianness of integers received by filter

We need to byteswap integers passed to the filter when they are tagged
as being in an endianness which differs from the architecture
endianness, so the integer comparisons make sense in terms of value
rather than raw bytes for those fields.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: writeback probe on RHEL >= 3.10.0-327.10.1
Michael Jeanson [Thu, 21 Apr 2016 20:11:04 +0000 (16:11 -0400)] 
Fix: writeback probe on RHEL >= 3.10.0-327.10.1

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: RHEL kernel 3.10.0-327.13.1 compat
Michael Jeanson [Wed, 20 Apr 2016 21:50:05 +0000 (17:50 -0400)] 
Fix: RHEL kernel 3.10.0-327.13.1 compat

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: ctf_user_integer should not trigger page fault
Mathieu Desnoyers [Wed, 20 Apr 2016 21:58:33 +0000 (17:58 -0400)] 
Fix: ctf_user_integer should not trigger page fault

It is not used by the instrumentation currently, but fix it
nevertheless.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: lib_ring_buffer_copy_from_user_inatomic error handling
Mathieu Desnoyers [Wed, 20 Apr 2016 21:56:45 +0000 (17:56 -0400)] 
Fix: lib_ring_buffer_copy_from_user_inatomic error handling

It should treat nonzero return value of
lib_ring_buffer_do_copy_from_user_inatomic() as errors, 0 as success.

It is currently unused by the instrumentation.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoAdd comment describing ioctl number duplication
Mathieu Desnoyers [Thu, 14 Apr 2016 19:29:01 +0000 (15:29 -0400)] 
Add comment describing ioctl number duplication

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: remove unused gfpflags.h from btrfs and compaction instrumentation
Mathieu Desnoyers [Tue, 5 Apr 2016 19:25:20 +0000 (15:25 -0400)] 
Fix: remove unused gfpflags.h from btrfs and compaction instrumentation

Its content is unused, and this file disappears in Linux 4.6-rc.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: Remove dead code from filter interpreter
Mathieu Desnoyers [Tue, 5 Apr 2016 13:26:51 +0000 (09:26 -0400)] 
Fix: Remove dead code from filter interpreter

Detected by Coverity:
** CID 1353794:  Control flow issues  (DEADCODE)
/lttng-filter-interpreter.c: 123 in stack_strcmp()

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: x86 kvm mmutrace instrumentation for kernel < 3.6
Mathieu Desnoyers [Tue, 5 Apr 2016 12:36:44 +0000 (08:36 -0400)] 
Fix: x86 kvm mmutrace instrumentation for kernel < 3.6

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: mm_vmscan instrumentation: remove unused gfpflags.h include
Mathieu Desnoyers [Tue, 5 Apr 2016 12:09:13 +0000 (08:09 -0400)] 
Fix: mm_vmscan instrumentation: remove unused gfpflags.h include

This header disappears in kernel 4.6, but we don't actually use it, so
remove its include.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: use of uninitialized ret value in lttng_abi_create_event
Mathieu Desnoyers [Tue, 5 Apr 2016 12:05:42 +0000 (08:05 -0400)] 
Fix: use of uninitialized ret value in lttng_abi_create_event

Fixes the following compiler warning:

/home/jenkins/workspace/lttng-modules_VERSION_param-build/arch/x86-32/src/lttng-modules/lttng-abi.c: In function ‘lttng_abi_create_event’:
/home/jenkins/workspace/lttng-modules_VERSION_param-build/arch/x86-32/src/lttng-modules/lttng-abi.c:987:16: warning: ‘ret’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  int event_fd, ret;

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: kmem instrumentation: remove unused gfpflags.h include
Mathieu Desnoyers [Mon, 4 Apr 2016 19:57:24 +0000 (15:57 -0400)] 
Fix: kmem instrumentation: remove unused gfpflags.h include

This header disappears in kernel 4.6, but we don't actually use it, so
remove its include.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: 4.6 kernel: use in_compat_syscall
Mathieu Desnoyers [Mon, 4 Apr 2016 19:55:28 +0000 (15:55 -0400)] 
Fix: 4.6 kernel: use in_compat_syscall

in_compat_sycall appears in kernel 4.6. Use it instead of
is_compat_task(), but use is_compat_task() as fallback.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: use BUG_ON instead of accessing array subscript above array bounds
Mathieu Desnoyers [Mon, 4 Apr 2016 18:39:16 +0000 (14:39 -0400)] 
Fix: use BUG_ON instead of accessing array subscript above array bounds

Building lttng-modules lttng-filter-interpreter.c on a 4.6-rc kernel
triggers the following gcc warning:

In file included from /home/compudj/git/lttng-modules/lttng-filter-interpreter.c:25:0:
/home/compudj/git/lttng-modules/lttng-filter-interpreter.c: In function ‘lttng_filter_interpret_bytecode’:
/home/compudj/git/lttng-modules/lttng-filter.h:144:14: warning: array subscript is above array bounds [-Warray-bounds]
   &(stack)->e[top];    \
              ^
/home/compudj/git/lttng-modules/lttng-filter-interpreter.c:714:4: note: in expansion of macro ‘estack_ax’
    estack_ax(stack, top)->u.s.str = insn->data;
    ^
/home/compudj/git/lttng-modules/lttng-filter.h:144:14: warning: array subscript is above array bounds [-Warray-bounds]
   &(stack)->e[top];    \
              ^
/home/compudj/git/lttng-modules/lttng-filter-interpreter.c:715:4: note: in expansion of macro ‘estack_ax’
    estack_ax(stack, top)->u.s.seq_len = UINT_MAX;

This is because the bound checking is performed in a prior validation
phase (which the compiler does not know about), and we only
WARN_ON_ONCE() if the interpreter sees values that don't fit in array
range.

Use BUG_ON() in the interpreter instead, which ensures we never, ever
reach the out-of-bound condition from a compiler perspective.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: Add granularity to RHEL kernel version checks
Michael Jeanson [Tue, 29 Mar 2016 23:32:19 +0000 (19:32 -0400)] 
Fix: Add granularity to RHEL kernel version checks

Our RHEL kernel version macros were based on the major and minor version
of the distribution version like "7.2" instead of the full kernel version
like "327.4.4". This prevented us from adding compatibility changes with
sufficient granularity.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoVersion 2.8.0-rc1 v2.8.0-rc1
Mathieu Desnoyers [Fri, 18 Mar 2016 22:21:44 +0000 (18:21 -0400)] 
Version 2.8.0-rc1

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoBump minor tracer ABI version
Mathieu Desnoyers [Fri, 18 Mar 2016 21:32:21 +0000 (17:32 -0400)] 
Bump minor tracer ABI version

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: build against out-of-tree kernel build
Mathieu Desnoyers [Wed, 16 Mar 2016 15:23:43 +0000 (11:23 -0400)] 
Fix: build against out-of-tree kernel build

Fix following system header include modifications.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
This page took 0.051587 seconds and 4 git commands to generate.