lttng-modules.git
2 years agoVersion 2.13.2 v2.13.2
Mathieu Desnoyers [Mon, 7 Mar 2022 20:54:28 +0000 (15:54 -0500)] 
Version 2.13.2

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

2 years agoFix: incorrect in/out direction for syscall exit
Mathieu Desnoyers [Mon, 10 May 2021 15:01:02 +0000 (11:01 -0400)] 
Fix: incorrect in/out direction for syscall exit

Syscall exit should fetch the "sc_out" parameters. This issue was
introduced by commit e42c4f49c15b ("Split syscall tracepoint generation in their own files").

Fixes: e42c4f49c15b ("Split syscall tracepoint generation in their own files")
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ib34912005323ea34b6d11ca9acc5edf491649cdd

2 years agofix: net: socket: rename SKB_DROP_REASON_SOCKET_FILTER (v5.17)
Michael Jeanson [Mon, 31 Jan 2022 15:47:53 +0000 (10:47 -0500)] 
fix: net: socket: rename SKB_DROP_REASON_SOCKET_FILTER (v5.17)

No version check needed since this change is between two RCs, see
upstream commit :

  commit 364df53c081d93fcfd6b91085ff2650c7f17b3c7
  Author: Menglong Dong <imagedong@tencent.com>
  Date:   Thu Jan 27 17:13:01 2022 +0800

    net: socket: rename SKB_DROP_REASON_SOCKET_FILTER

    Rename SKB_DROP_REASON_SOCKET_FILTER, which is used
    as the reason of skb drop out of socket filter before
    it's part of a released kernel. It will be used for
    more protocols than just TCP in future series.

Link: https://lore.kernel.org/all/20220127091308.91401-2-imagedong@tencent.com/
Change-Id: I666461a5b541fe9e0bf53ad996ce33237af4bfbb
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agofix: net: skb: introduce kfree_skb_reason() (v5.17)
Michael Jeanson [Wed, 26 Jan 2022 19:49:11 +0000 (14:49 -0500)] 
fix: net: skb: introduce kfree_skb_reason() (v5.17)

See upstream commit :

  commit c504e5c2f9648a1e5c2be01e8c3f59d394192bd3
  Author: Menglong Dong <imagedong@tencent.com>
  Date:   Sun Jan 9 14:36:26 2022 +0800

    net: skb: introduce kfree_skb_reason()

    Introduce the interface kfree_skb_reason(), which is able to pass
    the reason why the skb is dropped to 'kfree_skb' tracepoint.

    Add the 'reason' field to 'trace_kfree_skb', therefor user can get
    more detail information about abnormal skb with 'drop_monitor' or
    eBPF.

    All drop reasons are defined in the enum 'skb_drop_reason', and
    they will be print as string in 'kfree_skb' tracepoint in format
    of 'reason: XXX'.

    ( Maybe the reasons should be defined in a uapi header file, so that
    user space can use them? )

Change-Id: I6766678a288da959498a4736fc3f95bf239c3e94
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agofix: random: rather than entropy_store abstraction, use global (v5.17)
Michael Jeanson [Wed, 26 Jan 2022 19:53:41 +0000 (14:53 -0500)] 
fix: random: rather than entropy_store abstraction, use global (v5.17)

See upstream commit :

  commit 90ed1e67e896cc8040a523f8428fc02f9b164394
  Author: Jason A. Donenfeld <Jason@zx2c4.com>
  Date:   Wed Jan 12 17:18:08 2022 +0100

    random: rather than entropy_store abstraction, use global

    Originally, the RNG used several pools, so having things abstracted out
    over a generic entropy_store object made sense. These days, there's only
    one input pool, and then an uneven mix of usage via the abstraction and
    usage via &input_pool. Rather than this uneasy mixture, just get rid of
    the abstraction entirely and have things always use the global. This
    simplifies the code and makes reading it a bit easier.

Change-Id: I1a2a14d7b6e69a047804e1e91e00fe002f757431
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agofix: btrfs: pass fs_info to trace_btrfs_transaction_commit (v5.17)
Michael Jeanson [Wed, 26 Jan 2022 19:37:52 +0000 (14:37 -0500)] 
fix: btrfs: pass fs_info to trace_btrfs_transaction_commit (v5.17)

