lttng-modules.git
2 years agoVersion 2.13.0 v2.13.0
Mathieu Desnoyers [Mon, 2 Aug 2021 20:45:03 +0000 (16:45 -0400)] 
Version 2.13.0

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I24bced435d30a8660489e76f94370a19160fe9d1

2 years agoVersion 2.13.0-rc3 v2.13.0-rc3
Mathieu Desnoyers [Fri, 16 Jul 2021 18:02:08 +0000 (14:02 -0400)] 
Version 2.13.0-rc3

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I6d21580daba07be92428c5dab4227eae8aaace0a

2 years agofix: sched: Change task_struct::state (v5.14)
Michael Jeanson [Mon, 12 Jul 2021 18:51:20 +0000 (14:51 -0400)] 
fix: sched: Change task_struct::state (v5.14)

See upstream commit:

  commit 2f064a59a11ff9bc22e52e9678bc601404c7cb34
  Author: Peter Zijlstra <peterz@infradead.org>
  Date:   Fri Jun 11 10:28:17 2021 +0200

    sched: Change task_struct::state

    Change the type and name of task_struct::state. Drop the volatile and
    shrink it to an 'unsigned int'. Rename it in order to find all uses
    such that we can use READ_ONCE/WRITE_ONCE as appropriate.

Change-Id: I3a379192d6b977753fe58d4f67833a78dd7a0a47
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agofix: btrfs: pass btrfs_inode to btrfs_writepage_endio_finish_ordered() (v5.14)
Michael Jeanson [Mon, 12 Jul 2021 19:00:26 +0000 (15:00 -0400)] 
fix: btrfs: pass btrfs_inode to btrfs_writepage_endio_finish_ordered() (v5.14)

See upstream commit:

  commit 38a39ac77e089515acbe85c6c70c3df1e728357d
  Author: Qu Wenruo <wqu@suse.com>
  Date:   Thu Apr 8 20:32:27 2021 +0800

    btrfs: pass btrfs_inode to btrfs_writepage_endio_finish_ordered()

    There is a pretty bad abuse of btrfs_writepage_endio_finish_ordered() in
    end_compressed_bio_write().

    It passes compressed pages to btrfs_writepage_endio_finish_ordered(),
    which is only supposed to accept inode pages.

    Thankfully the important info here is the inode, so let's pass
    btrfs_inode directly into btrfs_writepage_endio_finish_ordered(), and
    make @page parameter optional.

    By this, end_compressed_bio_write() can happily pass page=NULL while
    still getting everything done properly.

    Also, to cooperate with such modification, replace @page parameter for
    trace_btrfs_writepage_end_io_hook() with btrfs_inode.
    Although this removes page_index info, the existing start/len should be
    enough for most usage.

Change-Id: If96e99c2d9533d96d9d1aa6460bb7fd3ac9ed7ab
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agofix: adjust ranges for RHEL 8.4
Michael Jeanson [Tue, 18 May 2021 15:16:34 +0000 (11:16 -0400)] 
fix: adjust ranges for RHEL 8.4

Change-Id: I9ac44467cca4850fb4051252937542d5a054ccc4
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agoVersion 2.13.0-rc2 v2.13.0-rc2
Mathieu Desnoyers [Fri, 14 May 2021 19:31:09 +0000 (15:31 -0400)] 
Version 2.13.0-rc2

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I1e09e6683a3aad482fb7cc8b44eb3b603132c9b8

2 years agofix: adjust ranges for RHEL 8.2 and 8.3
Michael Jeanson [Tue, 11 May 2021 19:29:23 +0000 (15:29 -0400)] 
fix: adjust ranges for RHEL 8.2 and 8.3

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I0863ac030f9fdfeb0173b843e75396acda21f3b6

2 years agoDisable x86 error code bitwise enum in default build
Michael Jeanson [Thu, 13 May 2021 14:30:24 +0000 (10:30 -0400)] 
Disable x86 error code bitwise enum in default build

Only generate the bitwise enumerations when
CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM is enabled, so the default build
does not generate traces which lead to warnings when viewed with
babeltrace 1.x and babeltrace 2 with default options.

commit 8c7f2a9f2732b11f5cc9798cecb621420cc0e972
Author: Francis Deslauriers <francis.deslauriers@efficios.com>
Date:   Fri Jun 5 18:42:54 2020 -0400

    x86: add error code enum to pagefault tracepoints

Change-Id: I7901fad216b4774a9bbf3665568f357321805871
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agoDisable mmap bitwise enum in default build
Michael Jeanson [Wed, 12 May 2021 18:20:44 +0000 (14:20 -0400)] 
Disable mmap bitwise enum in default build

Only generate the bitwise enumerations when
CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM is enabled, so the default build
does not generate traces which lead to warnings when viewed with
babeltrace 1.x and babeltrace 2 with default options.

Original commit:

  commit 3cf55950d0f6aa43eb5ad119bad1dbda69f75a54
  Author: Francis Deslauriers <francis.deslauriers@efficios.com>
  Date:   Fri Jun 5 11:38:14 2020 -0400

    syscalls: Make mmap()'s fields `prot` and `flags` enums

Change-Id: I033f42855c2967356b1e90cd89450eb5100a0f0b
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agoDisable block rwbs bitwise enum in default build
Michael Jeanson [Tue, 11 May 2021 21:22:12 +0000 (17:22 -0400)] 
Disable block rwbs bitwise enum in default build

Only generate the bitwise enumerations when
CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM is enabled, so the default build
does not generate traces which lead to warnings when viewed with
babeltrace 1.x and babeltrace 2 with default options.

Original commit:

  commit 23634515e7271c8c8594ad87a6685232d4eff297
  Author: Geneviève Bastien <gbastien@versatic.net>
  Date:   Tue Feb 11 11:20:27 2020 -0500

    block: Make the rwbs field as a bit field enum

Change-Id: I6c285d1cbfbd88e151d4b0abb52ad9a650764ea2
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agoDisable sched_switch bitwise enum in default build
Michael Jeanson [Tue, 11 May 2021 21:15:15 +0000 (17:15 -0400)] 
Disable sched_switch bitwise enum in default build

Only generate the bitwise enumerations when
CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM is enabled, so the default build
does not generate traces which lead to warnings when viewed with
babeltrace 1.x and babeltrace 2 with default options.

