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>
Version 2.3.0-rc2

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
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>
Fix: ext3: 3.11 Linux support

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: ext4: Linux 3.11 support

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: ext4: add missing tracepoints for 3.11 kernel

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
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>
Fix: btrfs: support 3.11 Linux kernel

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
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>
Version 2.3.0

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>