See upstream commit :

  commit 2e4e97abac4c95f8b87b2912ea013f7836a6f10b
  Author: Josef Bacik <josef@toxicpanda.com>
  Date:   Fri Nov 5 16:45:29 2021 -0400

    btrfs: pass fs_info to trace_btrfs_transaction_commit

    The root on the trans->root can be anything, and generally we're
    committing from the transaction kthread so it's usually the tree_root.
    Change this to just take an fs_info, and to maintain compatibility
    simply put the ROOT_TREE_OBJECTID as the root objectid for the
    tracepoint.  This will allow use to remove trans->root.

Change-Id: Ie5a4804330edabffac0714fcb9c25b8c8599e424
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agofix: mm: compaction: fix the migration stats in trace_mm_compaction_migratepages...
Michael Jeanson [Sun, 23 Jan 2022 18:26:17 +0000 (13:26 -0500)] 
fix: mm: compaction: fix the migration stats in trace_mm_compaction_migratepages() (v5.17)

See upstream commit :

  commit 84b328aa81216e08804d8875d63f26bda1298788
  Author: Baolin Wang <baolin.wang@linux.alibaba.com>
  Date:   Fri Jan 14 14:08:40 2022 -0800

    mm: compaction: fix the migration stats in trace_mm_compaction_migratepages()

    Now the migrate_pages() has changed to return the number of {normal
    page, THP, hugetlb} instead, thus we should not use the return value to
    calculate the number of pages migrated successfully.  Instead we can
    just use the 'nr_succeeded' which indicates the number of normal pages
    migrated successfully to calculate the non-migrated pages in
    trace_mm_compaction_migratepages().

Link: https://lkml.kernel.org/r/b4225251c4bec068dcd90d275ab7de88a39e2bd7.1636275127.git.baolin.wang@linux.alibaba.com
Change-Id: Ib8e8f2a16a273f16cd73fe63afbbfc25c0a2540c
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agofix: block: remove the ->rq_disk field in struct request (v5.17)
Michael Jeanson [Sun, 23 Jan 2022 18:11:47 +0000 (13:11 -0500)] 
fix: block: remove the ->rq_disk field in struct request (v5.17)

See upstream commit :

  commit f3fa33acca9f0058157214800f68b10d8e71ab7a
  Author: Christoph Hellwig <hch@lst.de>
  Date:   Fri Nov 26 13:18:00 2021 +0100

    block: remove the ->rq_disk field in struct request

    Just use the disk attached to the request_queue instead.

Link: https://lore.kernel.org/r/20211126121802.2090656-4-hch@lst.de
Change-Id: I24263be519d1b51f4b00bd95f14a9aeb8457889a
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agofix: block: remove GENHD_FL_SUPPRESS_PARTITION_INFO (v5.17)
Michael Jeanson [Sun, 23 Jan 2022 18:04:47 +0000 (13:04 -0500)] 
fix: block: remove GENHD_FL_SUPPRESS_PARTITION_INFO (v5.17)

See upstream commit :

  commit 3b5149ac50970669ee0ddb9629ec77ffd5c0622d
  Author: Christoph Hellwig <hch@lst.de>
  Date:   Mon Nov 22 14:06:21 2021 +0100

    block: remove GENHD_FL_SUPPRESS_PARTITION_INFO

    This flag is not set directly anywhere and only inherited from
    GENHD_FL_HIDDEN.  Just check for GENHD_FL_HIDDEN instead.

Link: https://lore.kernel.org/r/20211122130625.1136848-11-hch@lst.de
Change-Id: Ide92bdaaff7d16e96be23aaf00cebeaa601235b7
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agoCopyright ownership transfer
Mathieu Desnoyers [Fri, 14 Jan 2022 20:02:42 +0000 (15:02 -0500)] 
Copyright ownership transfer

Apply copyright ownership transfer from Julien Desfossez to EfficiOS Inc.

Link: https://lists.lttng.org/pipermail/lttng-dev/2022-January/030092.html
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Julien Desfossez <ju@klipix.org>
Signed-off-by: Julien Desfossez <ju@klipix.org>
Change-Id: Ida168b1fbe6589cb371a549ef14d9b4b28b221b3