Original commit:

  commit 721caea47b6506f7ad9086c3e9801dc9dfe06b6a
  Author: Geneviève Bastien <gbastien@versatic.net>
  Date:   Wed Feb 12 16:58:25 2020 -0500

    sched: Make the sched_switch task state an enum

Change-Id: Ib19d06365fbed7daa9440d5dfff283c4f89db6ee
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agoDisable open[at] bitwise enum in default build
Michael Jeanson [Tue, 11 May 2021 21:09:07 +0000 (17:09 -0400)] 
Disable open[at] bitwise enum in default build

Only generate the bitwise enumerations when
CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM is enabled, so the default build
does not generate traces which lead to warnings when viewed with
babeltrace 1.x and babeltrace 2 with default options.

Original commit:

  commit c8dfb72431505d5f01a6f090f3f7427d9ca6fe94
  Author: Geneviève Bastien <gbastien@versatic.net>
  Date:   Wed Mar 11 12:33:04 2020 -0400

    syscalls: Make the flags and mode fields of open[at] enumerations

Use the non-override system call tracing implementation when the enum is
not used.

Change-Id: I2dbebe56eaba6186843dab20264d3378962c7d30
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agoDisable fcntl bitwise enum in default build
Michael Jeanson [Tue, 11 May 2021 21:05:37 +0000 (17:05 -0400)] 
Disable fcntl bitwise enum in default build

Only generate the bitwise enumerations when
CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM is enabled, so the default build
does not generate traces which lead to warnings when viewed with
babeltrace 1.x and babeltrace 2 with default options.

Original commit:

  commit c1c07d681a68ba37da066d6f0456129957073169
  Author: Geneviève Bastien <gbastien+lttng@versatic.net>
  Date:   Wed Mar 11 12:38:51 2020 -0400

    syscalls: Make the cmd field of fcntl an enum

Use the non-override system call tracing implementation when the enum is
not used.

Change-Id: I4c650d40a14b1c56ada0ed9aae1877364d0c4580
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agoDisable clone bitwise enum in default build
Michael Jeanson [Tue, 11 May 2021 20:16:18 +0000 (16:16 -0400)] 
Disable clone bitwise enum in default build

Only generate the bitwise enumerations when
CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM is enabled, so the default build
does not generate traces which lead to warnings when viewed with
babeltrace 1.x and babeltrace 2 with default options.

Original commit:

  commit d775625e2ba4825b73b5897e7701ad6e2bdba115
  Author: Geneviève Bastien <gbastien@versatic.net>
  Date:   Wed Apr 1 14:31:49 2020 -0400

    syscalls: Make clone()'s `flags` field a 2 enum struct.

Change-Id: Ia67b5fc93b932b8b76330b4965753a43401c1514
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agoAdd experimental bitwise enum config option
Michael Jeanson [Wed, 12 May 2021 20:21:50 +0000 (16:21 -0400)] 
Add experimental bitwise enum config option

Only generate the bitwise enumerations when
CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM is enabled, so the default build
does not generate traces which lead to warnings when viewed with
babeltrace 1.x and babeltrace 2 with default options.

Change-Id: Id45c7a78b280a7f35bbeafb80f2f6f5aa1ebbdc9
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agoAdd defaults to Kconfig options
Michael Jeanson [Wed, 12 May 2021 20:13:01 +0000 (16:13 -0400)] 
Add defaults to Kconfig options

Add defaults to the Kconfig options used when building in-tree that
match the default configuration when built out-of-tree.

Change-Id: I436251f1fb4c3e238a013d18d67932565b92ef45
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agoCleanup: remove unused EXTCFLAGS from Makefile
Michael Jeanson [Thu, 13 May 2021 14:42:38 +0000 (10:42 -0400)] 
Cleanup: remove unused EXTCFLAGS from Makefile

Change-Id: I36c4f6f403b03a1aa158863f393049efdc70af04
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agoSync `show_inode_state()` macro with upstream stable kernels
Michael Jeanson [Wed, 12 May 2021 17:35:24 +0000 (13:35 -0400)] 
Sync `show_inode_state()` macro with upstream stable kernels

The following commit was backported to multiple stable branches:

  commit 5fcd57505c002efc5823a7355e21f48dd02d5a51
  Author: Jan Kara <jack@suse.cz>
  Date:   Fri May 29 16:24:43 2020 +0200

    writeback: Drop I_DIRTY_TIME_EXPIRE

    The only use of I_DIRTY_TIME_EXPIRE is to detect in
    __writeback_single_inode() that inode got there because flush worker
    decided it's time to writeback the dirty inode time stamps (either
    because we are syncing or because of age). However we can detect this
    directly in __writeback_single_inode() and there's no need for the
    strange propagation with I_DIRTY_TIME_EXPIRE flag.

Change-Id: I6e7c0ced13acd4fcd88bcd572d0ba1f9b254c58c
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agoUpdate .gitreview for stable-2.13
Michael Jeanson [Wed, 12 May 2021 15:36:00 +0000 (11:36 -0400)] 
Update .gitreview for stable-2.13

Change-Id: I169739a9e4f43be052cb815feefb21610e7cf742
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agoSync `show_inode_state()` macro with Ubuntu 4.15 kernel
Francis Deslauriers [Mon, 10 May 2021 17:41:48 +0000 (13:41 -0400)] 
Sync `show_inode_state()` macro with Ubuntu 4.15 kernel

The following commit changed the `show_inode_state()` macro which
triggered a warning on our CI build:
  commit 63388062bea96e5cd8b8d7abf7b7142f8666ca1f
  Author: Jan Kara <jack@suse.cz>
  Date:   Mon Jan 25 12:37:43 2021 -0800

      writeback: Drop I_DIRTY_TIME_EXPIRE

Also, this commit adds a comment to clarify why we keep these
`#if/#elif` even though we don't use it the macro.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I2dd53a1a286ab8a431977bda6cde01f700f0c7d9

2 years agofix: block: remove disk_part_iter (v5.12)
Michael Jeanson [Mon, 10 May 2021 15:39:24 +0000 (11:39 -0400)] 
fix: block: remove disk_part_iter (v5.12)

In v5.12 a refactoring of the genhd code was started and the symbols
related to 'disk_part_iter' were unexported. In v5.13 they were
completely removed.

This patch replaces the short lived compat code that is specific to
v5.12 and replaces it with a generic internal implementation that
iterates directly on the 'disk->part_tbl' xarray which will be used
on v5.12 and up.

