lttng-modules.git
6 years agoCPU topology statedump on x86
Julien Desfossez [Fri, 26 Oct 2018 19:55:18 +0000 (15:55 -0400)] 
CPU topology statedump on x86

New statedump tracepoint to dump the active CPU/NUMA topology. This
allows to know which CPUs are SMT sibling or on the same socket. For now
only x86 is supported because all architectures has different fields.
The field "architecture" is statically defined and should be present in
all implementations so parsing tools know what content to expect.

Example output:
lttng_statedump_cpu_topology: { cpu_id = 3 }, { architecture = "x86",
cpu_id = 0, vendor = "GenuineIntel", family = 6, model = 142,
model_name = "Intel(R) Core(TM) i7-7600U CPU @ 2.80GHz",
physical_id = 0, core_id = 0, cores = 2 }

Signed-off-by: Julien Desfossez <jdesfossez@digitalocean.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: update kvm instrumentation for SLES12 SP2 LTSS >= 4.4.121-92.92
Michael Jeanson [Fri, 26 Oct 2018 22:01:17 +0000 (18:01 -0400)] 
Fix: update kvm instrumentation for SLES12 SP2 LTSS >= 4.4.121-92.92

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: Add missing const to lttng_tracepoint_ptr_deref prototype
Mathieu Desnoyers [Wed, 24 Oct 2018 19:43:49 +0000 (20:43 +0100)] 
Fix: Add missing const to lttng_tracepoint_ptr_deref prototype

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: adapt to kernel relative references
Mathieu Desnoyers [Fri, 12 Oct 2018 18:47:53 +0000 (14:47 -0400)] 
Fix: adapt to kernel relative references

Upstream Linux commit 46e0c9be20 introduces relative references in the
struct tracepoint array of pointers.

Up to (including) v4.19-rc7, the upstream kernel has a type mismatch bug
that allows it to pass an out-of-bound end of array to modules
coming/going notifiers.

The fix for upstream Linux is to introduce a new type: tracepoint_ptr_t,
which can be used to adequately iterate on the array. It is introduced
prior to v4.19 as commit 9c0be3f6b5d77 "tracepoint: Fix tracepoint array
element size mismatch".

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: sync event enablers before choosing header type
Mathieu Desnoyers [Wed, 17 Oct 2018 19:41:37 +0000 (15:41 -0400)] 
Fix: sync event enablers before choosing header type

On session start, we should allocate the event IDs before figuring
out the number of events per channel and select the proper header
type.

Without this, the number of events is always perceived to be 0,
which selects the "compact" header type. For a channel containing
many events (e.g. enable-event -k -a), this selects an inefficient
header type. With this fix, it selects the "large" header type,
which is more appropriate for a larger number of event IDs.

This will lead to a reduced trace throughput for tracing workloads
that have many events.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: implicit declarations caused by buffer size checks.
Francis Deslauriers [Tue, 16 Oct 2018 19:23:22 +0000 (15:23 -0400)] 
Fix: implicit declarations caused by buffer size checks.

Issue
=====
Three kernel functions used in the following commit are unavailable on
some supported kernels:

commit 1f0ab1eb0409d23de5f67cc588c3ea4cee4d10e0
Prevent allocation of buffers if exceeding available memory

* si_mem_available() was added in kernel 4.6 with commit d02bd27.
* {set, clear}_current_oom_origin() were added in kernel 3.8 with commit:
  e1e12d2f

Solution
========
Add wrappers around these functions such that older kernels will build
with these functions defined as NOP or trivial return value.

wrapper_check_enough_free_pages() uses the si_mem_available() kernel
function to compute if the number pages requested passed as parameter is
smaller than the number of pages available on the machine. If the
si_mem_available() kernel function is unavailable, we always return
true.

wrapper_set_current_oom_origin() function wraps the
set_current_oom_origin() kernel function when it is available.
If set_current_oom_origin() is unavailable the wrapper is empty.

wrapper_clear_current_oom_origin() function wraps the
clear_current_oom_origin() kernel function when it is available.
If clear_current_oom_origin() is unavailable the wrapper is empty.

Drawbacks
=========
None.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoPrevent allocation of buffers if exceeding available memory
Francis Deslauriers [Thu, 11 Oct 2018 21:37:00 +0000 (17:37 -0400)] 
Prevent allocation of buffers if exceeding available memory

Issue
=====
The running system can be rendered unusable by creating a channel
buffers larger than the available memory of the system, resulting in
random processes being killed by the OOM-killer.

These simple commands trigger the crash on my 15G of RAM laptop:
  lttng create
  lttng enable-channel -k --subbuf-size=16G --num-subbuf=1 chan0

Note that the subbuf-size * num-subbuf is larger than the physical
memory.

Solution
========
Get an estimate of the number of available pages and return ENOMEM if
there are not enough pages to cover the needs of the caller. Also, mark
the calling user thread as the first target for the OOM killer in case
the estimate of available pages was wrong.

This greatly reduces the attack surface of this issue as well as reducing
its potential impact.

This approach is inspired by the one taken by the Linux kernel
trace ring buffer[1].

Drawback
========
This approach is imperfect because it's based on an estimate.

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/kernel/trace/ring_buffer.c#n1172

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: btrfs instrumentation namespacing
Mathieu Desnoyers [Fri, 12 Oct 2018 19:02:06 +0000 (15:02 -0400)] 
Fix: btrfs instrumentation namespacing

Triggers this warning:

[   47.922818] WARNING: CPU: 29 PID: 1163 at /home/efficios/git/lttng-modules/lttng-probes.c:83 fixup_lazy_probes+0x1fb/0x210 [lttng_tracer]
[   47.951661] Modules linked in: lttng_probe_compaction(O+) lttng_probe_btrfs(O) lttng_probe_block(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_statedump(O) lttng_ftrace(O) lttng_kprobes(O) lttng_clock(O) lttng_uprobes(O) lttng_lib_ring_buffer(O) lttng_kretprobes(O)
[   48.039200] CPU: 29 PID: 1163 Comm: modprobe Tainted: G           O      4.19.0-rc7+ #19
[   48.055628] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
[   48.078273] RIP: 0010:fixup_lazy_probes+0x1fb/0x210 [lttng_tracer]
[   48.092257] Code: 01 48 39 d0 76 24 43 80 3c 3a 5f 75 1d 44 8b 44 24 14 4c 8b 4c 24 08 41 83 c0 01 45 39 45 10 0f 86 7a fe ff ff e9 6c ff ff ff <0f> 0b e9 6e fe ff ff 0f 1f 40 00 66 2e 0f 1f 84 00 00 00 00 00 0f
[   48.141947] RSP: 0018:ffffafe74777bc40 EFLAGS: 00010286
[   48.153733] RAX: 00000000ffffffff RBX: dead000000000200 RCX: 0000000000000061
[   48.173986] RDX: 0000000000000005 RSI: ffffffffc04b728c RDI: ffffffffc04b74a5
[   48.193595] RBP: dead000000000100 R08: 0000000000000062 R09: ffffffffc04bd040
[   48.211573] R10: ffffffffc04b74a5 R11: ffffffff920e204d R12: ffffffffffffffff
[   48.232131] R13: ffffffffc04bd000 R14: ffffffffc03f0078 R15: 0000000000000005
[   48.246832] FS:  00007f5495093540(0000) GS:ffff8fcf0fb40000(0000) knlGS:0000000000000000
[   48.267475] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   48.280348] CR2: 00007ffde00f8328 CR3: 00000018078a2001 CR4: 00000000001606e0
[   48.302404] Call Trace:
[   48.309201]  lttng_probe_register+0xd5/0xe0 [lttng_tracer]
[   48.326993]  ? __event_probe__compaction_isolate_template+0x2c0/0x2c0 [lttng_probe_compaction]
[   48.345702]  do_one_initcall+0x46/0x1c8
[   48.360147]  ? kobject_uevent_env+0x117/0x810
[   48.370388]  ? _cond_resched+0x15/0x40
[   48.380649]  ? kmem_cache_alloc_trace+0x153/0x1c0
[   48.394706]  do_init_module+0x5b/0x20b
[   48.404412]  load_module+0x2194/0x2980
[   48.418759]  ? ima_post_read_file+0xe2/0x120
[   48.427716]  ? __do_sys_finit_module+0xe9/0x110
[   48.438226]  __do_sys_finit_module+0xe9/0x110
[   48.452983]  do_syscall_64+0x65/0x190
[   48.461521]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[   48.473173] RIP: 0033:0x7f5494ba6839
[   48.486630] Code: 00 f3 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 1f f6 2c 00 f7 d8 64 89 01 48
[   48.529108] RSP: 002b:00007ffde00fb408 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
[   48.549652] RAX: ffffffffffffffda RBX: 000055d326ee2ac0 RCX: 00007f5494ba6839
[   48.564325] RDX: 0000000000000000 RSI: 000055d326cbac2e RDI: 0000000000000005
[   48.582576] RBP: 000055d326cbac2e R08: 0000000000000000 R09: 000055d326ee2ac0
[   48.596892] R10: 0000000000000005 R11: 0000000000000246 R12: 0000000000000000
[   48.617576] R13: 000055d326ee2d80 R14: 0000000000040000 R15: 000055d326ee2ac0
[   48.633713] ---[ end trace c265591e0ada440c ]---

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: Convert rcu tracepointis to gp_seq (v4.19)
Michael Jeanson [Wed, 10 Oct 2018 18:17:46 +0000 (14:17 -0400)] 
Fix: Convert rcu tracepointis to gp_seq (v4.19)