2 years agoVersion 2.13.1 v2.13.1
Mathieu Desnoyers [Wed, 5 Jan 2022 18:48:46 +0000 (13:48 -0500)] 
Version 2.13.1

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

2 years agofix: mm: move kvmalloc-related functions to slab.h (v5.16)
Michael Jeanson [Tue, 14 Dec 2021 19:44:35 +0000 (14:44 -0500)] 
fix: mm: move kvmalloc-related functions to slab.h (v5.16)

See upstream commit :

  commit 8587ca6f34152ea650bad4b2db68456601159024
  Author: Matthew Wilcox (Oracle) <willy@infradead.org>
  Date:   Fri Nov 5 13:35:07 2021 -0700

    mm: move kvmalloc-related functions to slab.h

    Not all files in the kernel should include mm.h.  Migrating callers from
    kmalloc to kvmalloc is easier if the kvmalloc functions are in slab.h.

    [akpm@linux-foundation.org: move the new kvrealloc() also]
    [akpm@linux-foundation.org: drivers/hwmon/occ/p9_sbe.c needs slab.h]

Link: https://lkml.kernel.org/r/20210622215757.3525604-1-willy@infradead.org
Change-Id: I84e885ffbd1e2ff551a4738950e0c9462551b853
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agofix: block: don't call blk_status_to_errno in blk_update_request (v5.16)
Michael Jeanson [Tue, 14 Dec 2021 20:13:20 +0000 (15:13 -0500)] 
fix: block: don't call blk_status_to_errno in blk_update_request (v5.16)

See upstream commit :

  commit 8a7d267b4a2c71a5ff5dd9046abea7117c7d0ac2
  Author: Christoph Hellwig <hch@lst.de>
  Date:   Mon Oct 18 10:45:18 2021 +0200

    block: don't call blk_status_to_errno in blk_update_request

    We only need to call it to resolve the blk_status_t -> errno mapping for
    tracing, so move the conversion into the tracepoints that are not called
    at all when tracing isn't enabled.

Change-Id: Ic556cee1d82e44a93a1467f55d45b6e17a48d387
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agofix: KVM: MMU: change tracepoints arguments to kvm_page_fault (v5.16)
Michael Jeanson [Tue, 14 Dec 2021 20:06:51 +0000 (15:06 -0500)] 
fix: KVM: MMU: change tracepoints arguments to kvm_page_fault (v5.16)

See upstream commit :

  commit f0066d94c92dc5cf7f1a272a1bd324b0fc575292
  Author: Paolo Bonzini <pbonzini@redhat.com>
  Date:   Fri Aug 6 04:35:50 2021 -0400

    KVM: MMU: change tracepoints arguments to kvm_page_fault

    Pass struct kvm_page_fault to tracepoints instead of extracting the
    arguments from the struct.  This also lets the kvm_mmu_spte_requested
    tracepoint pick the gfn directly from fault->gfn, instead of using
    the address.

Change-Id: I5ee3f344a8d1cd0ed185cdeecb3a3121183c9b43
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agofix: KVM: x86: Get exit_reason as part of kvm_x86_ops.get_exit_info (v5.16)
Michael Jeanson [Tue, 14 Dec 2021 20:00:18 +0000 (15:00 -0500)] 
fix: KVM: x86: Get exit_reason as part of kvm_x86_ops.get_exit_info (v5.16)

See upstream commit :

  commit 0a62a0319abb92c89a4f91c2dbfcaee4e47f37ca
  Author: David Edmondson <david.edmondson@oracle.com>
  Date:   Mon Sep 20 11:37:35 2021 +0100

    KVM: x86: Get exit_reason as part of kvm_x86_ops.get_exit_info

    Extend the get_exit_info static call to provide the reason for the VM
    exit. Modify relevant trace points to use this rather than extracting
    the reason in the caller.

Change-Id: I28903e658eb7cbfc6666e35ba4cffba5e49d1445
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agofix: isystem: delete global -isystem compile option (v5.16)
Michael Jeanson [Tue, 14 Dec 2021 19:46:45 +0000 (14:46 -0500)] 
fix: isystem: delete global -isystem compile option (v5.16)