This seems like a better option than keeping the compat code that will
only work on v5.12 and make maintenance more complicated. The compat was
backported to the stable branches but isn't yet part of a point release
so can be safely replaced.

See the upstream commits:

  commit 3212135a718b06be38811f2d9a320ae842e76409
  Author: Christoph Hellwig <hch@lst.de>
  Date:   Tue Apr 6 08:23:02 2021 +0200

    block: remove disk_part_iter

    Just open code the xa_for_each in the remaining user.

  commit a33df75c6328bf40078b35f2040d8e54d574c357
  Author: Christoph Hellwig <hch@lst.de>
  Date:   Sun Jan 24 11:02:41 2021 +0100

    block: use an xarray for disk->part_tbl

    Now that no fast path lookups in the partition table are left, there is
    no point in micro-optimizing the data structure for it.  Just use a bog
    standard xarray.

Change-Id: If3497e087fadaa285e135f57aab7e6df157b06c6
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agoCleanup: lib ring buffer: rename pagecpy local variable
Mathieu Desnoyers [Tue, 11 May 2021 17:29:43 +0000 (13:29 -0400)] 
Cleanup: lib ring buffer: rename pagecpy local variable

Rename pagecpy local variable to bytes_left_in_page, which has a clearer
semantic. Also remove the unused pagecpy parameter from slow paths which
was always 0.

Also add a missing __user annotation on @src of
the _lib_ring_buffer_copy_from_user_inatomic prototype.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I22a85cb8e94a65aaa80ca49951479243477ac600

2 years agoCleanup: clarify strcpy/strcpy_from_user local variables
Mathieu Desnoyers [Tue, 11 May 2021 17:19:33 +0000 (13:19 -0400)] 
Cleanup: clarify strcpy/strcpy_from_user local variables

The variable name "bytes_left_in_page" is clearer than "pagecpy". Also
the only caller of slow paths always has a 0 pagecpy parameter, so
remove that parameter. Also use a "bool" for src_terminated (no
functional change).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I38520b8cab54c31dbbb7b9296200b432afb3cee9

2 years agoImplement ring buffer Pascal string copy
Mathieu Desnoyers [Fri, 7 May 2021 18:05:00 +0000 (14:05 -0400)] 
Implement ring buffer Pascal string copy

Introduce a new lib_ring_buffer_pstrcpy() to handle copying into a ring
buffer Pascal String, use them for array and sequence of text.

Cover strings copied from both kernel and user-space.

This ensures that when copying from a string input to a ring buffer
utf8/ascii-encoded array or sequence, the source is not read beyond its
null terminating character.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I74996c8c8db6eec39b189693739aa2f980e29816

2 years agoMove alignment into event write callback
Mathieu Desnoyers [Fri, 7 May 2021 18:33:58 +0000 (14:33 -0400)] 
Move alignment into event write callback

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I7563cdd07163fc22e2269627879a83e871c4eb01

2 years agoCleanup: disable page fault after access_ok
Mathieu Desnoyers [Mon, 10 May 2021 12:34:16 +0000 (08:34 -0400)] 
Cleanup: disable page fault after access_ok

The page faults don't need to be disabled for access_ok. Simplify the
fill buffer error paths.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I2e31d308d45efdfede04e2159c37c066749871ae

2 years agoFix: increment buffer offset when failing to copy from user-space
Mathieu Desnoyers [Fri, 7 May 2021 19:03:04 +0000 (15:03 -0400)] 
Fix: increment buffer offset when failing to copy from user-space

Upon failure to copy from user-space due to failing access ok check, the
ring buffer offset is not incremented, which could generate unreadable
traces because we don't account for the padding we write into the ring
buffer.

Note that this typically won't affect a common use-case of copying
strings from user-space, because unless mprotect is invoked within a
narrow race window (between user strlen and user strcpy), the strlen
will fail on access ok when calculating the space to reserve, which will
match what happens on strcpy.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ic4d9487dd8870a526bae3023bb80f5e6301cec50

2 years agoFix: add missing #include for 3.8 kernel
Francis Deslauriers [Fri, 7 May 2021 14:48:28 +0000 (10:48 -0400)] 
Fix: add missing #include for 3.8 kernel

Add the `linux/compat.h` include to fix the following error while
building the modules against a 3.8 kernel for x86-64 kernel:
  error: ‘F_GETLK64’ undeclared here (not in a function)
     ctf_enum_value("F_GETLK64", F_GETLK64)

Also, move the #include directives from the instrumentation headers to
the `lttng-syscalls.h` file.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I334a14d0b40ec77e0ca0aa3b762197de2050a1ae

2 years agoFix: builtin script referring to old directories
Francis Deslauriers [Thu, 6 May 2021 21:50:03 +0000 (17:50 -0400)] 
Fix: builtin script referring to old directories

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I30fb8abb1a69d6695552947e30cf2b43d3db36b3

2 years agoevents.h API const-ness
Mathieu Desnoyers [Thu, 6 May 2021 20:42:52 +0000 (16:42 -0400)] 
events.h API const-ness

Ensure events.h definitions, fields, and arguments referring to const
arrays of pointers are const.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Id1f9a736de72220f7576d9780b82ab7879eac300

2 years agoRename struct lib_ring_buffer* to struct lttng_kernel_ring_buffer*
Mathieu Desnoyers [Thu, 6 May 2021 20:32:32 +0000 (16:32 -0400)] 
Rename struct lib_ring_buffer* to struct lttng_kernel_ring_buffer*

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I61b5a78c6485422ae4a2e2e45e32465db82b3d97

2 years agoRename struct channel to struct lttng_kernel_ring_buffer_channel
Mathieu Desnoyers [Thu, 6 May 2021 20:08:37 +0000 (16:08 -0400)] 
Rename struct channel to struct lttng_kernel_ring_buffer_channel

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ifb737dfa71c9fdd08b62680f7782328b50a70d61

2 years agoRefactoring: struct lttng_channel
Mathieu Desnoyers [Thu, 6 May 2021 18:07:56 +0000 (14:07 -0400)] 
Refactoring: struct lttng_channel

Split lttng_channel into public/private structures, and introduce
inheritance for common fields which will be shared between the channel
buffer and upcoming channel counter.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I932231c4af9ed1066d010b5be4f75f34842e8484

2 years agoFix: missing #include for 3.8 kernel
Francis Deslauriers [Thu, 6 May 2021 19:21:13 +0000 (15:21 -0400)] 
Fix: missing #include for 3.8 kernel

