lttng-modules.git
10 years agoFix: handle concurrent flush vs get_next_subbuf on metadata cache
Mathieu Desnoyers [Fri, 26 Sep 2014 00:33:21 +0000 (20:33 -0400)] 
Fix: handle concurrent flush vs get_next_subbuf on metadata cache

The "flush" operation can be performed on the metadata file descriptor
concurrently with get_next_subbuffer operations by different processes
(e.g. lttng session daemon issuing flush at "stop" concurrently with
consumer daemon issuing get_next_subbuf for metadata I/O). We need
to protect the metadata cache from those concurrent use by introducing a
mutex.

This fixes a race where metadata from a kernel trace is corrupted due to
this scenario. The corruption shows up like the same metadata content (a
metadata packet) being written twice consecutively in the metadata
stream, thus triggering a babeltrace "parse error" when trying to read
the trace.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoVersion 2.4.2 v2.4.2
Mathieu Desnoyers [Wed, 16 Jul 2014 22:01:55 +0000 (18:01 -0400)] 
Version 2.4.2

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: statedump handle oom case, handle errors
Mathieu Desnoyers [Thu, 26 Jun 2014 17:50:15 +0000 (13:50 -0400)] 
Fix: statedump handle oom case, handle errors

lttng_enumerate_file_descriptors should check the pointer returned by
__get_free_page() (check if NULL).

do_lttng_statedump should check the sub-function return values. For
lttng_enumerate_block_devices(), we allow -ENOSYS to continue (if not
implemented).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: correct typo in kernel version number
Antoine Busque [Wed, 11 Jun 2014 14:45:44 +0000 (10:45 -0400)] 
Fix: correct typo in kernel version number

A typo in a preprocessor conditional verifying the range in which the
current kernel version is situated caused build failure for modules on
3.5.0 specifically, by trying to use the new api for block_rq_complete
which has not been backported from the 3.15 branch to the 3.5 branch.

Signed-off-by: Antoine Busque <antoine.busque@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: blktrace instrumentation for backported branches
Antoine Busque [Sat, 7 Jun 2014 16:27:21 +0000 (12:27 -0400)] 
Fix: blktrace instrumentation for backported branches

The following commit from kernel 3.15 changing the API of a block layer
tracepoint has been backported to multiple branches:

commit af5040da01ef980670b3741b3e10733ee3e33566
Author: Roman Pen <r.peniaev@gmail.com>
Date:   Tue Mar 4 23:13:10 2014 +0900

    blktrace: fix accounting of partially completed requests

This patch fixes the resulting build failure by adding the proper
version checks. The versions and corresponding commit SHA-1 hashes are
as follow:

   3.2.58
       commit 5b85afa68e4f56c27f1d5c6f49e5257bce6448e6

   3.4.91
       commit 14eee5bd065d6aac0acbdc6092a25ba68c55b9c8

   3.10.41
       commit e9d933941569c107e0083c3c115467c699a57db2

   3.12.21
       commit 5104b40a981d26212ced149fbd43ad0b6b72910b

   3.14.15
       commit 0a8eda9c00ef37e8b40de77f2b0714317191bcf2

Signed-off-by: Antoine Busque <antoine.busque@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: refuse overwrite mode buffers with less than two subbuffers
Mathieu Desnoyers [Fri, 23 May 2014 13:26:11 +0000 (09:26 -0400)] 
Fix: refuse overwrite mode buffers with less than two subbuffers

Fixes #793

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: lttng modules system call generation script
Mathieu Desnoyers [Thu, 22 May 2014 12:06:10 +0000 (08:06 -0400)] 
Fix: lttng modules system call generation script

Fixes #771

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: incorrect rwbs field type in block_bio_queue
Mathieu Desnoyers [Mon, 5 May 2014 14:32:44 +0000 (10:32 -0400)] 
Fix: incorrect rwbs field type in block_bio_queue

Within lttng-modules instrumentation starting from kernel 3.9.0, the
block_bio_queue instrumentation has incorrect rwbs field type, and does
not print "comm" as an array of text.

The result is that we are writing values to what we believe to be an
"unsigned int", which is actually described as an array of RWBS_LEN byte
(8 bytes). This discrepancy between type description and the actual
tp_assign() incrementing the write offset leads to what appears as
corruption of the following "comm" field in the trace viewer output: the
viewer will skip the first bytes of the "comm" field, erroneously
thinking they belong the the previous "rwbs" field.

Fixes #794

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: blktrace instrumentation for v3.2.58+ stable branch
Mathieu Desnoyers [Sat, 3 May 2014 19:07:42 +0000 (15:07 -0400)] 
Fix: blktrace instrumentation for v3.2.58+ stable branch

Starting with Linux kernel v3.2.58 within the v3.2 Linux stable branch:

commit 5b85afa68e4f56c27f1d5c6f49e5257bce6448e6
Author: Roman Pen <r.peniaev@gmail.com>
Date:   Tue Mar 4 23:13:10 2014 +0900

    blktrace: fix accounting of partially completed requests

    commit af5040da01ef980670b3741b3e10733ee3e33566 upstream.

The module API for a block layer tracepoint changes. Fix the associated
build failure.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: update block instrumentation to 3.15 kernel
Mathieu Desnoyers [Tue, 15 Apr 2014 15:13:16 +0000 (11:13 -0400)] 
Fix: update block instrumentation to 3.15 kernel

Required with lttng-modules stable-2.4 branch because this fix is
backported to stable kernels too.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: pass proper args when writing commit counter
Mathieu Desnoyers [Tue, 15 Apr 2014 16:50:12 +0000 (12:50 -0400)] 
Fix: pass proper args when writing commit counter

lib_ring_buffer_write_commit_counter()'s 'buf_offset' argument should
contain offset of beginning of area used by the record being comitted.