See upstream commit :

  commit 04e85bbf71c9072dcf0ad9a7150495d72461105c
  Author: Alexey Dobriyan <adobriyan@gmail.com>
  Date:   Mon Aug 2 23:43:15 2021 +0300

    isystem: delete global -isystem compile option

    Further isolate kernel from userspace, prevent accidental inclusion of
    undesireable headers, mainly float.h and stdatomic.h.

    nds32 keeps -isystem globally due to intrinsics used in entrenched header.

    -isystem is selectively reenabled for some files, again, for intrinsics.

Change-Id: I5bea29687dc2bc15e96eeb13008aefe1acc97b8a
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agofix: block: move block-related definitions out of fs.h (v5.16)
Michael Jeanson [Tue, 14 Dec 2021 19:43:26 +0000 (14:43 -0500)] 
fix: block: move block-related definitions out of fs.h (v5.16)

See upstream commit :

  commit 3f1266f1f82d7b8c72472a8921e80aa3e611fb62
  Author: Christoph Hellwig <hch@lst.de>
  Date:   Sat Jun 20 09:16:41 2020 +0200

    block: move block-related definitions out of fs.h

    Move most of the block related definition out of fs.h into more suitable
    headers.

Change-Id: I8d072406a04f549d1ddb0f2ac392deaabbb26a92
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agoFix: syscall tracing: missing trigger actions
Mathieu Desnoyers [Wed, 1 Dec 2021 20:56:40 +0000 (15:56 -0500)] 
Fix: syscall tracing: missing trigger actions

Observed issue
==============

There is an issue when associating multiple actions to a single system
call, where the first action is effectively added, but the following
actions are silently ignored.

Cause
=====

The is caused by event creation of the 2nd event to be skipped because
lttng_syscall_filter_enable returns "-EBUSY", because the bit is already
set in the bitmap.

Solution
========

Fixing this double-add-trigger scenario requires changes to how the
lttng_syscall_filter_enable -EBUSY errors are dealt with on event
creation, but the problem runs deeper.

Given that many events may be responsible for requiring a bit to be set
in the bitmap of the syscall filter, we cannot simply clear the bit
whenever one event is disabled

Otherwise, this will cause situations where all events for a given
system call are disabled (due to the syscall filter bit being cleared)
whenever one single event for that system call is disabled (e.g. 2
triggers on the same system call, but with different actions).

We need to keep track of all events associated with this bit in the
bitmap, and only clear the bit when the reference count reaches 0.
This fixes the double-add-trigger issue by enturing that no -EBUSY
is returned when creating the second event, and fixes the
double-add-trigger-then-remove-trigger scenario as well.

Known drawbacks
===============

None.

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

2 years agoWarn on event registration/unregistration failure
Mathieu Desnoyers [Wed, 1 Dec 2021 20:55:15 +0000 (15:55 -0500)] 
Warn on event registration/unregistration failure

Warn whenever event registration/unregistration fails, including when
synchonizing the event list.

Silently ignoring errors makes identification of those failures tricky.

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

2 years agofix: implicit-int error in EXPORT_SYMBOL_GPL
Daniel Gomez [Fri, 8 Oct 2021 17:38:02 +0000 (19:38 +0200)] 
fix: implicit-int error in EXPORT_SYMBOL_GPL

Add module header to fix error:
error: type defaults to 'int' in declaration of 'EXPORT_SYMBOL_GPL'
[-Werror=implicit-int]

Log:
/workdir/build/workspace/sources/lttng-modules/src/wrapper/random.c:54:1:
warning: data definition has no type or storage class
   54 EXPORT_SYMBOL_GPL(wrapper_get_bootid);
      ^~~~~~~~~~~~~~~~~
/workdir/build/workspace/sources/lttng-modules/src/wrapper/random.c:54:1:
error: type defaults to 'int' in declaration of 'EXPORT_SYMBOL_GPL'
[-Werror=implicit-int]
/workdir/build/workspace/sources/lttng-modules/src/wrapper/random.c:54:1:
warning: parameter names (without types) in function declaration
cc1: some warnings being treated as errors
make[3]: ***
[/workdir/build/tmp/work-shared/qt5222/kernel-source/scripts/Makefile.build:271:
/workdir/build/workspace/sources/lttng-modules/src/wrapper/random.o]

Signed-off-by: Daniel Gomez <daniel@qtec.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: If1b96f6fcc19988b94dc09b12d071f2c61491b83