Change-Id: If13a6615c2bed93d887047b6feaf377107d98cf9
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agoIntroduce struct lttng_kernel_tracepoint_class, enum probe_desc field
Mathieu Desnoyers [Thu, 6 May 2021 15:48:42 +0000 (11:48 -0400)] 
Introduce struct lttng_kernel_tracepoint_class, enum probe_desc field

Introduce struct lttng_kernel_tracepoint_class to clearly split the
event instance from the class, thus allowing the event instance to refer
to the class through a single symbol. This removes the need to rely on
ARRAY_SIZE() to calculate the size of the event field array (part of the
class) from within the event instance. This refactoring opens the door
to have event class and instance not only in different providers, but
also in providers emitted within different compile units and shared
objects in the future.

While refactoring kprobes, uprobes and kretprobes code, there is a lot
of dynamically allocated memory which can be turned into static data
structures for tp_class, fields and types. This simplification ends up
fixing a few memory leaks as well.

Introduce a probe_desc field in the enumeration descriptor to keep the
same pattern for both tp_class and enumerations.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I221ad33383de48144d0d14b2b461ecb38dfb54ab

2 years agoSet probe descriptor field in event descriptor
Mathieu Desnoyers [Wed, 5 May 2021 20:01:19 +0000 (16:01 -0400)] 
Set probe descriptor field in event descriptor

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I8afd12cae160fbd7637fb2f9528309f5245f77cf

2 years agoSplit syscall tracepoint generation in their own files
Francis Deslauriers [Fri, 30 Apr 2021 21:30:48 +0000 (17:30 -0400)] 
Split syscall tracepoint generation in their own files

This commit tracepoint generation of the 4 different types of syscalls
(entry, exit, entry_compat, and exit_compat) each in their own .c file.

The compilation time of the lttng-modules projects is currently
dominated by the compilation of the src/lttng-syscalls.o object.
This is caused by the extensive use of macros to generate tracepoint for
all syscalls. This also uses a lot of memory making the compilation of
the project tedious on system with low memory.

This allows for parallelization of the compilation which offers 2
improvements: Reduction of compilation time and reduction of the memory
usage.

In term of compilation time, on my 4 cpus laptop, I measured a 15sec
(20%) speedup over 10 runs when using all 4 cpus (make -j4).

On a larger machine (16 cpus), I measured 30sec (60%) speedup when using
all 16 cpus.

In term of memory usage, I was able to compile the project on a virtual
machine with 500MB of memory without hitting memory exhaustion errors.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I025a4c36ef16b935be2a86f5b6649526752a7393

2 years agoInclude `linux/in{,6}.h` closer to where it's used
Francis Deslauriers [Wed, 5 May 2021 16:37:44 +0000 (12:37 -0400)] 
Include `linux/in{,6}.h` closer to where it's used

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I5e2acc1cd081da131ae289506592e74de553133a

2 years agoGroup all syscall enums in one compile unit
Francis Deslauriers [Wed, 5 May 2021 15:51:31 +0000 (11:51 -0400)] 
Group all syscall enums in one compile unit

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ic0189984d9bc70ae3f76af08bffd127500adad80

2 years agoInclude `linux/mman.h` for mmap flag enum
Francis Deslauriers [Wed, 5 May 2021 16:15:06 +0000 (12:15 -0400)] 
Include `linux/mman.h` for mmap flag enum

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Id891f59aef1bb26b1ed8dff676bbad0f6d9fb69e

2 years agoAdd `struct trace_syscall_table`
Francis Deslauriers [Fri, 30 Apr 2021 14:42:31 +0000 (10:42 -0400)] 
Add `struct trace_syscall_table`

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I72181800793e84f001e83caeea8d7b7ae9e8d07c

2 years agoDefine `static_assert()` when not defined by kernel
Francis Deslauriers [Tue, 4 May 2021 19:48:52 +0000 (15:48 -0400)] 
Define `static_assert()` when not defined by kernel

This macro is useful for build-time assertions. It was added in kernel
v5.1. It uses the C11 _Static_assert macro that was implemented with gcc
4.6. There is support for the _Static_assert in all C modes, including
gnu89.

Since our minimal gcc version is 4.8, we can simply define it manually
if the kernel is older than v5.1.

Kernel commit adding this macro:
  commit 6bab69c65013bed5fce9f101a64a84d0385b3946
  Author: Rasmus Villemoes <linux@rasmusvillemoes.dk>
  Date:   Thu Mar 7 16:27:00 2019 -0800

      build_bug.h: add wrapper for _Static_assert

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I5aa250f60f9dca4f13b8bcc093a006034c28e526

2 years agoMove event hash tables to private header
Mathieu Desnoyers [Mon, 3 May 2021 16:54:10 +0000 (12:54 -0400)] 
Move event hash tables to private header

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Id4c690c275bace3dee92b5c3c25e09ac4eb3b384

2 years agoMove forward declarations to private header
Mathieu Desnoyers [Mon, 3 May 2021 16:52:51 +0000 (12:52 -0400)] 
Move forward declarations to private header

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ibd6fa4f9ec751be8cdb0082c729c3c5662c02d0b

2 years agoMove lttng_syscall_filter forward declaration to private header
Mathieu Desnoyers [Mon, 3 May 2021 16:51:39 +0000 (12:51 -0400)] 
Move lttng_syscall_filter forward declaration to private header

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ife15ca8d175e33e4282a1dd9fd3dc7e759163c8f

2 years agoSplit ID tracker into public/private structures
Mathieu Desnoyers [Mon, 3 May 2021 16:46:04 +0000 (12:46 -0400)] 
Split ID tracker into public/private structures

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ic17da38eb96d734110b59656d0fedce1bacd570a

2 years agoMove id tracker hash node to private header
Mathieu Desnoyers [Mon, 3 May 2021 16:22:15 +0000 (12:22 -0400)] 
Move id tracker hash node to private header

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I0b0cdb345a24f72a17a84a48a5f28acca72441bb

2 years agoSplit struct lttng_session into public/private structures
Mathieu Desnoyers [Mon, 3 May 2021 15:46:40 +0000 (11:46 -0400)] 
Split struct lttng_session into public/private structures

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I3c8e5c826268659d78f4c177e846cc93727af1c2