See upstream commits :

  commit 477351f7829d2268769c5d545511081555066529
  Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
  Date:   Tue May 1 12:54:11 2018 -0700

    rcu: Convert rcu_grace_period tracepoint to gp_seq

    This commit makes the rcu_grace_period tracepoint use gp_seq instead
    of ->gpnum or ->completed.  It also introduces a "cpuofl-bgp" string to
    less obscurely indicate when a CPU has gone offline while a grace period
    is waiting on it.

  commit 63d86a7e85f84b8ac3b2f394570965aedbb03787
  Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
  Date:   Tue May 1 13:08:46 2018 -0700

    rcu: Convert rcu_grace_period_init tracepoint to gp_seq

    This commit makes the rcu_grace_period_init tracepoint use gp_seq instead
    of ->gpnum.

  commit 598ce09480efb6b48799df60c66bac70bea5ef54
  Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
  Date:   Tue May 1 13:35:20 2018 -0700

    rcu: Convert rcu_preempt_task tracepoint to ->gp_seq

    This commit makes the rcu_preempt_task tracepoint use ->gp_seq instead
    of ->gpnum.

  commit 865aa1e08d8aefdfd1f5d30ecfce1b8ef8cd520a
  Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
  Date:   Tue May 1 13:35:20 2018 -0700

    rcu: Convert rcu_unlock_preempted_task tracepoint to ->gp_seq

    This commit makes the rcu_unlock_preempted_task tracepoint use ->gp_seq
    instead of ->gpnum.

  commit db023296f0115d2fe01fdabad54678f2b806da23
  Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
  Date:   Tue May 1 13:35:20 2018 -0700

    rcu: Convert rcu_quiescent_state_report tracepoint to ->gp_seq

    This commit makes the rcu_quiescent_state_report tracepoint use ->gp_seq
    instead of ->gpnum.

  commit fee5997c17562e95fb1fecc142efb2da0934baa4
  Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
  Date:   Tue May 1 13:35:20 2018 -0700

    rcu: Convert rcu_fqs tracepoint to ->gp_seq

    This commit makes the rcu_fqs tracepoint use ->gp_seq instead of ->gpnum.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: tracing: Centralize preemptirq tracepoints (4.19)
Michael Jeanson [Fri, 7 Sep 2018 16:21:13 +0000 (12:21 -0400)] 
Fix: tracing: Centralize preemptirq tracepoints (4.19)

See upstream commit:

  commit c3bc8fd637a9623f5c507bd18f9677effbddf584
  Author: Joel Fernandes (Google) <joel@joelfernandes.org>
  Date:   Mon Jul 30 15:24:23 2018 -0700

    tracing: Centralize preemptirq tracepoints and unify their usage

    This patch detaches the preemptirq tracepoints from the tracers and
    keeps it separate.

    Advantages:
    * Lockdep and irqsoff event can now run in parallel since they no longer
    have their own calls.

    * This unifies the usecase of adding hooks to an irqsoff and irqson
    event, and a preemptoff and preempton event.
      3 users of the events exist:
      - Lockdep
      - irqsoff and preemptoff tracers
      - irqs and preempt trace events

    The unification cleans up several ifdefs and makes the code in preempt
    tracer and irqsoff tracers simpler. It gets rid of all the horrific
    ifdeferry around PROVE_LOCKING and makes configuration of the different
    users of the tracepoints more easy and understandable. It also gets rid
    of the time_* function calls from the lockdep hooks used to call into
    the preemptirq tracer which is not needed anymore. The negative delta in
    lines of code in this patch is quite large too.

    In the patch we introduce a new CONFIG option PREEMPTIRQ_TRACEPOINTS
    as a single point for registering probes onto the tracepoints. With
    this,
    the web of config options for preempt/irq toggle tracepoints and its
    users becomes:

     PREEMPT_TRACER   PREEMPTIRQ_EVENTS  IRQSOFF_TRACER PROVE_LOCKING
           |                 |     \         |           |
           \    (selects)    /      \        \ (selects) /
          TRACE_PREEMPT_TOGGLE       ----> TRACE_IRQFLAGS
                          \                  /
                           \ (depends on)   /
                         PREEMPTIRQ_TRACEPOINTS

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: net: expose sk wmem in sock_exceed_buf_limit tracepoint (4.19)
Michael Jeanson [Fri, 7 Sep 2018 16:21:12 +0000 (12:21 -0400)] 
Fix: net: expose sk wmem in sock_exceed_buf_limit tracepoint (4.19)

See upstream commit:

  commit d6f19938eb031ee2158272757db33258153ae59c
  Author: Yafang Shao <laoar.shao@gmail.com>
  Date:   Sun Jul 1 23:31:30 2018 +0800

    net: expose sk wmem in sock_exceed_buf_limit tracepoint

    Currently trace_sock_exceed_buf_limit() only show rmem info,
    but wmem limit may also be hit.
    So expose wmem info in this tracepoint as well.

    Regarding memcg, I think it is better to introduce a new tracepoint(if
    that is needed), i.e. trace_memcg_limit_hit other than show memcg info in
    trace_sock_exceed_buf_limit.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: access migrate_disable field directly
Jonathan Rajotte [Wed, 19 Sep 2018 21:48:49 +0000 (17:48 -0400)] 
Fix: access migrate_disable field directly

For stable real time kernel > 4.9, the __migrate_disabled utility symbol
is not always exported. This can result in linking problem at build time
and runtime, preventing the loading of the tracer.

The problem was reported to the RT community. [1] [2]

A solution is to access the field directly instead of using the
utility wrapper.

It is important to note that the field is now available for other
configurations than CONFIG_PREEMPT_RT_FULL. For now, we choose to
expose the migratable context only for configurations where
CONFIG_PREEMPT_RT_FULL is set.