2 years agofix: Revert "Makefile: Enable -Wimplicit-fallthrough for Clang" (v5.15)
Michael Jeanson [Mon, 13 Sep 2021 18:16:22 +0000 (14:16 -0400)] 
fix: Revert "Makefile: Enable -Wimplicit-fallthrough for Clang" (v5.15)

Starting with v5.15, "-Wimplicit-fallthrough=5" was added to the build
flags which requires the use of "__attribute__((__fallthrough__))" to
annotate fallthrough case statements.

See upstream commit by the man himself:

  commit d936eb23874433caa3e3d841cfa16f5434b85dcf
  Author: Linus Torvalds <torvalds@linux-foundation.org>
  Date:   Thu Jul 15 18:05:31 2021 -0700

    Revert "Makefile: Enable -Wimplicit-fallthrough for Clang"

    This reverts commit b7eb335e26a9c7f258c96b3962c283c379d3ede0.

    It turns out that the problem with the clang -Wimplicit-fallthrough
    warning is not about the kernel source code, but about clang itself, and
    that the warning is unusable until clang fixes its broken ways.

    In particular, when you enable this warning for clang, you not only get
    warnings about implicit fallthroughs.  You also get this:

       warning: fallthrough annotation in unreachable code [-Wimplicit-fallthrough]

    which is completely broken becasue it

     (a) doesn't even tell you where the problem is (seriously: no line
         numbers, no filename, no nothing).

     (b) is fundamentally broken anyway, because there are perfectly valid
         reasons to have a fallthrough statement even if it turns out that
         it can perhaps not be reached.

    In the kernel, an example of that second case is code in the scheduler:

                    switch (state) {
                    case cpuset:
                            if (IS_ENABLED(CONFIG_CPUSETS)) {
                                    cpuset_cpus_allowed_fallback(p);
                                    state = possible;
                                    break;
                            }
                            fallthrough;
                    case possible:

    where if CONFIG_CPUSETS is enabled you actually never hit the
    fallthrough case at all.  But that in no way makes the fallthrough
    wrong.

    So the warning is completely broken, and enabling it for clang is a very
    bad idea.

    In the meantime, we can keep the gcc option enabled, and make the gcc
    build use

        -Wimplicit-fallthrough=5

    which means that we will at least continue to require a proper
    fallthrough statement, and that gcc won't silently accept the magic
    comment versions. Because gcc does this all correctly, and while the odd
    "=5" part is kind of obscure, it's documented in [1]:

      "-Wimplicit-fallthrough=5 doesn’t recognize any comments as
       fallthrough comments, only attributes disable the warning"

    so if clang ever fixes its bad behavior we can try enabling it there again.

Change-Id: Iea69849592fb69ac04fb9bb28efcd6b8dce8ba88
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 years agofix: cpu/hotplug: Remove deprecated CPU-hotplug functions. (v5.15)
Michael Jeanson [Mon, 13 Sep 2021 16:00:38 +0000 (12:00 -0400)] 
fix: cpu/hotplug: Remove deprecated CPU-hotplug functions. (v5.15)

The CPU-hotplug functions get|put_online_cpus() were deprecated in v4.13
and removed in v5.15.

See upstream commits :

commit 8c854303ce0e38e5bbedd725ff39da7e235865d8
Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date:   Tue Aug 3 16:16:21 2021 +0200

    cpu/hotplug: Remove deprecated CPU-hotplug functions.

    No users in tree use the deprecated CPU-hotplug functions anymore.

    Remove them.

Introduced in v4.13 :

  commit 8f553c498e1772cccb39a114da4a498d22992758
  Author: Thomas Gleixner <tglx@linutronix.de>
  Date:   Wed May 24 10:15:12 2017 +0200

    cpu/hotplug: Provide cpus_read|write_[un]lock()

    The counting 'rwsem' hackery of get|put_online_cpus() is going to be
    replaced by percpu rwsem.

    Rename the functions to make it clear that it's locking and not some
    refcount style interface. These new functions will be used for the
    preparatory patches which make the code ready for the percpu rwsem
    conversion.

    Rename all instances in the cpu hotplug code while at it.

Change-Id: I5a37cf5afc075a402b7347989fac637dfa60a1ed
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
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

3 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

3 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

3 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

3 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

3 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

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