2 years agoMove struct lttng_metadata_stream to private header
Mathieu Desnoyers [Mon, 3 May 2021 15:31:55 +0000 (11:31 -0400)] 
Move struct lttng_metadata_stream to private header

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ieae3b2c4c2ffe50360a33db1056734d04668af82

2 years agoMove event notifier and counter structures to private header
Mathieu Desnoyers [Mon, 3 May 2021 15:30:52 +0000 (11:30 -0400)] 
Move event notifier and counter structures to private header

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I119a948c39edbe42e22a12d59e8908029d6acad0

2 years agoRename struct lib_ring_buffer_ctx to struct lttng_kernel_ring_buffer_ctx
Mathieu Desnoyers [Mon, 3 May 2021 15:23:44 +0000 (11:23 -0400)] 
Rename struct lib_ring_buffer_ctx to struct lttng_kernel_ring_buffer_ctx

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I81c3ef6dd226f2a27a32b303a096f60927462615

2 years agoRefactoring: struct lttng_kernel_channel_buffer_ops
Mathieu Desnoyers [Mon, 3 May 2021 15:14:39 +0000 (11:14 -0400)] 
Refactoring: struct lttng_kernel_channel_buffer_ops

Introduce public/private structures for ring buffer channel operations.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I3614d550615a4617541a292fa761bebbdf6a275a

2 years agoRename lttng_probe_{,un}register to lttng_kernel_probe_{,un}register
Mathieu Desnoyers [Mon, 3 May 2021 14:56:48 +0000 (10:56 -0400)] 
Rename lttng_probe_{,un}register to lttng_kernel_probe_{,un}register

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I62e1d4765d2dd8dcd4a40f3a12e40bbef93a2ead

2 years agoMove metadata cache structure to internal header
Mathieu Desnoyers [Mon, 3 May 2021 14:54:37 +0000 (10:54 -0400)] 
Move metadata cache structure to internal header

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I99e77d8b6bc1b85dc324feecc81348aeab015030

2 years agoMove internal APIs to internal header
Mathieu Desnoyers [Mon, 3 May 2021 14:52:58 +0000 (10:52 -0400)] 
Move internal APIs to internal header

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ib8c8f64c00e26d49fa4ba2fdf5c85a7f8fdd2568

2 years agoMove kprobes, uprobes, kretprobes, syscall structures to internal header
Mathieu Desnoyers [Mon, 3 May 2021 14:44:45 +0000 (10:44 -0400)] 
Move kprobes, uprobes, kretprobes, syscall structures to internal header

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Id2d352182084cd50998df0a23dcab16d3e7212fc

2 years agoMove kprobe, kretprobe, uprobe APIs to internal header
Mathieu Desnoyers [Mon, 3 May 2021 14:41:45 +0000 (10:41 -0400)] 
Move kprobe, kretprobe, uprobe APIs to internal header

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I92c5a245c3e5f12b6d43b73e104a86e55e341817

2 years agoRemove unused TRACEPOINT_HAS_DATA_ARG
Mathieu Desnoyers [Mon, 3 May 2021 14:40:41 +0000 (10:40 -0400)] 
Remove unused TRACEPOINT_HAS_DATA_ARG

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ib3af9240f9f995d7e9b6a76310ca8388e01f6c3d

2 years agoMove enabler APIs to internal header
Mathieu Desnoyers [Mon, 3 May 2021 14:39:32 +0000 (10:39 -0400)] 
Move enabler APIs to internal header

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Idd0eee625ab10b17a412a6d0d777d64f71801582

2 years agoMove bytecode structures to internal header
Mathieu Desnoyers [Mon, 3 May 2021 14:33:55 +0000 (10:33 -0400)] 
Move bytecode structures to internal header

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ic7931b3fd6d8f4674f7e0a020a4501db4f3ae509

2 years agoRemove include of internal header from tracepoint-event-impl.h
Mathieu Desnoyers [Mon, 3 May 2021 14:29:27 +0000 (10:29 -0400)] 
Remove include of internal header from tracepoint-event-impl.h

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I9b504b4d898a9b53c2d1262379fca3e63b7fef2b

2 years agoRename struct lttng_probe_ctx to struct lttng_kernel_probe_ctx
Mathieu Desnoyers [Mon, 3 May 2021 14:27:18 +0000 (10:27 -0400)] 
Rename struct lttng_probe_ctx to struct lttng_kernel_probe_ctx

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I629b7e447b9842ab863894abd08e4901b439ee17

2 years agoRename struct lttng_bytecode_runtime to struct lttng_kernel_bytecode_runtime
Mathieu Desnoyers [Mon, 3 May 2021 14:24:48 +0000 (10:24 -0400)] 
Rename struct lttng_bytecode_runtime to struct lttng_kernel_bytecode_runtime

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I14051998b44fde8aa94f72c227b89786d40ca4ff

2 years agoRename struct lttng_bytecode_node to struct lttng_kernel_bytecode_node
Mathieu Desnoyers [Mon, 3 May 2021 14:18:58 +0000 (10:18 -0400)] 
Rename struct lttng_bytecode_node to struct lttng_kernel_bytecode_node

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ic00142968c7132d3a2b8292d426948dfbe1b0d88

2 years agoMove context structures and API to internal header
Mathieu Desnoyers [Mon, 3 May 2021 14:15:22 +0000 (10:15 -0400)] 
Move context structures and API to internal header

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I1a6cbb26efb8c9fd4b4ef1872dd39b764a1f473b

2 years agoMove enabler structures to internal header
Mathieu Desnoyers [Mon, 3 May 2021 14:08:40 +0000 (10:08 -0400)] 
Move enabler structures to internal header

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I0769e0ea730f5fbf306bce4f5527c81c193cdbe9

2 years agoMakefile: add .o wildcard target
Francis Deslauriers [Fri, 30 Apr 2021 15:28:13 +0000 (11:28 -0400)] 
Makefile: add .o wildcard target

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ia421852ef9f778d79d810a36c45daaba27727efb

2 years agoFix: Makefile: generation of specific .i file not working
Francis Deslauriers [Fri, 30 Apr 2021 15:14:20 +0000 (11:14 -0400)] 
Fix: Makefile: generation of specific .i file not working