Based on the configuration dependency of the kernels, selecting
CONFIG_PREEMPT_RT_FULL ensures the presence of the migrate_disable
field.

Initial bug report [3].

[1] https://marc.info/?l=linux-rt-users&m=153730414126984&w=2
[2] https://marc.info/?l=linux-rt-users&m=153729444223779&w=2
[3] https://lists.lttng.org/pipermail/lttng-dev/2018-September/028216.html

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: out of memory error handling
Mathieu Desnoyers [Fri, 7 Sep 2018 21:55:32 +0000 (17:55 -0400)] 
Fix: out of memory error handling

CPU hotplug handles teardown on failure to complete adding an instance
of CPU hotplug. Trying to remove after a failed "add" on that instance
triggers a NULL pointer dereference OOPS.

Fixes: #1167
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: uprobes: missing break in lttng_event_ioctl()
Mathieu Desnoyers [Thu, 30 Aug 2018 15:50:33 +0000 (11:50 -0400)] 
Fix: uprobes: missing break in lttng_event_ioctl()

Found by Coverity:

** CID 1395322:  Control flow issues  (MISSING_BREAK)
/lttng-abi.c: 1465 in lttng_event_ioctl()

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: ACCESS_ONCE was removed in 4.15, use READ_ONCE instead
Francis Deslauriers [Thu, 30 Aug 2018 01:36:47 +0000 (21:36 -0400)] 
Fix: ACCESS_ONCE was removed in 4.15, use READ_ONCE instead

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: instruction pointer has different names across arch
Francis Deslauriers [Wed, 29 Aug 2018 16:49:59 +0000 (12:49 -0400)] 
Fix: instruction pointer has different names across arch

Different terms are used to refer to the instruction pointer depending
on the CPU architecture.

For example:
x86 -> ip
powerpc -> nip
RISC-V -> sepc
ARM -> ARM_pc
Microblaze -> pc

To fix this issue, we use the instruction_pointer() kernel function
(or macro depending on the arch) to get the right field in the pt_regs
struct for the current architecture.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: build failures when CONFIG_UPROBES is absent
Francis Deslauriers [Wed, 29 Aug 2018 15:45:49 +0000 (11:45 -0400)] 
Fix: build failures when CONFIG_UPROBES is absent

Problems
========
- There is a typo in the struct name of the parameters of stub version
  of the lttng_uprobes_add_callsite function,
- We are building the lttng-uprobes.o object file even when
  CONFIG_UPROBES is absent.

Both of these are causing build errors.

Fixes
=====
- Replace struct lttng_kernel_callsite_uprobe by struct
  lttng_kernel_event_callsite,
- Only add the lttng-uprobes.o object file to the needed artefacts if
  CONFIG_UPROBES is present.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agouprobe: Support multiple call sites for the same uprobe event
Francis Deslauriers [Tue, 14 Nov 2017 19:23:11 +0000 (14:23 -0500)] 
uprobe: Support multiple call sites for the same uprobe event

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agouprobe: Receive file descriptor from session instead of path to file
Francis Deslauriers [Tue, 27 Jun 2017 20:23:27 +0000 (16:23 -0400)] 
uprobe: Receive file descriptor from session instead of path to file

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agouprobe: Mark uprobe event as registered
Francis Deslauriers [Thu, 15 Jun 2017 17:40:35 +0000 (13:40 -0400)] 
uprobe: Mark uprobe event as registered

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoAdd uprobes support
Yannick Brosseau [Mon, 12 Sep 2016 19:00:12 +0000 (15:00 -0400)] 
Add uprobes support

The added support is basic. It create an event with no data associated
to the file path + offset specified.

Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: adjust SLE version ranges to build with SP2 and SP3
Michael Jeanson [Thu, 9 Aug 2018 15:55:32 +0000 (11:55 -0400)] 
Fix: adjust SLE version ranges to build with SP2 and SP3

The early kernel versions of SuSE 12 SP3 overlap with the range from the
later SP2 kernels but are from a different source trees. This patch adds
specific ranges for the SP3 kernels that overlap and allows compatibility
with both SP2 and SP3 kernels.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: Allow alphanumeric characters in SLE version
Michael Jeanson [Thu, 9 Aug 2018 15:55:31 +0000 (11:55 -0400)] 
Fix: Allow alphanumeric characters in SLE version

Allow alphanumeric characters in the long version string before
extracting specific version numbers. This prevents failure in detecting
a SuSE kernel when the version string was customized by the end user.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: Adjust range for SuSE 4.4.103-92 kernels
Michael Jeanson [Thu, 2 Aug 2018 18:34:30 +0000 (14:34 -0400)] 
Fix: Adjust range for SuSE 4.4.103-92 kernels

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoCleanup: move to kernel style SPDX license identifiers
Michael Jeanson [Fri, 29 Jun 2018 21:28:33 +0000 (17:28 -0400)] 
Cleanup: move to kernel style SPDX license identifiers

The SPDX identifier is a legally binding shorthand, which can be used instead
of the full boiler plate text. According to kernel documentation it has
to be inserted on the first or second line of a file.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoCleanup: move scripts to subdirectory
Michael Jeanson [Fri, 29 Jun 2018 21:28:32 +0000 (17:28 -0400)] 
Cleanup: move scripts to subdirectory

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoCleanup: modinfo keys
Michael Jeanson [Fri, 29 Jun 2018 21:28:31 +0000 (17:28 -0400)] 
Cleanup: modinfo keys

Remove duplicates keys, add missing keys, add missing information and
fix the description of some modules.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoAdd extra version information framework
Michael Jeanson [Fri, 29 Jun 2018 21:28:30 +0000 (17:28 -0400)] 
Add extra version information framework

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoRevert "Add btrfs file item tracepoints"
Mathieu Desnoyers [Wed, 27 Jun 2018 16:42:52 +0000 (12:42 -0400)] 
Revert "Add btrfs file item tracepoints"

This reverts commit b42b2955e13153b7283f20613f15fe98e6427baf.

It introduces the following warnings:

>>> depmod: WARNING: /lib/modules/4.18.0-rc1+/extra/probes/lttng-probe-btrfs.ko
>>> needs unknown symbol btrfs_get_token_32
>>> depmod: WARNING: /lib/modules/4.18.0-rc1+/extra/probes/lttng-probe-btrfs.ko
>>> needs unknown symbol btrfs_get_token_8
>>> depmod: WARNING: /lib/modules/4.18.0-rc1+/extra/probes/lttng-probe-btrfs.ko
>>> needs unknown symbol btrfs_get_token_16
>>> depmod: WARNING: /lib/modules/4.18.0-rc1+/extra/probes/lttng-probe-btrfs.ko
>>> needs unknown symbol btrfs_get_token_64
>>> make[1]: Leaving directory `/home/efficios/git/linux-percpu-dev'

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: btrfs: Remove unnecessary fs_info parameter
Michael Jeanson [Mon, 18 Jun 2018 18:53:19 +0000 (14:53 -0400)] 
Fix: btrfs: Remove unnecessary fs_info parameter

See upstream commit:

  commit 3dca5c942dac60164e6a6e89172f25b86af07ce7
  Author: Qu Wenruo <wqu@suse.com>
  Date:   Thu Apr 26 14:24:25 2018 +0800

    btrfs: trace: Remove unnecessary fs_info parameter for btrfs__reserve_extent event class

    fs_info can be extracted from btrfs_block_group_cache, and all
    btrfs_block_group_cache is created by btrfs_create_block_group_cache()
    with fs_info initialized, no need to worry about NULL pointer
    dereference.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: btrfs: use fs_info for btrfs_handle_em_exist tracepoint
Michael Jeanson [Mon, 18 Jun 2018 18:53:18 +0000 (14:53 -0400)] 
Fix: btrfs: use fs_info for btrfs_handle_em_exist tracepoint

See upstream commit:

  commit f46b24c9457143a367c6707eac82d546e2bcf280
  Author: David Sterba <dsterba@suse.com>
  Date:   Tue Apr 3 21:45:57 2018 +0200

    btrfs: use fs_info for btrfs_handle_em_exist tracepoint

    We really want to know to which filesystem the extent map events belong,
    but as it cannot be reached from the extent_map pointers, we need to
    pass it down the callchain.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: asoc: Remove snd_soc_cache_sync() implementation
Michael Jeanson [Mon, 18 Jun 2018 18:53:17 +0000 (14:53 -0400)] 
Fix: asoc: Remove snd_soc_cache_sync() implementation

See upstream commit:

  commit 427d204c86e095bb91eb8af381bd90a48376a860
  Author: Lars-Peter Clausen <lars@metafoo.de>
  Date:   Sat Nov 8 16:38:07 2014 +0100

    ASoC: Remove snd_soc_cache_sync() implementation

    This function has no more non regmap user, which means we can remove the
    implementation of the function and associated functions and structure
    fields.

    For convenience we keep a static inline version of the function that
    forwards calls to regcache_sync() unconditionally.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: asoc: fix printing jack name
Michael Jeanson [Mon, 18 Jun 2018 18:53:16 +0000 (14:53 -0400)] 
Fix: asoc: fix printing jack name

See upstream commit:

  commit f4833a519aec793cf8349bf479589d37473ef6a7
  Author: Arnd Bergmann <arnd@arndb.de>
  Date:   Wed Feb 24 17:38:14 2016 +0100

    ASoC: trace: fix printing jack name

    After a change to the snd_jack structure, the 'name' member
    is no longer available in all configurations, which results in a
    build failure in the tracing code:

    include/trace/events/asoc.h: In function 'trace_event_raw_event_snd_soc_jack_report':
    include/trace/events/asoc.h:240:32: error: 'struct snd_jack' has no member named 'name'

    The name field is normally initialized from the card shortname and
    the jack "id" field:

            snprintf(jack->name, sizeof(jack->name), "%s %s",
                     card->shortname, jack->id);

    This changes the tracing output to just contain the 'id' by
    itself, which slightly changes the output format but avoids the
    link error and is hopefully still enough to see what is going on.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: asoc: Consolidate path trace events
Michael Jeanson [Mon, 18 Jun 2018 18:53:15 +0000 (14:53 -0400)] 
Fix: asoc: Consolidate path trace events

See upstream commit:

  commit 6e588a0d839b51bae49852b68740a25cacc91978
  Author: Lars-Peter Clausen <lars@metafoo.de>
  Date:   Tue Aug 11 21:38:01 2015 +0200

    ASoC: dapm: Consolidate path trace events

    The snd_soc_dapm_input_path and snd_soc_dapm_output_path trace events are
    identical except for the direction. Instead of having two events have a
    single one that has a field that contains the direction.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: ASoC level IO tracing removed upstream
Michael Jeanson [Mon, 18 Jun 2018 18:53:14 +0000 (14:53 -0400)] 
Fix: ASoC level IO tracing removed upstream

Removed in v3.16.

See upstream commits:

  Author: Lars-Peter Clausen <lars@metafoo.de>
  Date:   Tue Apr 22 13:23:17 2014 +0200

    ASoC: Remove ASoC level IO tracing

    The ASoC framework is in the process of migrating all IO operations to regmap.
    regmap has its own more sophisticated tracing infrastructure for IO operations,
    which means that the ASoC level IO tracing becomes redundant, hence this patch
    removes them. There are still a handful of ASoC drivers left that do not use
    regmap yet, but hopefully the removal of the ASoC IO tracing will be an
    additional incentive to switch to regmap.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoEnable userspace callstack contexts only on x86
Francis Deslauriers [Thu, 7 Jun 2018 18:48:04 +0000 (14:48 -0400)] 
Enable userspace callstack contexts only on x86

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoPrevent re-entrancy in callstack-user context
Francis Deslauriers [Mon, 29 May 2017 19:32:04 +0000 (15:32 -0400)] 
Prevent re-entrancy in callstack-user context

Userspace callstack context often triggers kernel pagefaults that can be
traced by the kernel tracer which might then attempt to gather the
userspace callstack again... This recursion will be stop by the
RING_BUFFER_MAX_NESTING check but will still pollute the traces with
redundant information.

To prevent this, check if the tracer is already gathering the userspace
callstack and if it's the case don't record it again.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoCallstack context: bump number of entries to 128
Mathieu Desnoyers [Sun, 25 Oct 2015 16:02:24 +0000 (12:02 -0400)] 
Callstack context: bump number of entries to 128

Use a limit that fits in a 4096 bytes page on a 64-bit system. The only
reason for the prior 25 entries limitation was a bug in the header size
calculation (now fixed).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: callstack context alignment calculation
Mathieu Desnoyers [Sun, 25 Oct 2015 15:21:32 +0000 (11:21 -0400)] 
Fix: callstack context alignment calculation

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoCleanup callstack context
Mathieu Desnoyers [Sat, 24 Oct 2015 09:25:52 +0000 (05:25 -0400)] 
Cleanup callstack context

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix callstack context: write empty sequence if no stack trace
Mathieu Desnoyers [Sat, 24 Oct 2015 08:57:44 +0000 (04:57 -0400)] 
Fix callstack context: write empty sequence if no stack trace

The trace content needs to match the metadata, else the trace will be
corrupted.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: callstack context: false-sharing, bad memory size allocation
Mathieu Desnoyers [Sat, 24 Oct 2015 08:48:11 +0000 (04:48 -0400)] 
Fix: callstack context: false-sharing, bad memory size allocation

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agocallstack context: use delimiter when stack is incomplete
Mathieu Desnoyers [Sat, 24 Oct 2015 08:17:44 +0000 (04:17 -0400)] 
callstack context: use delimiter when stack is incomplete

Reverse the delimiter logic so we only consume trace space and pollute
the user output when the stack is incomplete.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoCleanup callstack context
Mathieu Desnoyers [Sat, 24 Oct 2015 07:42:10 +0000 (03:42 -0400)] 
Cleanup callstack context

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoAdd kernel and user callstack contexts
Francis Giraldeau [Wed, 17 Jul 2013 21:05:20 +0000 (17:05 -0400)] 
Add kernel and user callstack contexts

Signed-off-by: Francis Giraldeau <francis.giraldeau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoAssign CPU id before saving the context size
Francis Deslauriers [Tue, 30 May 2017 15:53:35 +0000 (11:53 -0400)] 
Assign CPU id before saving the context size

The callstack contexts will use the CPU id to save per-CPU data so this
field needs to be set before calling the get_size function of this
context.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoDefine max nesting count constant
Francis Giraldeau [Wed, 3 Sep 2014 19:47:21 +0000 (15:47 -0400)] 
Define max nesting count constant

Extract the constant within the code as #define. The define is added to
frontend.h in order to be included in other source files.

Signed-off-by: Francis Giraldeau <francis.giraldeau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoCompute variable sized context length
Francis Deslauriers [Tue, 30 May 2017 15:50:18 +0000 (11:50 -0400)] 
Compute variable sized context length

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoPass arguments for context size computation
Francis Giraldeau [Wed, 27 Aug 2014 19:52:14 +0000 (15:52 -0400)] 
Pass arguments for context size computation

Pass same arguments to get_size_arg() than to record(). This new
operation has the same effect than get_size(), and the client code can
implement either one.

Signed-off-by: Francis Giraldeau <francis.giraldeau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoAdd 9p probe
Michael Jeanson [Thu, 7 Jun 2018 19:49:11 +0000 (15:49 -0400)] 
Add 9p probe

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoUpdate delayed ref tracepoints for v3.12
Michael Jeanson [Thu, 7 Jun 2018 19:48:32 +0000 (15:48 -0400)] 
Update delayed ref tracepoints for v3.12

In v3.12 'btrfs_delayed_tree_ref' was split in 2 tracepoints and the
name was kept as an event class which did not trigger a build failure.

See upstream commit:

  commit 599c75ec3f7f3b606e8a0a684c00f12190712de8
  Author: Liu Bo <bo.li.liu@oracle.com>
  Date:   Tue Jul 16 19:03:36 2013 +0800

    Btrfs/tracepoint: update delayed ref tracepoints

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

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoAdd btrfs file item tracepoints
Michael Jeanson [Thu, 7 Jun 2018 19:48:31 +0000 (15:48 -0400)] 
Add btrfs file item tracepoints

See upstream commit:

  commit 09ed2f165cb3449237dec842b3564044e12d22cb
  Author: Liu Bo <bo.li.liu@oracle.com>
  Date:   Fri Mar 10 11:09:48 2017 -0800

    Btrfs: add file item tracepoints

    While debugging truncate problems, I found that these tracepoints could
    help us quickly know what went wrong.

    Two sets of tracepoints are created to track regular/prealloc file item
    and inline file item respectively, I put inline as a separate one since
    what inline file items cares about are way less than the regular one.

    This adds four tracepoints:
    - btrfs_get_extent_show_fi_regular
    - btrfs_get_extent_show_fi_inline
    - btrfs_truncate_show_fi_regular
    - btrfs_truncate_show_fi_inline

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoAdd btrfs tracepoint for em's EEXIST case
Michael Jeanson [Thu, 7 Jun 2018 19:48:30 +0000 (15:48 -0400)] 
Add btrfs tracepoint for em's EEXIST case

See upstream commits:

  commit 393da91819e35af538ef97c7c6a04899e2fbfe0e
  Author: Liu Bo <bo.li.liu@oracle.com>
  Date:   Fri Jan 5 12:51:16 2018 -0700

    Btrfs: add tracepoint for em's EEXIST case

    This is adding a tracepoint 'btrfs_handle_em_exist' to help debug the
    subtle bugs around merge_extent_mapping.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: dyntick field added to trace_rcu_dyntick in v4.16
Michael Jeanson [Thu, 7 Jun 2018 19:32:49 +0000 (15:32 -0400)] 
Fix: dyntick field added to trace_rcu_dyntick in v4.16

See upstream commit:

  commit dec98900eae1e22467182e58688abe5fae98bd5f
  Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
  Date:   Wed Oct 4 16:24:29 2017 -0700

    rcu: Add ->dynticks field to rcu_dyntick trace event

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: BUILD_BUG_ON with compile time constant on < v2.6.38
Michael Jeanson [Thu, 7 Jun 2018 16:24:28 +0000 (12:24 -0400)] 
Fix: BUILD_BUG_ON with compile time constant on < v2.6.38

See upstream commits :

  commit 8c87df457cb58fe75b9b893007917cf8095660a0
  Author: Jan Beulich <JBeulich@novell.com>
  Date:   Tue Sep 22 16:43:52 2009 -0700

    BUILD_BUG_ON(): fix it and a couple of bogus uses of it

    gcc permitting variable length arrays makes the current construct used for
    BUILD_BUG_ON() useless, as that doesn't produce any diagnostic if the
    controlling expression isn't really constant.  Instead, this patch makes
    it so that a bit field gets used here.  Consequently, those uses where the
    condition isn't really constant now also need fixing.

    Note that in the gfp.h, kmemcheck.h, and virtio_config.h cases
    MAYBE_BUILD_BUG_ON() really just serves documentation purposes - even if
    the expression is compile time constant (__builtin_constant_p() yields
    true), the array is still deemed of variable length by gcc, and hence the
    whole expression doesn't have the intended effect.

  commit 7ef88ad561457c0346355dfd1f53e503ddfde719
  Author: Rusty Russell <rusty@rustcorp.com.au>
  Date:   Mon Jan 24 14:45:10 2011 -0600

    BUILD_BUG_ON: make it handle more cases

    BUILD_BUG_ON used to use the optimizer to do code elimination or fail
    at link time; it was changed to first the size of a negative array (a
    nicer compile time error), then (in
    8c87df457cb58fe75b9b893007917cf8095660a0) to a bitfield.

    This forced us to change some non-constant cases to MAYBE_BUILD_BUG_ON();
    as Jan points out in that commit, it didn't work as intended anyway.

    bitfields: needs a literal constant at parse time, and can't be put under
            "if (__builtin_constant_p(x))" for example.
    negative array: can handle anything, but if the compiler can't tell it's
            a constant, silently has no effect.
    link time: breaks link if the compiler can't determine the value, but the
            linker output is not usually as informative as a compiler error.

    If we use the negative-array-size method *and* the link time trick,
    we get the ability to use BUILD_BUG_ON() under __builtin_constant_p()
    branches, and maximal ability for the compiler to detect errors at
    build time.

    We also document it thoroughly.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: lttng filter validator ERANGE error handling
Mathieu Desnoyers [Thu, 7 Jun 2018 16:10:00 +0000 (12:10 -0400)] 
Fix: lttng filter validator ERANGE error handling

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: filter interpreter: use LTTNG_SIZE_MAX
Mathieu Desnoyers [Wed, 6 Jun 2018 21:32:26 +0000 (17:32 -0400)] 
Fix: filter interpreter: use LTTNG_SIZE_MAX

Own macro required for older kernels.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFilter: add FILTER_OP_RETURN_S64 instruction
Mathieu Desnoyers [Mon, 25 Sep 2017 15:37:14 +0000 (11:37 -0400)] 
Filter: add FILTER_OP_RETURN_S64 instruction

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoPerform bitwise ops on unsigned types
Mathieu Desnoyers [Fri, 22 Sep 2017 21:03:34 +0000 (17:03 -0400)] 
Perform bitwise ops on unsigned types

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFilter: catch shift undefined behavior
Mathieu Desnoyers [Fri, 22 Sep 2017 20:00:13 +0000 (16:00 -0400)] 
Filter: catch shift undefined behavior

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFilter: add lshift, rshift, bit not ops
Mathieu Desnoyers [Fri, 22 Sep 2017 00:42:34 +0000 (20:42 -0400)] 
Filter: add lshift, rshift, bit not ops

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFilter: index array, sequences, implement bitwise binary operators
Mathieu Desnoyers [Tue, 12 Sep 2017 22:36:34 +0000 (18:36 -0400)] 
Filter: index array, sequences, implement bitwise binary operators

Implement indexing of array and sequence of integers, as well as bitwise
binary operators &, |, ^.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: pid tracker should track "pgid" for noargs probes
Mathieu Desnoyers [Tue, 15 May 2018 21:51:24 +0000 (17:51 -0400)] 
Fix: pid tracker should track "pgid" for noargs probes

The "pid" notion exposed by LTTng translates to the "pgid" notion in the
Linux kernel. Therefore using "current->pid" as argument to the PID
tracker actually ends up behaving as a "tid" tracker, which does not
match the intent nor the user-space tracer behavior.

The probes taking arguments were fixed by a prior commit, but it missed
probes without arguments.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agolttng-tp-mempool: perform node-local allocation
Mathieu Desnoyers [Tue, 8 May 2018 15:58:25 +0000 (11:58 -0400)] 
lttng-tp-mempool: perform node-local allocation

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: update RCU instrumentation for 4.17
Mathieu Desnoyers [Tue, 1 May 2018 20:42:44 +0000 (16:42 -0400)] 
Fix: update RCU instrumentation for 4.17

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: sunrpc instrumentation for 4.17
Michael Jeanson [Tue, 17 Apr 2018 15:07:47 +0000 (11:07 -0400)] 
Fix: sunrpc instrumentation for 4.17

See upstream commit:

  commit e671edb9428c8a61662aaf8c39f5edced7cc45c7
  Author: Chuck Lever <chuck.lever@oracle.com>
  Date:   Fri Mar 16 10:33:44 2018 -0400

    sunrpc: Simplify synopsis of some trace points

    Clean up: struct rpc_task carries a pointer to a struct rpc_clnt,
    and in fact task->tk_client is always what is passed into trace
    points that are already passing @task.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: use struct reclaim_stat in mm_vmscan_lru_shrink_inactive for 4.17
Michael Jeanson [Tue, 17 Apr 2018 15:07:46 +0000 (11:07 -0400)] 
Fix: use struct reclaim_stat in mm_vmscan_lru_shrink_inactive for 4.17

See upstream commit:

  commit d51d1e64500fcb48fc6a18c77c965b8f48a175f2
  Author: Steven Rostedt <rostedt@goodmis.org>
  Date:   Tue Apr 10 16:28:07 2018 -0700

    mm, vmscan, tracing: use pointer to reclaim_stat struct in trace event

    The trace event trace_mm_vmscan_lru_shrink_inactive() currently has 12
    parameters! Seven of them are from the reclaim_stat structure.  This
    structure is currently local to mm/vmscan.c.  By moving it to the global
    vmstat.h header, we can also reference it from the vmscan tracepoints.
    In moving it, it brings down the overhead of passing so many arguments
    to the trace event.  In the future, we may limit the number of arguments
    that a trace event may pass (ideally just 6, but more realistically it
    may be 8).

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: Add gfp_flags arg to mm_vmscan_kswapd_wake for 4.17
Michael Jeanson [Tue, 17 Apr 2018 15:07:45 +0000 (11:07 -0400)] 
Fix: Add gfp_flags arg to mm_vmscan_kswapd_wake for 4.17

See upstream commit:

  commit 5ecd9d403ad081ed2de7b118c1e96124d4e0ba6c
  Author: David Rientjes <rientjes@google.com>
  Date:   Thu Apr 5 16:25:16 2018 -0700

    mm, page_alloc: wakeup kcompactd even if kswapd cannot free more memory

    Kswapd will not wakeup if per-zone watermarks are not failing or if too
    many previous attempts at background reclaim have failed.

    This can be true if there is a lot of free memory available.  For high-
    order allocations, kswapd is responsible for waking up kcompactd for
    background compaction.  If the zone is not below its watermarks or
    reclaim has recently failed (lots of free memory, nothing left to
    reclaim), kcompactd does not get woken up.

    When __GFP_DIRECT_RECLAIM is not allowed, allow kcompactd to still be
    woken up even if kswapd will not reclaim.  This allows high-order
    allocations, such as thp, to still trigger background compaction even
    when the zone has an abundance of free memory.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoUpdate: kvm instrumentation for ubuntu 4.13.0-38
Khalid Elmously [Sun, 25 Mar 2018 15:06:03 +0000 (11:06 -0400)] 
Update: kvm instrumentation for ubuntu 4.13.0-38

Starting from 4.13.0-38 the ubuntu kernel backport a kvm instrumentation
change introduced in 4.15 which affects the prototype of the kvm_mmio
event.

Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: update kvm instrumentation for Ubuntu 3.13.0-144
Michael Jeanson [Fri, 23 Mar 2018 15:41:46 +0000 (11:41 -0400)] 
Fix: update kvm instrumentation for Ubuntu 3.13.0-144

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: btrfs instrumentation namespacing
Mathieu Desnoyers [Thu, 22 Mar 2018 21:33:32 +0000 (17:33 -0400)] 
Fix: btrfs instrumentation namespacing

Trips this warning:

[  122.301894] WARNING: CPU: 6 PID: 1654 at /home/efficios/git/lttng-modules/lttng-probes.c:99 fixup_lazy_probes+0x195/0x200 [lttng_tracer]
[  122.304974] Modules linked in: lttng_probe_compaction(O+) lttng_probe_btrfs(O) lttng_probe_block(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_statedump(O) lttng_ftrace(O) lttng_kprobes(O) lttng_clock(O) lttng_lib_ring_buffer(O) lttng_kretprobes(O)
[  122.314772] CPU: 6 PID: 1654 Comm: modprobe Tainted: G           O     4.16.0-rc6+ #54
[  122.316738] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
[  122.320280] RIP: 0010:fixup_lazy_probes+0x195/0x200 [lttng_tracer]
[  122.321825] RSP: 0018:ffffc90008467ca0 EFLAGS: 00010286
[  122.323137] RAX: 00000000ffffffff RBX: ffffffffa01e7000 RCX: 0000000000000061
[  122.324847] RDX: 0000000000000005 RSI: ffffffffa01e21ac RDI: ffffffffa01e233b
[  122.326528] RBP: ffffffffa017f078 R08: 0000000000000062 R09: 0000000000000345
[  122.328154] R10: 0000000000000000 R11: ffffc90008467a28 R12: 0000000000000005
[  122.329791] R13: 0000000000000010 R14: 0000000000000010 R15: 0000000000000006
[  122.331410] FS:  00007f6c8d9a7740(0000) GS:ffff880c0fb80000(0000) knlGS:0000000000000000
[  122.333323] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  122.334673] CR2: 00007ffcc9698ff8 CR3: 0000000c0afae004 CR4: 00000000001606e0
[  122.336300] Call Trace:
[  122.337011]  ? __event_probe__compaction_migratepages+0x250/0x250 [lttng_probe_compaction]
[  122.338901]  lttng_get_probe_list_head.part.2+0x19/0x20 [lttng_tracer]
[  122.340349]  lttng_probe_register+0xd5/0xe0 [lttng_tracer]
[  122.341607]  ? __event_probe__compaction_migratepages+0x250/0x250 [lttng_probe_compaction]
[  122.343453]  do_one_initcall+0x3d/0x16e
[  122.344383]  ? _cond_resched+0x15/0x30
[  122.345323]  ? kmem_cache_alloc_trace+0xe1/0x1b0
[  122.346394]  ? do_init_module+0x22/0x20c
[  122.347329]  do_init_module+0x5a/0x20c
[  122.350037]  load_module+0x244f/0x2980
[  122.350958]  ? m_show+0x190/0x190
[  122.351774]  ? security_capable+0x41/0x60
[  122.352723]  SYSC_finit_module+0x80/0xb0
[  122.353716]  do_syscall_64+0x76/0x1a0
[  122.354565]  entry_SYSCALL_64_after_hwframe+0x3d/0xa2
[  122.355669] RIP: 0033:0x7f6c8d4c73c9
[  122.356502] RSP: 002b:00007ffcc969c248 EFLAGS: 00000206 ORIG_RAX: 0000000000000139
[  122.358209] RAX: ffffffffffffffda RBX: 000055763df4fee9 RCX: 00007f6c8d4c73c9
[  122.359684] RDX: 0000000000000000 RSI: 000055763df4fee9 RDI: 0000000000000004
[  122.361182] RBP: 0000000000000000 R08: 0000000000000000 R09: 000055763f39a450
[  122.362663] R10: 0000000000000004 R11: 0000000000000206 R12: 000055763f392400
[  122.364144] R13: 000055763f396cb0 R14: 000055763f3925a0 R15: 0000000000040000
[  122.365690] Code: 25 14 a0 4a 8b 04 f0 48 8b 30 31 c0 e8 25 3b 10 e1 48 8b 43 08 48 8b 33 4c 89 e2 4a 8b 04 f0 48 8b 38 e8 9f b7 b1 e1 85 c0 74 07 <0f> 0b e9 b3 fe ff ff 48 c7 c7 16 26 14 a0 e8 f8 3a 10 e1 48 8b
[  122.369348] ---[ end trace 15840f1166edf835 ]---

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoCleanup: comment about CONFIG_HOTPLUG_CPU ifdef
Michael Jeanson [Tue, 13 Mar 2018 16:14:43 +0000 (12:14 -0400)] 
Cleanup: comment about CONFIG_HOTPLUG_CPU ifdef

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: do not use CONFIG_HOTPLUG_CPU for the new hotplug API
Lars Persson [Sun, 11 Mar 2018 14:02:43 +0000 (15:02 +0100)] 
Fix: do not use CONFIG_HOTPLUG_CPU for the new hotplug API

Kernel configurations without CONFIG_HOTPLUG_CPU throw an unknown
symbol error when attempting to insert the lttng-trace module:
 lttng_tracer: Unknown symbol lttng_hp_prepare (err 0)
 lttng_tracer: Unknown symbol lttng_hp_online (err 0)

This was caused by lttng-events and lttng-context-perf-counter not
agreeing on which preprocessor condition that should guard the use of
the hotplug API. In fact the API is available also on kernels built
without CONFIG_HOTPLUG_CPU.

Signed-off-by: Lars Persson <larper@axis.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: update kvm instrumentation for 4.1.50+
Michael Jeanson [Thu, 8 Mar 2018 16:18:56 +0000 (11:18 -0500)] 
Fix: update kvm instrumentation for 4.1.50+

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoUse the memory pool instead of kmalloc
Julien Desfossez [Fri, 23 Feb 2018 16:37:11 +0000 (11:37 -0500)] 
Use the memory pool instead of kmalloc

Replace the use of kmalloc/kfree in the tracepoint probes that need
dynamic allocation with the tracepoint memory pool alloc/free.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoCreate a memory pool for temporary tracepoint probes storage
Julien Desfossez [Fri, 23 Feb 2018 16:37:10 +0000 (11:37 -0500)] 
Create a memory pool for temporary tracepoint probes storage

This memory pool is created when the lttng-tracer module is loaded. It
allocates 4 buffers of 4k on each CPU. These buffers are designed to
allow tracepoint probes to temporarily store data that does not fit on
the stack (during the code_pre and code_post phases). The memory is
freed when the lttng-tracer module is unloaded.

This removes the need for dynamic allocation during the execution of
tracepoint probes, which does not behave well on PREEMPT_RT kernel, even
when invoked with the GFP_ATOMIC | GFP_NOWAIT flags.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: use proper pid_ns in the process statedump
Michael Jeanson [Wed, 21 Feb 2018 21:36:17 +0000 (16:36 -0500)] 
Fix: use proper pid_ns in the process statedump

The pid_ns we currently use from the nsproxy struct is not the task's
pid_ns but the one that children of this task will use.

As stated in include/linux/nsproxy.h :

  The pid namespace is an exception -- it's accessed using
  task_active_pid_ns.  The pid namespace here is the
  namespace that children will use.

While it will be the same most of the time, it will report incorrect
information in some situations. Plus it has the side effect of
simplifying the code and removing kernel version checks.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: add variable quoting to shell scripts
Michael Jeanson [Tue, 20 Feb 2018 17:16:25 +0000 (12:16 -0500)] 
Fix: add variable quoting to shell scripts

Prevent errors if a path contains spaces.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoUpdate: kvm instrumentation for fedora 4.14.13-300
Michael Jeanson [Tue, 20 Feb 2018 17:10:05 +0000 (12:10 -0500)] 
Update: kvm instrumentation for fedora 4.14.13-300

Starting from 4.14.13-300 the fedora kernel backport a kvm instrumentation
change introduced in 4.15 which affects the prototype of the kvm_mmio event.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: Add Fedora version macros
Loïc Gelle [Tue, 20 Feb 2018 17:10:04 +0000 (12:10 -0500)] 
Fix: Add Fedora version macros

Signed-off-by: Loïc Gelle <loic.gelle@polymtl.ca>
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoAdd preemptirq instrumentation
Michael Jeanson [Tue, 19 Dec 2017 21:10:23 +0000 (16:10 -0500)] 
Add preemptirq instrumentation

The tracepoints were introduced in kernl 4.15 alongside the config
option PREEMPTIRQ_EVENTS.

This enables tracing of disable and enable events for preemption and
irqs. For tracing preempt disable/enable events, DEBUG_PREEMPT must be
enabled. For tracing irq disable/enable events, PROVE_LOCKING must
be disabled.

See upstream commit:

  commit d59158162e032917a428704160a2063a02405ec6
  Author: Joel Fernandes <joelaf@google.com>
  Date:   Tue Oct 10 15:51:37 2017 -0700

    tracing: Add support for preempt and irq enable/disable events

    Preempt and irq trace events can be used for tracing the start and
    end of an atomic section which can be used by a trace viewer like
    systrace to graphically view the start and end of an atomic section and
    correlate them with latencies and scheduling issues.

    This also serves as a prelude to using synthetic events or probes to
    rewrite the preempt and irqsoff tracers, along with numerous benefits of
    using trace events features for these events.
Link: http://lkml.kernel.org/r/20171006005432.14244-3-joelaf@google.com
Link: http://lkml.kernel.org/r/20171010225137.17370-1-joelaf@google.com
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoClean-up: fix stale #endif comments
Jérémie Galarneau [Fri, 4 Nov 2016 21:12:49 +0000 (17:12 -0400)] 
Clean-up: fix stale #endif comments

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoCommand to dump the metadata cache again
Julien Desfossez [Wed, 18 Oct 2017 15:14:08 +0000 (11:14 -0400)] 
Command to dump the metadata cache again

This command allows the consumer to ask for the metadata cache to be
dumped entirely another time. This is used by the session rotation
feature to get a new copy of what was in the metadata cache without
regenerating it and re-sampling the offset from epoch.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoAdd a new /dev/lttng-logger interface
Stéphane Graber [Tue, 19 Dec 2017 20:55:07 +0000 (15:55 -0500)] 
Add a new /dev/lttng-logger interface

This is identical to /proc/lttng-logger but has the advantage of working
from within containers when the path is made accessible to them.

Fixes: #1145
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: update btrfs instrumentation for SuSE 4.4.114-92
Michael Jeanson [Tue, 13 Feb 2018 20:23:51 +0000 (15:23 -0500)] 
Fix: update btrfs instrumentation for SuSE 4.4.114-92

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: update block instrumentation for SuSE 4.4.114-92
Michael Jeanson [Tue, 13 Feb 2018 20:23:50 +0000 (15:23 -0500)] 
Fix: update block instrumentation for SuSE 4.4.114-92

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: update rcu instrumentation for v4.16
Michael Jeanson [Mon, 12 Feb 2018 17:32:25 +0000 (18:32 +0100)] 
Fix: update rcu instrumentation for v4.16

See upstream commits :

  commit dec98900eae1e22467182e58688abe5fae98bd5f
  Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
  Date:   Wed Oct 4 16:24:29 2017 -0700

    rcu: Add ->dynticks field to rcu_dyntick trace event

  commit 84585aa8b6ad24e5bdfba9db4a320a6aeed192ab
  Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
  Date:   Wed Oct 4 15:55:16 2017 -0700

    rcu: Shrink ->dynticks_{nmi_,}nesting from long long to long

    Because the ->dynticks_nesting field now only contains the process-based
    nesting level instead of a value encoding both the process nesting level
    and the irq "nesting" level, we no longer need a long long, even on
    32-bit systems.  This commit therefore changes both the ->dynticks_nesting
    and ->dynticks_nmi_nesting fields to long.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: update vmscan instrumentation for v4.16
Michael Jeanson [Mon, 12 Feb 2018 17:32:12 +0000 (18:32 +0100)] 
Fix: update vmscan instrumentation for v4.16

See upstream commit :

  commit 9092c71bb724dba2ecba849eae69e5c9d39bd3d2
  Author: Josef Bacik <jbacik@fb.com>
  Date:   Wed Jan 31 16:16:26 2018 -0800

    mm: use sc->priority for slab shrink targets

    Previously we were using the ratio of the number of lru pages scanned to
    the number of eligible lru pages to determine the number of slab objects
    to scan.  The problem with this is that these two things have nothing to
    do with each other, so in slab heavy work loads where there is little to
    no page cache we can end up with the pages scanned being a very low
    number.  This means that we reclaim next to no slab pages and waste a
    lot of time reclaiming small amounts of space.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: update timer instrumentation on 4.16 and 4.14-rt
Rasmus Villemoes [Mon, 12 Feb 2018 17:31:40 +0000 (18:31 +0100)] 
Fix: update timer instrumentation on 4.16 and 4.14-rt

See upstream commit :

  commit 63e2ed3659752a4850e0ef3a07f809988fcd74a4
  Author: Anna-Maria Gleixner <anna-maria@linutronix.de>
  Date:   Thu Dec 21 11:41:38 2017 +0100

    tracing/hrtimer: Print the hrtimer mode in the 'hrtimer_start' tracepoint

    The 'hrtimer_start' tracepoint lacks the mode information. The mode is
    important because consecutive starts can switch from ABS to REL or from
    PINNED to non PINNED.

    Append the mode field.

See linux-rt commit :

  commit 6ee32a49b1ed61c08ac9f1c9fcbf83d3c749b71d
  Author: Anna-Maria Gleixner <anna-maria@linutronix.de>
  Date:   Sun Oct 22 23:39:46 2017 +0200

    tracing: hrtimer: Print hrtimer mode in hrtimer_start tracepoint

    The hrtimer_start tracepoint lacks the mode information. The mode is
    important because consecutive starts can switch from ABS to REL or from
    PINNED to non PINNED.

    Add the mode information.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoUpdate kvm instrumentation for debian kernel 4.14.0-3
Michael Jeanson [Tue, 30 Jan 2018 21:48:36 +0000 (16:48 -0500)] 
Update kvm instrumentation for debian kernel 4.14.0-3

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: network instrumentation protocol enum
Mathieu Desnoyers [Thu, 25 Jan 2018 17:41:57 +0000 (12:41 -0500)] 
Fix: network instrumentation protocol enum

The enumeration field within the header payload should keep the
enumeration describing the header field, and not use the variant
selector enumeration.

This issue has been introduced by commit "Fix: network instrumentation
handling of corrupted TCP headers".

It causes the following warning messages in babeltrace:

[warning] Unknown value 6 in enum.
[warning] Unknown value 17 in enum.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: update btrfs instrumentation for SuSE 4.4.103-6
Michael Jeanson [Tue, 23 Jan 2018 21:03:25 +0000 (16:03 -0500)] 
Fix: update btrfs instrumentation for SuSE 4.4.103-6

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: update block instrumentation for SuSE 4.4.73-5
Michael Jeanson [Tue, 23 Jan 2018 21:03:24 +0000 (16:03 -0500)] 
Fix: update block instrumentation for SuSE 4.4.73-5

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: global_dirty_limit for kernel v4.2 and up
Michael Jeanson [Tue, 23 Jan 2018 21:00:07 +0000 (16:00 -0500)] 
Fix: global_dirty_limit for kernel v4.2 and up

global_dirty_limit was moved into wb_domain

See upstream commit :

  commit dcc25ae76eb7b8ff883eaaab57e30e8f2f085be3
  Author: Tejun Heo <tj@kernel.org>
  Date:   Fri May 22 18:23:22 2015 -0400

    writeback: move global_dirty_limit into wb_domain

    This patch is a part of the series to define wb_domain which
    represents a domain that wb's (bdi_writeback's) belong to and are
    measured against each other in.  This will enable IO backpressure
    propagation for cgroup writeback.

    global_dirty_limit exists to regulate the global dirty threshold which
    is a property of the wb_domain.  This patch moves hard_dirty_limit,
    dirty_lock, and update_time into wb_domain.

    This is pure reorganization and doesn't introduce any behavioral
    changes.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: network instrumentation handling of corrupted TCP headers
Mathieu Desnoyers [Thu, 18 Jan 2018 19:18:14 +0000 (14:18 -0500)] 
Fix: network instrumentation handling of corrupted TCP headers

A malformed packet may contain a valid IPv4/IPv6 header, but an
inconsistent TCP header. As a result, the trace contains a fully
formed IPv4/IPv6 header, including the "protocol" or "nexthdr"
fields indicating TCP, but no following TCP header.

This scenario leads to an unreadable CTF trace, because the
trace viewer expects a TCP header, but instead gets the next
event.

Therefore, using the IP header fields as selector for the
transport layer variant is not the right approach: introduce
our own selector field, which allows to properly deal with this
corner-case.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: add missing uaccess.h include from kstrtox.h wrapper
Mathieu Desnoyers [Wed, 17 Jan 2018 18:37:26 +0000 (13:37 -0500)] 
Fix: add missing uaccess.h include from kstrtox.h wrapper

Required to build lttng-modules against kernel < 3.0.0 on ARM.

Fixes #1148

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoUpdate: kvm instrumentation for 4.14.14+, 4.9.77+, 4.4.112+
Mathieu Desnoyers [Wed, 17 Jan 2018 16:17:08 +0000 (11:17 -0500)] 
Update: kvm instrumentation for 4.14.14+, 4.9.77+, 4.4.112+

Starting from 3.14.14, 4.9.77, and 4.4.112, the 3.14, 4.9, and 4.4
stable kernel branches backport a kvm instrumentation change introduced
in 4.15 which affects the prototype of the kvm_mmio event.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: btrfs_delayed_ref_head was unwired since v3.12
Michael Jeanson [Tue, 9 Jan 2018 22:40:00 +0000 (17:40 -0500)] 
Fix: btrfs_delayed_ref_head was unwired since v3.12

See upstream commit:

  commit 599c75ec3f7f3b606e8a0a684c00f12190712de8
  Author: Liu Bo <bo.li.liu@oracle.com>
  Date:   Tue Jul 16 19:03:36 2013 +0800

    Btrfs/tracepoint: update delayed ref tracepoints

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

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoUpdate kvm instrumentation for debian kernel 4.9.65-3
Michael Jeanson [Tue, 9 Jan 2018 20:43:20 +0000 (15:43 -0500)] 
Update kvm instrumentation for debian kernel 4.9.65-3

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: debian kernel version parsing
Michael Jeanson [Tue, 9 Jan 2018 20:43:19 +0000 (15:43 -0500)] 
Fix: debian kernel version parsing

The debian version script only worked for ckt kernels and that was fine
until now because we only had checks for those versions in the code.

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

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

  MAJOR.PATCHLEVEL.SUBLEVEL.CKT.DEBABI.DEBPATCH

And setting CKT to zero for non-ckt kernels.

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