However, lib_ring_buffer_commit() passes ctx->buf_offset, that gets
advanced by lib_ring_buffer_write() and thus points to just-after-
end-of-record at lib_ring_buffer_commit() time. This causes
lib_ring_buffer_write_commit_counter() to return without changing
commit_hot[idx].seq, due to

if (unlikely(subbuf_offset(offset - commit_count, chan)))
return;

Since after-crash data extraction tool checks 'seq' field to find out
how much data is in buffer, this results into inavailability of
data from partially-filled subbuffer for after-crash analysis.

This patch modifies lib_ring_buffer_write_commit_counter() and all its
callers to pass and expect the end of the area. So code works as it
should, and complete information becomes visible in crash dump.

[ Changelog inspired from Nikita Yushchenko's original patch. ]

Fixes #784

Reported-by: Nikita Yushchenko <nyoushchenko@mvista.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: allow racy tracepoint string input from kernel and userspace
Mathieu Desnoyers [Mon, 14 Apr 2014 17:05:19 +0000 (13:05 -0400)] 
Fix: allow racy tracepoint string input from kernel and userspace

Fixes #781

Acked-by: David Goulet <dgoulet@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoVersion 2.4.1 v2.4.1
Mathieu Desnoyers [Tue, 8 Apr 2014 19:07:03 +0000 (15:07 -0400)] 
Version 2.4.1

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: rcu instrumentation: add const qualifier to char pointers
Mathieu Desnoyers [Wed, 2 Apr 2014 16:23:06 +0000 (12:23 -0400)] 
Fix: rcu instrumentation: add const qualifier to char pointers

Follow this 3.12 instrumentation update in mainline Linux:

commit e66c33d579ea566d10e8c8695a7168aae3e02992
Author: Steven Rostedt (Red Hat) <rostedt@goodmis.org>
Date:   Fri Jul 12 16:50:28 2013 -0400

    rcu: Add const annotation to char * for RCU tracepoints and functions

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: add missing module version information
Mathieu Desnoyers [Wed, 2 Apr 2014 15:53:30 +0000 (11:53 -0400)] 
Fix: add missing module version information

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: block instrumentation: < 3.14 don't have bi_iter
Mathieu Desnoyers [Thu, 20 Mar 2014 14:01:51 +0000 (10:01 -0400)] 
Fix: block instrumentation: < 3.14 don't have bi_iter

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: update btrfs instrumentation to kernel 3.14
Mathieu Desnoyers [Thu, 20 Mar 2014 13:18:21 +0000 (09:18 -0400)] 
Fix: update btrfs instrumentation to kernel 3.14

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: update block layer instrumentation to kernel 3.14
Mathieu Desnoyers [Thu, 20 Mar 2014 13:01:56 +0000 (09:01 -0400)] 
Fix: update block layer instrumentation to kernel 3.14

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix file permissions for lttng-statedump-impl.c
Mathieu Desnoyers [Sat, 15 Mar 2014 18:19:18 +0000 (14:19 -0400)] 
Fix file permissions for lttng-statedump-impl.c

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoVersion 2.4.0 v2.4.0
Mathieu Desnoyers [Fri, 28 Feb 2014 18:35:29 +0000 (13:35 -0500)] 
Version 2.4.0

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: load state dump even if work-around lookup fails
Mathieu Desnoyers [Fri, 28 Feb 2014 17:30:04 +0000 (12:30 -0500)] 
Fix: load state dump even if work-around lookup fails

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoCleanup: fix comment
Mathieu Desnoyers [Tue, 25 Feb 2014 11:43:24 +0000 (06:43 -0500)] 
Cleanup: fix comment

Fixes #652

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: correctly version kvm events to build against v3.0 kernel
Tony Jones [Fri, 21 Feb 2014 20:17:28 +0000 (12:17 -0800)] 
Fix: correctly version kvm events to build against v3.0 kernel

Cleanly build against v3.0 kernel.  I didn't add versioning for mainline commit 0d460ffc as it's build compatible.

Signed-off-by: Tony Jones <tonyj@suse.de>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoAdd extraversion (e.g. -rc4) to lttng-tracer modinfo
Mathieu Desnoyers [Fri, 14 Feb 2014 22:10:52 +0000 (17:10 -0500)] 
Add extraversion (e.g. -rc4) to lttng-tracer modinfo

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoVersion 2.4.0-rc4 v2.4.0-rc4
Mathieu Desnoyers [Fri, 14 Feb 2014 16:46:08 +0000 (11:46 -0500)] 
Version 2.4.0-rc4

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: use after free in ring buffer clients
Mathieu Desnoyers [Tue, 11 Feb 2014 23:18:51 +0000 (18:18 -0500)] 
Fix: use after free in ring buffer clients

Don't use ring buffer client's struct lttng_channel from ioctl which
applies to ring buffer streams, because lttng_channel is freed while lib
ring buffer stream and channel are still in use. Their lifetime persists
until the consumer daemon releases its handles on the related stream
file descriptors.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: Add statedump exit so module is not permanent
Mathieu Desnoyers [Tue, 11 Feb 2014 23:02:32 +0000 (18:02 -0500)] 
Fix: Add statedump exit so module is not permanent

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoCleanup: move callback init to static initialization
Mathieu Desnoyers [Tue, 11 Feb 2014 22:25:09 +0000 (17:25 -0500)] 
Cleanup: move callback init to static initialization

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: OOT lttng-statedump tracepoints not visible with signed kernels
Mathieu Desnoyers [Tue, 11 Feb 2014 11:02:42 +0000 (06:02 -0500)] 
Fix: OOT lttng-statedump tracepoints not visible with signed kernels

Users have reported being unable to trace non-signed modules loaded
within a kernel supporting module signature.

Here is the relevant report of this issue to Linux upstream, with a
proposed fix: https://lkml.org/lkml/2014/2/10/747

Work-around the issue for lttng-statedump.ko tracepoints.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoVersion 2.4.0-rc3 v2.4.0-rc3
Mathieu Desnoyers [Wed, 29 Jan 2014 16:59:45 +0000 (11:59 -0500)] 
Version 2.4.0-rc3

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: tracepoint event name mapping at unregister
Mathieu Desnoyers [Sat, 25 Jan 2014 20:58:08 +0000 (15:58 -0500)] 
Fix: tracepoint event name mapping at unregister

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: tracepoint name remapping
Mathieu Desnoyers [Sat, 25 Jan 2014 00:16:08 +0000 (19:16 -0500)] 
Fix: tracepoint name remapping

Commit

  "Introduce API to remap event names exposed by LTTng"

failed to map the event names enabled by the user to tracepoint names
known to the kernel. For instance, tracing with the kmem_kmalloc event
enabled is not gathering any event. This issue applies to all tracepoint
events declared with a different name within LTTng than within the Linux
kernel.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: enable event error path memory corruption
Mathieu Desnoyers [Wed, 22 Jan 2014 20:15:52 +0000 (15:15 -0500)] 
Fix: enable event error path memory corruption

The call to

  kmem_cache_free(event_cache, event);

after setting event to ERR_PTR() value is causing memory corruption
(kernel oops). This bug has been introduced very recently by commit:

  Fix: provide more precise error report for enable event

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoUpdate kvm instrumentation to Linux 3.13
Mathieu Desnoyers [Mon, 20 Jan 2014 16:37:25 +0000 (11:37 -0500)] 
Update kvm instrumentation to Linux 3.13

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoUpdate sched instrumentation to Linux 3.13
Mathieu Desnoyers [Mon, 20 Jan 2014 16:31:30 +0000 (11:31 -0500)] 
Update sched instrumentation to Linux 3.13

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: provide more precise error report for enable event
Mathieu Desnoyers [Wed, 15 Jan 2014 17:37:25 +0000 (12:37 -0500)] 
Fix: provide more precise error report for enable event

Fixes #658

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: quote event name in metadata
Mathieu Desnoyers [Wed, 18 Dec 2013 18:47:52 +0000 (13:47 -0500)] 
Fix: quote event name in metadata

Allows adding events with a "-" within the name with --probe or
--function.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoAdd version info to lttng-tracer.ko modinfo
Mathieu Desnoyers [Tue, 17 Dec 2013 19:02:45 +0000 (14:02 -0500)] 
Add version info to lttng-tracer.ko modinfo

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoVersion 2.4.0-rc2 v2.4.0-rc2
Mathieu Desnoyers [Tue, 10 Dec 2013 19:14:49 +0000 (14:14 -0500)] 
Version 2.4.0-rc2

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: client_packet_header() uses wrong packet
Mathieu Desnoyers [Sat, 30 Nov 2013 10:46:10 +0000 (11:46 +0100)] 
Fix: client_packet_header() uses wrong packet

It should use lib_ring_buffer_read_offset_address() to get the packet
being read, rather than lib_ring_buffer_offset_address(), which is only
meant to be used when writing to the packet.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoCleanup: fix typo in ring buffer backend comment
Mathieu Desnoyers [Sat, 30 Nov 2013 10:45:22 +0000 (11:45 +0100)] 
Cleanup: fix typo in ring buffer backend comment

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: handle unknown event type parameter
Mathieu Desnoyers [Tue, 26 Nov 2013 00:40:44 +0000 (19:40 -0500)] 
Fix: handle unknown event type parameter

Skip to an error path if the event type is unknown.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoFix: eliminate timestamp overlap between packets
Mathieu Desnoyers [Sun, 24 Nov 2013 09:09:04 +0000 (04:09 -0500)] 
Fix: eliminate timestamp overlap between packets

By using the timestamp sampled at space reservation when the packet is
being filled as "end timestamp" for a packet, we can ensure there is no
overlap between packet timestamp ranges, so that packet timestamp end <=
following packets timestamp begin.

Overlap between consecutive packets becomes an issue when the end
timestamp of a packet is greater than the end timestamp of a following
packet, IOW a packet completely contains the timestamp range of a
following packet.  This kind of situation does not allow trace viewers
to do binary search within the packet timestamps. This kind of situation
will typically never occur if packets are significantly larger than
event size, but this fix ensures it can never even theoretically happen.

The only case where packets can still theoretically overlap is if they
have equal begin and end timestamps, which is valid.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agogcc blacklist: only apply when building with gcc
Mathieu Desnoyers [Sun, 24 Nov 2013 08:42:22 +0000 (03:42 -0500)] 
gcc blacklist: only apply when building with gcc

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoBlacklist ARM gcc 4.8.0, 4.8.1, 4.8.2
Mathieu Desnoyers [Sun, 24 Nov 2013 08:28:10 +0000 (03:28 -0500)] 
Blacklist ARM gcc 4.8.0, 4.8.1, 4.8.2

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoVersion 2.4.0-rc1 v2.4.0-rc1
Mathieu Desnoyers [Fri, 15 Nov 2013 18:55:35 +0000 (13:55 -0500)] 
Version 2.4.0-rc1

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoUpdate ext4 instrumentation to Linux 3.12
Mathieu Desnoyers [Mon, 4 Nov 2013 17:30:26 +0000 (12:30 -0500)] 
Update ext4 instrumentation to Linux 3.12

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoUpdate RCU instrumentation to Linux 3.12
Mathieu Desnoyers [Thu, 31 Oct 2013 14:25:01 +0000 (10:25 -0400)] 
Update RCU instrumentation to Linux 3.12

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoUpdate btrfs instrumentation to 3.12 kernel
Mathieu Desnoyers [Thu, 31 Oct 2013 14:22:22 +0000 (10:22 -0400)] 
Update btrfs instrumentation to 3.12 kernel

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoUpdate vmscan instrumentation to Linux 3.12
Mathieu Desnoyers [Thu, 31 Oct 2013 14:20:52 +0000 (10:20 -0400)] 
Update vmscan instrumentation to Linux 3.12

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoupdate: kmem instrumentation 3.12 kernel support
Mathieu Desnoyers [Thu, 31 Oct 2013 14:14:32 +0000 (10:14 -0400)] 
update: kmem instrumentation 3.12 kernel support

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agolttng-statedump-impl: Use generic hard irqs for Linux >= 3.12
Mathieu Desnoyers [Mon, 28 Oct 2013 12:11:00 +0000 (12:11 +0000)] 
lttng-statedump-impl: Use generic hard irqs for Linux >= 3.12

Quoting the original patch changelog from Otavio Salvador:

> The Linux kernel 3.12 uses the generic hard irqs system for all
> architectures and dropped the GENERIC_HARDIRQ option, as can be seen
> at the commit quoted below:
>
> ,----
> | commit 0244ad004a54e39308d495fee0a2e637f8b5c317
> | Author: Martin Schwidefsky <schwidefsky@de.ibm.com>
> | Date:   Fri Aug 30 09:39:53 2013 +0200
> |
> |     Remove GENERIC_HARDIRQ config option
> |
> |     After the last architecture switched to generic hard irqs the config
> |     options HAVE_GENERIC_HARDIRQS & GENERIC_HARDIRQS and the related code
> |     for !CONFIG_GENERIC_HARDIRQS can be removed.
> |
> |     Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
> `----

Introduce wrapper/irq.h to move the feature availability testing logic
into a specific wrapper header. It now tests if the kernel version is
>= 3.12 or if CONFIG_GENERIC_HARDIRQS is defined (for older kernels).
Introduce the lttng-specific CONFIG_LTTNG_HAS_LIST_IRQ to track
availability of this feature within LTTng.

Reported-by: Philippe Mangaud <r49081@freescale.com>
Reported-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agolttng-statedump-impl: Fix lttng_list_interrupts for empty implementation
Otavio Salvador [Sat, 26 Oct 2013 19:22:45 +0000 (17:22 -0200)] 
lttng-statedump-impl: Fix lttng_list_interrupts for empty implementation

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoImport fix from LTSI: 3.4+ RT kernels use CONFIG_PREEMPT_RT_FULL
Mathieu Desnoyers [Tue, 15 Oct 2013 12:14:14 +0000 (08:14 -0400)] 
Import fix from LTSI: 3.4+ RT kernels use CONFIG_PREEMPT_RT_FULL

Initial LTSI commit:

From: Paul Gortmaker <paul.gortmaker@windriver.com>
> fix reference to obsolete RT Kconfig variable.
>
> The preempt-rt patches no longer use CONFIG_PREEMPT_RT in
> the 3.4 (and newer) versions.  So even though LTSI doesn't
> include RT, having this define present can lead to an easy
> to overlook bug for anyone who does try to layer RT onto
> the LTSI baseline.
>
> Update it to use the currently used define name by RT.
>
> Reported-by: Jim Somerville <Jim.Somerville@windriver.com>
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>

Merged with kernel version checks for >= 3.4 to support both old and
newer kernels.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoAdd new tracepoint in KVM
Mohamad Gebai [Wed, 9 Oct 2013 01:49:32 +0000 (21:49 -0400)] 
Add new tracepoint in KVM

New tracepoint added in kvm: kvm_write_tsc_offset.

Signed-off-by: Mohamad Gebai <mohamad.gebai@polymtl.ca>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoBlacklist kernels 3.10.13 and 3.11.2
Mathieu Desnoyers [Fri, 27 Sep 2013 18:10:40 +0000 (14:10 -0400)] 
Blacklist kernels 3.10.13 and 3.11.2

It looks like my guessing on kernel version at which Greg will pull this
fix was wrong. It will probably appear in the next round of stable
releases.

The fix that needs to reach stable-3.10 and stable-3.11 before we can
remove those from the backlist:

commit 7bd36014460f793c19e7d6c94dab67b0afcfcb7f
Author: John Stultz <john.stultz@linaro.org>
Date:   Wed Sep 11 16:50:56 2013 -0700

    timekeeping: Fix HRTICK related deadlock from ntp lock changes

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
CC: John Stultz <john.stultz@linaro.org>
11 years agoLTTng trace-clock: shrink kernel blacklist
Mathieu Desnoyers [Thu, 19 Sep 2013 18:59:48 +0000 (13:59 -0500)] 
LTTng trace-clock: shrink kernel blacklist

The lockup fix has been pulled into Linux master as:

commit 7bd36014460f793c19e7d6c94dab67b0afcfcb7f
Author: John Stultz <john.stultz@linaro.org>
Date:   Wed Sep 11 16:50:56 2013 -0700

    timekeeping: Fix HRTICK related deadlock from ntp lock changes

Guessing the stable kernel versions in which this fix will appear in
3.10 and 3.11 stable. 3.12+ are OK.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: John Stultz <john.stultz@linaro.org>
11 years agoMetadata flush writes data from the cache
Julien Desfossez [Mon, 16 Sep 2013 15:18:33 +0000 (11:18 -0400)] 
Metadata flush writes data from the cache

When doing a flush on a metadata stream we first check if we can fill
the current subbuffer with data from the cache before doing the actual
flush.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoPer-stream ioctl to get the current timestamp
Julien Desfossez [Mon, 16 Sep 2013 15:18:32 +0000 (11:18 -0400)] 
Per-stream ioctl to get the current timestamp

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoLTTng ringbuffer ABI calls for index generation
Julien Desfossez [Mon, 16 Sep 2013 15:18:31 +0000 (11:18 -0400)] 
LTTng ringbuffer ABI calls for index generation

These new calls export the data required for the consumer to generate
the index while tracing :
- timestamp begin
- timestamp end
- events discarded
- context size
- packet size
- stream id

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>
11 years agoPrepare LTTng override of ring buffer fops
Julien Desfossez [Mon, 16 Sep 2013 15:18:30 +0000 (11:18 -0400)] 
Prepare LTTng override of ring buffer fops

This patch allows LTTng to override the file operations of the lib ring
buffer.
For now it does not provide any additional functions, but it prepares
the work of adding LTTng-specific ioctls to the ring buffer.

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>
11 years agoBlacklist Linux kernels 3.10+
Mathieu Desnoyers [Mon, 16 Sep 2013 16:10:04 +0000 (11:10 -0500)] 
Blacklist Linux kernels 3.10+

Linux kernels 3.10 and 3.11 introduce a deadlock in the timekeeping
subsystem. See
http://lkml.kernel.org/r/1378943457-27314-1-git-send-email-john.stultz@linaro.org
for details. Awaiting patch merge into Linux master, stable-3.10 and
stable-3.11 for fine-grained kernel version blacklisting.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoVersion 2.3.0 v2.3.0
Mathieu Desnoyers [Tue, 3 Sep 2013 21:55:10 +0000 (17:55 -0400)] 
Version 2.3.0

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoFix: metadata stream should not reference session
Mathieu Desnoyers [Tue, 3 Sep 2013 21:23:15 +0000 (17:23 -0400)] 
Fix: metadata stream should not reference session

The metadata stream should only reference the metadata cache, not the
session. Otherwise, we end up in a catch 22 situation:

- Stream POLLHUP is only given when the session is destroyed, but,
- The session is only destroyed when all references to session are
  released, including references from channels, but,
- If the metadata stream holds a reference on the metadata session, we
  end up with a circular dependency loop.

Fix this by making sure the metadata stream does not use any of the
lttng channel nor lttng session.

Reviewed-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoFix: btrfs: support 3.11 Linux kernel
Mathieu Desnoyers [Tue, 3 Sep 2013 14:25:00 +0000 (10:25 -0400)] 
Fix: btrfs: support 3.11 Linux kernel

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agostatedump: remove KERN_DEBUG messages
Mathieu Desnoyers [Tue, 3 Sep 2013 14:16:19 +0000 (10:16 -0400)] 
statedump: remove KERN_DEBUG messages

They appear to be shown by default in dmesg of many distributions, and
they don't add much value (noisy).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoFix: ext4: add missing tracepoints for 3.11 kernel
Mathieu Desnoyers [Tue, 3 Sep 2013 13:44:32 +0000 (09:44 -0400)] 
Fix: ext4: add missing tracepoints for 3.11 kernel

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoFix: ext4: Linux 3.11 support
Mathieu Desnoyers [Tue, 3 Sep 2013 04:38:17 +0000 (00:38 -0400)] 
Fix: ext4: Linux 3.11 support

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoFix: ext3: 3.11 Linux support
Mathieu Desnoyers [Tue, 3 Sep 2013 04:16:58 +0000 (00:16 -0400)] 
Fix: ext3: 3.11 Linux support

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoFix: statedump nsproxy 3.11 Linux support
Mathieu Desnoyers [Tue, 3 Sep 2013 04:12:34 +0000 (00:12 -0400)] 
Fix: statedump nsproxy 3.11 Linux support

Follow upstream Linux change introduced by:

commit c2b1df2eb42978073ec27c99cc199d20ae48b849
Author: Andy Lutomirski <luto@amacapital.net>
Date:   Thu Aug 22 11:39:16 2013 -0700

    Rename nsproxy.pid_ns to nsproxy.pid_ns_for_children

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoVersion 2.3.0-rc2 v2.3.0-rc2
Mathieu Desnoyers [Fri, 30 Aug 2013 18:41:31 +0000 (14:41 -0400)] 
Version 2.3.0-rc2

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoFix: metadata lttng channel refcount
Mathieu Desnoyers [Mon, 26 Aug 2013 14:13:06 +0000 (10:13 -0400)] 
Fix: metadata lttng channel refcount

The OOPS at bug #622 is likely caused by a missing reference on the
lttng channel structure, which could lead to accessing the object after
it has been destroyed if the lttng channel file descriptor is closed
while the metadata stream fd is still in use.

Fixes #622

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Acked-by: Julien Desfossez <jdesfossez@efficios.com>
11 years agoREADME: lttng-modules incompatible with lttng 0.x patchset
Mathieu Desnoyers [Thu, 8 Aug 2013 13:15:44 +0000 (09:15 -0400)] 
README: lttng-modules incompatible with lttng 0.x patchset

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoVersion 2.3.0-rc1 v2.3.0-rc1
Mathieu Desnoyers [Thu, 18 Jul 2013 01:37:26 +0000 (21:37 -0400)] 
Version 2.3.0-rc1

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoFix: kvm x86 probes side-effect
Mathieu Desnoyers [Thu, 18 Jul 2013 01:31:24 +0000 (21:31 -0400)] 
Fix: kvm x86 probes side-effect

ccflags-y += -I$(kvm_path)

was causing the lttng-ftrace probe to misbehave.

Fixes #591

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoFix: allow get/put subbuf in loop for metadata stream
Mathieu Desnoyers [Mon, 15 Jul 2013 15:26:06 +0000 (11:26 -0400)] 
Fix: allow get/put subbuf in loop for metadata stream

data_pending check can trigger the following sequence:

- get_next_subbuf
- put_subbuf
- get_next_subbuf
- put_subbuf
- get_next_subbuf
- put_subbuf
...

and then finally a thread would consume the data:

- get_next_subbuf
- put_next_subbuf

However, we don't want to populate data from the metadata cache into the
stream until put_next_subbuf is issued. Add a check to ensure that it is
not populated until required.

Also, disallow get_subbuf() ioctl on metadata channel: its random-access
semantic does not play well with serialization of the metadata cache on
demand.

Reviewed-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoAdd support for kvm x86 specific tracepoints
Mohamad Gebai [Mon, 8 Jul 2013 16:52:22 +0000 (12:52 -0400)] 
Add support for kvm x86 specific tracepoints

Two new probes for kvm-x86 and kvm-x86-mmu.

Signed-off-by: Mohamad Gebai <mohamad.gebai@polymtl.ca>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoAdd mainline headers for kvm x86 tracepoints
Mohamad Gebai [Mon, 8 Jul 2013 16:50:46 +0000 (12:50 -0400)] 
Add mainline headers for kvm x86 tracepoints

Signed-off-by: Mohamad Gebai <mohamad.gebai@polymtl.ca>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoRemove old 3.0.4 x86-64 extracted syscall info
Yannick Brosseau [Mon, 8 Jul 2013 16:46:32 +0000 (12:46 -0400)] 
Remove old 3.0.4 x86-64 extracted syscall info

Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoPoint the x86-64 overrides to newly extracted 3.10-rc7 files
Yannick Brosseau [Mon, 8 Jul 2013 16:45:56 +0000 (12:45 -0400)] 
Point the x86-64 overrides to newly extracted 3.10-rc7 files

Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoAdd syscalls extracted files from a 3.10-rc7 kernel
Yannick Brosseau [Mon, 8 Jul 2013 16:44:57 +0000 (12:44 -0400)] 
Add syscalls extracted files from a 3.10-rc7 kernel

This will add some previously unknown syscalls

Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoImprove documentation of the syscall extractor script
Yannick Brosseau [Mon, 8 Jul 2013 16:44:11 +0000 (12:44 -0400)] 
Improve documentation of the syscall extractor script

Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoFix: double length of __dynamic_len array
Mathieu Desnoyers [Fri, 5 Jul 2013 02:20:25 +0000 (22:20 -0400)] 
Fix: double length of __dynamic_len array

This is required by the newly introduced __dynamic_array_enc_ext_2() and
tp_memcpy_dyn_2().

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoFix printk instrumentation
Mathieu Desnoyers [Thu, 4 Jul 2013 19:46:20 +0000 (15:46 -0400)] 
Fix printk instrumentation

- Don't require 2kB of stack anymore (requiring so much kernel stack
  space should be considered as a bug in itself),
- Add support for 3.10 kernel printk instrumentation.

This patch uses "Introduce __dynamic_array_enc_ext_2() and
tp_memcpy_dyn_2()".

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoIntroduce __dynamic_array_enc_ext_2() and tp_memcpy_dyn_2()
Mathieu Desnoyers [Thu, 4 Jul 2013 19:45:20 +0000 (15:45 -0400)] 
Introduce __dynamic_array_enc_ext_2() and tp_memcpy_dyn_2()

Allow copying into a single variable-length buffer from two sources.
Needed to fix printk support for Linux kernel < 3.5.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoFix: ring buffer: get_subbuf() checks should be performed on "consumed" parameter
Mathieu Desnoyers [Wed, 3 Jul 2013 22:35:10 +0000 (18:35 -0400)] 
Fix: ring buffer: get_subbuf() checks should be performed on "consumed" parameter

This triggers lots of false-positive -EAGAIN errors in flight recorder
snapshots.

Reported-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoFix: SWITCH_FLUSH new sub-buffer checks
Mathieu Desnoyers [Mon, 1 Jul 2013 22:10:22 +0000 (18:10 -0400)] 
Fix: SWITCH_FLUSH new sub-buffer checks

The SWITCH_FLUSH, when performed on a completely empty sub-buffer, was
missing some checks (imported from space reservation).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoFix: ring buffer: handle concurrent update in nested buffer wrap around check
Mathieu Desnoyers [Mon, 1 Jul 2013 21:01:56 +0000 (17:01 -0400)] 
Fix: ring buffer: handle concurrent update in nested buffer wrap around check

With stress-test loads that trigger sub-buffer switch very frequently
(small 4kB sub-buffers, frequent flush), we currently observe this kind
of warnings once every few minutes:

[65335.896208] ring buffer relay-overwrite-mmap, cpu 5: records were lost. Caused by:
[65335.896208]   [ 0 buffer full, 1 nest buffer wrap-around, 0 event too big ]

It appears that the check for nested buffer wrap-around does not take
into account that a concurrent execution contexts (either nested for
per-cpu buffers, or from another CPU or nested for global buffers) can
update the commit_count value concurrently.

What we really want to do with this check is to ensure that if we enter
a sub-buffer that had an unbalanced reserve/commit count, assuming there
is no hope that this gets rebalanced promptly, we detect this and drop
the current event. However, in the case where the commit counter has
been concurrently updated by another reserve or a switch, we want to
retry the entire reserve operation.

One way to detect this is to sample the reserve offset twice, around the
commit counter read, along with the appropriate memory barriers.
Therefore, we can detect if the mismatch between reserve and commit
counter is actually caused by a concurrent update, which necessarily has
updated the reserve counter.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoCleanup: lib_ring_buffer_switch_new_end() only calls subbuffer_set_data_size()
Mathieu Desnoyers [Mon, 1 Jul 2013 17:23:11 +0000 (13:23 -0400)] 
Cleanup: lib_ring_buffer_switch_new_end() only calls subbuffer_set_data_size()

lib_ring_buffer_switch_new_end() is always called when an event exactly
fills a sub-buffer, which makes padding_size always 0. However, there is
one side-effect that lib_ring_buffer_switch_new_end() needs to have: it
calls subbuffer_set_data_size() to update the size of the data to be
read from the sub-buffer.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoRevert "Cleanup: ring buffer: remove lib_ring_buffer_switch_new_end()"
Mathieu Desnoyers [Sun, 30 Jun 2013 22:49:13 +0000 (18:49 -0400)] 
Revert "Cleanup: ring buffer: remove lib_ring_buffer_switch_new_end()"

This reverts commit 5fb66f07aae4884426f1706d0281bd242a38c2a7.

The equivalent UST commit of this change broke regression tests of
lttng-tools.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoFix: handle writes of length 0
Mathieu Desnoyers [Sun, 30 Jun 2013 21:38:50 +0000 (17:38 -0400)] 
Fix: handle writes of length 0

lib_ring_buffer_write(), lib_ring_buffer_memset() and
lib_ring_buffer_copy_from_user_inatomic() could be passed a length of 0.
This typically has no side-effect as far as writing into the buffers is
concerned, except for one detail: in overwrite mode, there is a check to
make sure the sub-buffer can be written into. This check is performed
even if length is 0. In the case where this would fall exactly at the
end of a sub-buffer, the check would fail, because the offset would fall
exactly at the beginning of the next sub-buffer.

It triggers this warning:

[65356.890016] ------------[ cut here ]------------
[65356.890016] WARNING: at /home/compudj/git/lttng-modules/wrapper/ringbuffer/../../lib/ringbuffer/../../wrapper/ringbuffer/../../lib/ringbuffer/backend.h:110 lttng_event_write+0x118/0x140 [lttng_ring_buffer_client_mmap_overwrite]()
[65356.890016] Hardware name: X7DAL
[65356.890016] Modules linked in: lttng_probe_writeback(O) lttng_probe_workqueue(O) lttng_probe_vmscan(O) lttng_probe_udp(O) lttng_probe_timer(O) lttng_probe_sunrpc(O) lttng_probe_statedump(O) lttng_probe_sock(O) lttng_probe_skb(O) lttng_probe_signal(O) lttng_probe_scsi(O) lttng_probe_sched(O) lttng_probe_rcu(O) lttng_probe_random(O) lttng_probe_printk(O) lttng_probe_power(O) lttng_probe_net(O) lttng_probe_napi(O) lttng_probe_module(O) lttng_probe_kvm(O) lttng_probe_kmem(O) lttng_probe_jbd2(O) lttng_probe_jbd(O) lttng_probe_irq(O) lttng_probe_ext4(O) lttng_probe_ext3(O) lttng_probe_compaction(O) lttng_probe_btrfs(O) lttng_probe_block(O) lttng_types(O) lttng_ring_buffer_metadata_mmap_client(O) lttng_ring_buffer_client_mmap_overwrite(O) lttng_ring_buffer_client_mmap_discard(O) lttng_ring_buffer_metadata_client(O) lttng_ring_buffer_client_overwrite(O) lttng_ring_buffer_client_discard(O) lttng_tracer(O) lttng_kretprobes(O) lttng_ftrace(O) lttng_kprobes(O) lttng_statedump(O) lttng_lib_ring_buffer(O) cpufreq_ondemand loop e1000e kvm_intel kvm ptp pps_core [last unloaded: lttng_lib_ring_buffer]
[65357.287529] Pid: 0, comm: swapper/7 Tainted: G           O 3.9.4-trace-test #143
[65357.309694] Call Trace:
[65357.317022]  <IRQ>  [<ffffffff8103a3ef>] warn_slowpath_common+0x7f/0xc0
[65357.336893]  [<ffffffff8103a44a>] warn_slowpath_null+0x1a/0x20
[65357.354368]  [<ffffffffa0ff17b8>] lttng_event_write+0x118/0x140 [lttng_ring_buffer_client_mmap_overwrite]
[65357.383025]  [<ffffffffa100134f>] __event_probe__block_rq_with_error+0x1bf/0x220 [lttng_probe_block]
[65357.410376]  [<ffffffff812ea134>] blk_update_request+0x324/0x720
[65357.428364]  [<ffffffff812ea561>] blk_update_bidi_request+0x31/0x90
[65357.447136]  [<ffffffff812eb68c>] blk_end_bidi_request+0x2c/0x80
[65357.465127]  [<ffffffff812eb6f0>] blk_end_request+0x10/0x20
[65357.481822]  [<ffffffff81406b7c>] scsi_io_completion+0x9c/0x670
[65357.499555]  [<ffffffff813fe320>] scsi_finish_command+0xb0/0xe0
[65357.517283]  [<ffffffff81406965>] scsi_softirq_done+0xa5/0x140
[65357.534758]  [<ffffffff812f1d30>] blk_done_softirq+0x80/0xa0
[65357.551710]  [<ffffffff81043b00>] __do_softirq+0xe0/0x440
[65357.567881]  [<ffffffff81043ffe>] irq_exit+0x9e/0xb0
[65357.582754]  [<ffffffff81026465>] smp_call_function_single_interrupt+0x35/0x40
[65357.604388]  [<ffffffff8167be2f>] call_function_single_interrupt+0x6f/0x80
[65357.624976]  <EOI>  [<ffffffff8100ac06>] ? default_idle+0x46/0x300
[65357.643541]  [<ffffffff8100ac04>] ? default_idle+0x44/0x300
[65357.660235]  [<ffffffff8100b899>] cpu_idle+0x89/0xe0
[65357.675109]  [<ffffffff81664911>] start_secondary+0x220/0x227

Always from an event that can write a 0-length field as last field of
its payload, and it always happen directly on a sub-buffer boundary.

While we are there, check for length 0 in lib_ring_buffer_read_cstr()
too.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoFix: ring buffer: RING_BUFFER_FLUSH ioctl buffer corruption
Mathieu Desnoyers [Sun, 30 Jun 2013 19:37:46 +0000 (15:37 -0400)] 
Fix: ring buffer: RING_BUFFER_FLUSH ioctl buffer corruption

lib_ring_buffer_switch_slow() clearly states:

 * Note, however, that as a v_cmpxchg is used for some atomic
 * operations, this function must be called from the CPU which owns the
 * buffer for a ACTIVE flush.

But unfortunately, the RING_BUFFER_FLUSH ioctl does not follow these
important directives. Therefore, whenever the consumer daemon or session
daemon explicitly triggers a "flush" on a buffer, it can race with data
being written to the buffer, leading to corruption of the reserve/commit
counters, and therefore corruption of data in the buffer. It triggers
these warnings for overwrite mode buffers:

[65356.890016] WARNING: at
/home/compudj/git/lttng-modules/wrapper/ringbuffer/../../lib/ringbuffer/../../wrapper/ringbuffer/../../lib/ringbuffer/backend.h:110 lttng_event_write+0x118/0x140 [lttng_ring_buffer_client_mmap_overwrite]()

Which indicates that we are trying to write into a sub-buffer for which
we don't have exclusive access. It also causes the following warnings to
show up:

[65335.896208] ring buffer relay-overwrite-mmap, cpu 5: records were lost. Caused by:
[65335.896208]   [ 0 buffer full, 80910 nest buffer wrap-around, 0 event too big ]

Which is caused by corrupted commit counter.

Fix this by sending an IPI to the CPU owning the flushed buffer for
per-cpu synchronization. For global synchronization, no IPI is needed,
since we allow writes from remote CPUs.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoCleanup: ring buffer: remove lib_ring_buffer_switch_new_end()
Mathieu Desnoyers [Sun, 30 Jun 2013 19:27:21 +0000 (15:27 -0400)] 
Cleanup: ring buffer: remove lib_ring_buffer_switch_new_end()

lib_ring_buffer_switch_new_end() is a leftover from the days where an
event that would exactly fill the current sub-buffer would automatically
trigger a sub-buffer switch into the next sub-buffer.

Even before the ring buffer code has been moved into lttng-modules, this
behavior had been changed: an event that exactly fills a sub-buffer only
fills this current sub-buffer, and does not need to switch into the
next one to populate the sub-buffer header. This change had been done so
periodical timer switch, which shares the same semantic as an event
exactly filling a sub-buffer, would not create tons of empty
sub-buffers.

However, when doing this change, lib_ring_buffer_switch_new_end() has
not been removed, but clearly should have been. Its job is now performed
by the event "commit".

lib_ring_buffer_switch_new_end() has no effect, since padding_size is
always 0.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoprint warning and return -EBUSY on double get_subbuf()
Mathieu Desnoyers [Wed, 26 Jun 2013 23:42:52 +0000 (19:42 -0400)] 
print warning and return -EBUSY on double get_subbuf()

Each get_subbuf() should be paired with a put_subbuf().

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoAdd header to fix compilation of syscalls-extractor on 3.9 kernel
Yannick Brosseau [Wed, 26 Jun 2013 19:18:10 +0000 (15:18 -0400)] 
Add header to fix compilation of syscalls-extractor on 3.9 kernel

Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoFix: don't do 0 byte event reservation
Mathieu Desnoyers [Wed, 26 Jun 2013 17:55:31 +0000 (13:55 -0400)] 
Fix: don't do 0 byte event reservation

Caused sequence of:

lttng create
lttng enable-event -k sched_switch
lttng start
lttng stop
lttng start
lttng stop

to hang on waiting for data......

Issue appeared in

commit d83004aa718065e5221d8ef4b99e4302b70b3df9
Author: Julien Desfossez <jdesfossez@efficios.com>
Date:   Thu Jun 6 16:38:48 2013 -0400

    Metadata cache and multiple metadata channels

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoDocument that payload size need to be greater than 0
Mathieu Desnoyers [Wed, 26 Jun 2013 17:54:18 +0000 (13:54 -0400)] 
Document that payload size need to be greater than 0

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoFix build and load against linux-2.6.33.x
Samuel Martin [Mon, 17 Jun 2013 14:28:51 +0000 (10:28 -0400)] 
Fix build and load against linux-2.6.33.x

* lttng-event.h declared but did not implement
  lttng_add_perf_counter_to_ctx on kernel >=2.6.33, the implementation
  was in lttng-context-perf-counters.c, which was only included for
  kernel >=2.6.34.  This prevented the module from being loaded.

* on kernel 2.6.33.x, lttng-context-perf-counters.c complains about
  implicit declaration for {get,put}_online_cpus and
  {,un}register_cpu_notifier; so fix header inclusion.

Signed-off-by: Samuel Martin <smartin@aldebaran-robotics.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoFix: add missing CONFIG_COMPAT around lib_ring_buffer_compat_ioctl
Mathieu Desnoyers [Thu, 6 Jun 2013 20:44:49 +0000 (16:44 -0400)] 
Fix: add missing CONFIG_COMPAT around lib_ring_buffer_compat_ioctl

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoMetadata cache and multiple metadata channels
Julien Desfossez [Thu, 6 Jun 2013 20:38:48 +0000 (16:38 -0400)] 
Metadata cache and multiple metadata channels

Implement a cache for the kernel metadata and a list of metadata
channels.

When new metadata is appended, all metadata channels are awakened so
they can return from poll and get the newly added metadata
This allows to request the metadata multiple times by creating multiple
metadata channels (useful for snapshots).

With this new feature, the poll and get_subbuf ring buffer operations
are now overridden by lttng-abi for the metadata channels, to check the
cache before doing these operations.

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