Issue
=====
When trying to get the preprocessed version of the `lttng-syscalls.c` file
I get the following error:
  $ make src/lttng-syscalls.i
    make -C /lib/modules/5.4.0-67-generic/build M=/home/frdeso/projets/lttng/modules/src CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m src/lttng-syscalls.i
    make[1]: Entering directory '/usr/src/linux-headers-5.4.0-67-generic'
    make[3]: *** No rule to make target '/home/frdeso/projets/lttng/modules/src/src/lttng-syscalls.i'.  Stop.
    make[2]: *** [scripts/Makefile.build:480: __build] Error 2
    make[1]: *** [Makefile:1760: /home/frdeso/projets/lttng/modules/src] Error 2
    make[1]: Leaving directory '/usr/src/linux-headers-5.4.0-67-generic'
    make: *** [Makefile:32: src/lttng-syscalls.i] Error 2

We see that the gcc tries to create the `src/src/lttng-syscalls.i` file
instead of the expected `src/lttng-syscalls.i`.

Fix
===
Remove the `/src` from the `M=` option.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I4403d32955723239649eb385f877e52cea669720

2 years agoFix: refactor preemptible context
Mathieu Desnoyers [Thu, 29 Apr 2021 15:15:03 +0000 (11:15 -0400)] 
Fix: refactor preemptible context

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ia7dd34be0a55baf65bc2ce3981492c26a535c832

2 years agoRefactoring: context callbacks
Mathieu Desnoyers [Wed, 28 Apr 2021 20:26:20 +0000 (16:26 -0400)] 
Refactoring: context callbacks

Refactor the context callbacks so they take a private pointer as
argument.

Note that the callstack context internally uses a per-cpu stack across
context size calculation and recording to the ring buffer, which
requires that preemption is disabled across those operations.

The get_size_arg and _get_size callbacks are merged into a single
callback.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I7c4146481d35cb9ddef19f2cb5d61e56ebe142be

2 years agoRemove event id parameter from event_reserve callback
Mathieu Desnoyers [Wed, 28 Apr 2021 19:30:04 +0000 (15:30 -0400)] 
Remove event id parameter from event_reserve callback

This can be fetched from the event recorder.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I85a4ef493d67c1c374e7f3076569c2c2c2109953

2 years agoRefactoring: ring buffer context
Mathieu Desnoyers [Wed, 28 Apr 2021 18:56:05 +0000 (14:56 -0400)] 
Refactoring: ring buffer context

Split the ring buffer context into:

- Public ring buffer context (initialized by probe),
- Private context (initialized by reserve callback),

Pass event recorder rather than channel as client_ctx for events
generated from instrumentation (calling ring buffer client).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Iecd23f11c54da4ba58a97c46192f775a0a74bd85

2 years agosequence and variant types: use previous field for length/tag if NULL
Mathieu Desnoyers [Sat, 24 Apr 2021 00:29:27 +0000 (20:29 -0400)] 
sequence and variant types: use previous field for length/tag if NULL

A common use-case for sequences and variants is to use the field located
immediately prior to the type as length/tag.

The fact that those types need to explicitly contain their length/tag
name ties the sequence/variant type to where it is placed within the
structure fields, preventing re-use of the sequence/variant type.

In order to reduce the memory footprint of the field descriptions and
allow re-use of common field types, special-case the NULL length name
and tag name to use the field prior to the sequence/variant as length.

This allows more efficient type descriptions without reducing the
overall flexibility of sequence/variant layout.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I27053e8541beb4f8f8226e411c71595f7527f533

2 years agoVersion 2.13.0-rc1 v2.13.0-rc1
Mathieu Desnoyers [Sat, 24 Apr 2021 01:13:26 +0000 (21:13 -0400)] 
Version 2.13.0-rc1

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Iebcfdc3cfd2ca16e59107ff7688850239c6a08e9

2 years agoSet the 2.13 release codename and description
Mathieu Desnoyers [Sat, 24 Apr 2021 00:56:57 +0000 (20:56 -0400)] 
Set the 2.13 release codename and description

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I53fbb76eaaac57710cb0bd348eab32fc3c2b93dd

2 years agoFix: LTTng-modules ABI ioctl wrong direction
Mathieu Desnoyers [Tue, 20 Apr 2021 15:05:19 +0000 (11:05 -0400)] 
Fix: LTTng-modules ABI ioctl wrong direction

lttng-modules defines ioctl numbers (include/lttng/abi.h) using the
_IO*() macros. These macros are partly used to specify what type of
parameters that the ioctl will be expecting. It also specifies the
direction of the data flow.

    1. sending data from userspace to the kernel,
    2. sending data from the kernel to userspace,
    3. both.

According to the kernel's
Documentation/userspace-api/ioctl/ioctl-number.rst file here is the
meaning of the various macros:

 ====== == ============================================
 _IO    an ioctl with no parameters
 _IOW   an ioctl with write parameters (copy_from_user)
 _IOR   an ioctl with read parameters  (copy_to_user)
 _IOWR  an ioctl with both write and read parameters.
 ====== == ============================================

Some of our use of these macros are wrong. In some cases, we use _IOW()
when we should be using _IOR():

Here is a list of the ioctl numbers that should be _IOW() as they are
sending data to the kernel:

 #define LTTNG_KERNEL_SESSION_TRACK_PID      IOR(0xF6, 0x58, int32_t)
 #define LTTNG_KERNEL_SESSION_UNTRACK_PID    _IOR(0xF6, 0x59, int32_t)
 #define LTTNG_KERNEL_SESSION_SET_NAME       _IOR(0xF6, 0x5D, struct lttng_kernel_session_name)
 #define LTTNG_KERNEL_SESSION_SET_CREATION_TIME   _IOR(0xF6, 0x5E, struct lttng_kernel_session_creation_time)
 #define LTTNG_KERNEL_SESSION_LIST_TRACKER_IDS  _IOR(0xF6, 0xA0, struct lttng_kernel_tracker_args)
 #define LTTNG_KERNEL_SESSION_TRACK_ID          _IOR(0xF6, 0xA1, struct lttng_kernel_tracker_args)
 #define LTTNG_KERNEL_SESSION_UNTRACK_ID        _IOR(0xF6, 0xA2, struct lttng_kernel_tracker_args)

Fix this by changing the direction of the macros, but introduce "_OLD"
macros for backward compatibility.

User-space should gradually start interacting with the correct ioctl
direction. However, in order to preserve compatibility between newer
user-space tools and older lttng-modules, user-space should fall-back on
the "_OLD" ioctl directions if the new directions are not implemented by
an older lttng-modules.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I70d1963464597e0e3b028a67739d4a13b96c1ea5

2 years agoRefactoring: bytecode interpreter
Mathieu Desnoyers [Fri, 23 Apr 2021 00:37:14 +0000 (20:37 -0400)] 
Refactoring: bytecode interpreter

Refactor bytecode interpreter to combine more code between filter and
capture interpreters.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ic9fe054ef4cbbef578e1e2c396bdadce221b9c6f

2 years agoMove probe_ctx argument to align with lttng-ust
Mathieu Desnoyers [Thu, 22 Apr 2021 21:49:54 +0000 (17:49 -0400)] 
Move probe_ctx argument to align with lttng-ust

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: If020f8a982ab66b7a041300b6dc11aa00ce803db

2 years agoCombine event notifier and recorder enable/disable functions
Mathieu Desnoyers [Thu, 22 Apr 2021 20:17:54 +0000 (16:17 -0400)] 
Combine event notifier and recorder enable/disable functions

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I945b24211b48b9d40b1d25f0c9fb78f6eb8439da

2 years agoRefactoring: combine probe callbacks
Mathieu Desnoyers [Thu, 22 Apr 2021 17:52:43 +0000 (13:52 -0400)] 
Refactoring: combine probe callbacks

Combine probe callbacks for event recorder and notifier. Also combine
the code for args vs noargs probes, shrinking the number of probe
implementations from 4 to 1.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ic7c0494ffd171caca33cfd13a8a40771691d89b5

2 years agoCombine event recorder and notifier destroy
Mathieu Desnoyers [Thu, 22 Apr 2021 17:20:04 +0000 (13:20 -0400)] 
Combine event recorder and notifier destroy

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I8a7e18d98286ddc1bf132cd39039658c9b669f51

2 years agoRefactoring: event structures
Mathieu Desnoyers [Thu, 15 Apr 2021 12:23:17 +0000 (08:23 -0400)] 
Refactoring: event structures

Combine event recorder and event notifier structures common parts into a
"common" parent structure. Move "internal" fields not meant to be
touched by the probes into private structures.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I1fd8fdb976664ff7cbdf6efdb0c51705682b8560

2 years agolttng-probes: Warn of event's and provider's name for mismatch
He Zhe [Mon, 19 Apr 2021 09:16:57 +0000 (09:16 +0000)] 
lttng-probes: Warn of event's and provider's name for mismatch

We have experience serveral cases of such mismatches. To make it easier to
debug, let's warn users of the event's and the provide's name.

Signed-off-by: He Zhe <zhe.he@windriver.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I455bf92f9f735f890753c9103d22986e56e02e5d

2 years agofix: mm, tracing: kfree event name mismatching with provider kmem (v5.12)
He Zhe [Mon, 19 Apr 2021 09:09:28 +0000 (09:09 +0000)] 
fix: mm, tracing: kfree event name mismatching with provider kmem (v5.12)

a8bc8ae5c932 ("fix: mm, tracing: record slab name for kmem_cache_free() (v5.12)")
introduces the following call trace for kfree. This is caused by mismatch
between kfree event and its provider kmem.

This patch maps kfree to kmem_kfree.

WARNING: CPU: 2 PID: 42294 at src/lttng-probes.c:81 fixup_lazy_probes+0xb0/0x1b0 [lttng_tracer]
CPU: 2 PID: 42294 Comm: modprobe Tainted: G           O      5.12.0-rc6-yoctodev-standard #1
Hardware name: Intel Corporation JACOBSVILLE/JACOBSVILLE, BIOS JBVLCRB2.86B.0014.P20.2004020248 04/02/2020
RIP: 0010:fixup_lazy_probes+0xb0/0x1b0 [lttng_tracer]
Code: 75 28 83 c3 01 3b 5d c4 74 22 48 8b 4d d0 48 63
      c3 4c 89 e2 4c 89 f6 48 8b 04 c1 4c 8b 38 4c 89
      ff e8 64 9f 4b de 85 c0 74 c3 <0f> 0b 48 8b 05 bf
      f2 1e 00 48 8d 50 e8 48 3d f0 a0 98 c0 75 18 eb
RSP: 0018:ffffb976807bfbe0 EFLAGS: 00010286
RAX: 00000000ffffffff RBX: 0000000000000004 RCX: 0000000000000004
RDX: 0000000000000066 RSI: ffffffffc03c10a7 RDI: ffffffffc03c11a1
RBP: ffffb976807bfc28 R08: 0000000000000000 R09: 0000000000000001
R10: 0000000000000001 R11: 0000000000000001 R12: 0000000000000004
R13: ffffffffc03c2000 R14: ffffffffc03c10a7 R15: ffffffffc03c11a1
FS:  00007f0ef9533740(0000) GS:ffffa100faa00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000561e8f0aa000 CR3: 000000015b318000 CR4: 0000000000350ee0
Call Trace:
 lttng_probe_register+0x38/0xe0 [lttng_tracer]
 ? __event_probe__module_load+0x520/0x520 [lttng_probe_module]
 __lttng_events_init__module+0x15/0x20 [lttng_probe_module]
 do_one_initcall+0x68/0x310
 ? kmem_cache_alloc_trace+0x2ad/0x4c0
 ? do_init_module+0x28/0x280
 do_init_module+0x62/0x280
 load_module+0x26e4/0x2920
 ? kernel_read_file+0x22e/0x290
 __do_sys_finit_module+0xb1/0xf0
 __x64_sys_finit_module+0x1a/0x20
 do_syscall_64+0x38/0x50
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Signed-off-by: He Zhe <zhe.he@windriver.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I00e8ee2b8c35f6f8602c88295f5113fbbd139709

3 years agofix: refactor contexts for type description structures
Michael Jeanson [Thu, 15 Apr 2021 15:29:06 +0000 (11:29 -0400)] 
fix: refactor contexts for type description structures

The 'preemptible' and 'migratable' contexts were not refactored along
the others in :

  commit 437d5aa59380583ce1cd14d394a53b398be1275d
  Author: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
  Date:   Wed Apr 7 14:52:27 2021 -0400

    Refactoring: type description structures

Change-Id: I8a228c0ff982a4aded27b055baae1f5efec29164
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agofix: remove 'src/' from modules install path
Michael Jeanson [Tue, 16 Feb 2021 21:51:47 +0000 (16:51 -0500)] 
fix: remove 'src/' from modules install path

The move of the modules sources in the 'src/' subdirectory had the
unexpected side effect of adding 'src/' to the module install path
inside '/lib/modules/$(uname -r)/extra'. Adjust the Makefiles to return
to the initial behavior.

Change-Id: I280fe8a1e5ef367edeec0a6351351a233cc6f0be
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ifcc64ea95c0e1435567150d976d42e3add3f7523

3 years agofix: Adjust ranges for Ubuntu 5.4.0-67 kernel
Michael Jeanson [Thu, 15 Apr 2021 14:53:21 +0000 (10:53 -0400)] 
fix: Adjust ranges for Ubuntu 5.4.0-67 kernel

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ifa0f50ffdc946d80b67bb5ae7ca4b0aa152e825b

3 years agofix: block: add a disk_uevent helper (v5.12)
Michael Jeanson [Mon, 15 Mar 2021 18:54:02 +0000 (14:54 -0400)] 
fix: block: add a disk_uevent helper (v5.12)

See upstream commit:

  commit bc359d03c7ec1bf3b86d03bafaf6bbb21e6414fd
  Author: Christoph Hellwig <hch@lst.de>
  Date:   Sun Jan 24 11:02:39 2021 +0100

    block: add a disk_uevent helper

    Add a helper to call kobject_uevent for the disk and all partitions, and
    unexport the disk_part_iter_* helpers that are now only used in the core
    block code.

Change-Id: If6e8797049642ab382d5699660ee1dd734e92c90
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoFix: perf counters: uninitialized field
Mathieu Desnoyers [Thu, 15 Apr 2021 13:39:30 +0000 (09:39 -0400)] 
Fix: perf counters: uninitialized field

Reported by Coverity:
** CID 1452572:  Uninitialized variables  (UNINIT)
>>>     Using uninitialized value "ctx_field". Field "ctx_field.get_size_arg" is uninitialized when calling "lttng_kernel_context_append".

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I064260c6fe78af24768bb141fde2864d2abbe3a5

3 years agoCleanup: implement dedicated file operations for events and enablers
Mathieu Desnoyers [Wed, 14 Apr 2021 19:02:10 +0000 (15:02 -0400)] 
Cleanup: implement dedicated file operations for events and enablers

In order to simplify the code in preparation for refactoring of the
event structures, remove the "event type" field and implement specific
file operations for events and enablers.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I508bdb46fa3747112e7cfef4a62278fb566f842a

3 years agoNamespace LTTng modules ABI with lttng_kernel_abi_ prefix
Mathieu Desnoyers [Wed, 14 Apr 2021 17:52:07 +0000 (13:52 -0400)] 
Namespace LTTng modules ABI with lttng_kernel_abi_ prefix

Standardize on lttng_kernel_abi_ prefix for the lttng modules ABI to
eliminate namespace clash between lttng-modules core code and its ABI.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I3b1c8d6f46702e57defa17d683ede576466ba3ce

3 years agoRefactoring: type description structures
Mathieu Desnoyers [Wed, 7 Apr 2021 18:52:27 +0000 (14:52 -0400)] 
Refactoring: type description structures

Refactoring:

- Type description structures: new API based on structure inheritance
  rather than union,
- Rely on compound literals,
- Rename description fields: name -> event_name,
- Rename types (lttng_kernel_ namespace):
  - struct lttng_kernel_event_desc,
  - struct lttng_kernel_event_field,
  - struct lttng_kernel_ctx.
- Move some internal definitions (not used by probes) to
  events-internal.h.
- Streamline context registration API,
- Introduce the LTTNG_CREATE_FIELD_METADATA define for the tracepoint
  code generation pass which generates the type descriptions, allowing
  to describe structures as an array of fields, and use enumerations
  from those fields.
- Adapt all tracepoint instrumentation to those changes.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I9a968a62888c52438a1f62ec24fcced4c3fd6ddf

3 years agoPrefix lttng_enum_desc with lttng_kernel_
Mathieu Desnoyers [Wed, 7 Apr 2021 18:02:09 +0000 (14:02 -0400)] 
Prefix lttng_enum_desc with lttng_kernel_

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I25b7160875c99c99c18d1e559b09698b5411dae7

3 years agoPrefix lttng_enum_value and lttng_enum_entry with lttng_kernel_
Mathieu Desnoyers [Wed, 7 Apr 2021 18:00:37 +0000 (14:00 -0400)] 
Prefix lttng_enum_value and lttng_enum_entry with lttng_kernel_

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I4b4d502e2af9a1ca6425889da2697c5633200f52

3 years agoIntroduce internal event header
Mathieu Desnoyers [Wed, 7 Apr 2021 17:51:28 +0000 (13:51 -0400)] 
Introduce internal event header

This header is to be included by the tracer, but not by tracepoint
probes.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ic9501bb58c4156d3b037b4f15251d03e25cd45f9

3 years agoCleanup: namespace string encoding
Mathieu Desnoyers [Wed, 7 Apr 2021 17:47:03 +0000 (13:47 -0400)] 
Cleanup: namespace string encoding

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ic7265a6617feaacfe621d895cd0bc8ce2b50d912

3 years agoCleanup: Rename abstract types to lttng_kernel_type
Mathieu Desnoyers [Wed, 7 Apr 2021 17:40:46 +0000 (13:40 -0400)] 
Cleanup: Rename abstract types to lttng_kernel_type

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Iac1810c9d9830d80109fe72b1965b7b7cf663207

3 years agoCleanup: event_notifier -> notify in comments
Mathieu Desnoyers [Wed, 7 Apr 2021 15:07:29 +0000 (11:07 -0400)] 
Cleanup: event_notifier -> notify in comments

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Icdb4282e8b5fce231f96c56b4568555bd7a442fb

3 years agoFix: event notifier: add missing parameters validation
Mathieu Desnoyers [Wed, 7 Apr 2021 15:05:32 +0000 (11:05 -0400)] 
Fix: event notifier: add missing parameters validation

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Idbbbe369f64c14e7ac8914b4e7eb8e3ef75b1fb5

3 years agomsgpack: use KERNEL namespace for header protection
Mathieu Desnoyers [Fri, 9 Apr 2021 15:50:41 +0000 (11:50 -0400)] 
msgpack: use KERNEL namespace for header protection

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I8a3ee5bd935442dc5d3fcaff97859406279eb73d

This page took 0.044987 seconds and 4 git commands to generate.