lttng-modules.git
3 years agofix: Add one digit to SLES minor release version
Michael Jeanson [Tue, 9 Feb 2021 16:25:57 +0000 (11:25 -0500)] 
fix: Add one digit to SLES minor release version

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

3 years agofix: RT_PATCH_VERSION is close to overflow
Michael Jeanson [Mon, 8 Feb 2021 20:32:47 +0000 (15:32 -0500)] 
fix: RT_PATCH_VERSION is close to overflow

We allocated only 8bits for RT_PATCH_VERSION in LTTNG_RT_VERSION_CODE,
the current RT patch version for the 4.4 branch is currently 214 which
is getting close to 256. Bump it to 16bits to avoid breakage in the
future.

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

3 years agofix: cast LTTNG_KERNEL_VERSION/LTTNG_LINUX_VERSION_CODE to uint64_t
Michael Jeanson [Tue, 9 Feb 2021 16:04:25 +0000 (11:04 -0500)] 
fix: cast LTTNG_KERNEL_VERSION/LTTNG_LINUX_VERSION_CODE to uint64_t

Cast our version macros to an unsigned 64bits value to prevent
overflowing when we append distro specific version information.

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

3 years agofix: double defined LTTNG_KERNEL_VERSION
Michael Jeanson [Tue, 9 Feb 2021 15:53:34 +0000 (10:53 -0500)] 
fix: double defined LTTNG_KERNEL_VERSION

Cleanup a rebase error which resulted in double defined macros.

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

3 years agofix: UTS_UBUNTU_RELEASE_ABI is close to overflow
Michael Jeanson [Fri, 5 Feb 2021 20:21:55 +0000 (15:21 -0500)] 
fix: UTS_UBUNTU_RELEASE_ABI is close to overflow

We allocated only 8bits for UTS_UBUNTU_RELEASE_ABI in
LTTNG_UBUNTU_KERNEL_VERSION, the current Xenial kernel has an ABI of 207
which is getting close to 256. Bump it to 16bits to avoid breakage in
the future.

Change-Id: Iee99757bb28cdd958b044b31df3232b9f8816873
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agofix: sublevel version overflow in LINUX_VERSION_CODE
Michael Jeanson [Fri, 5 Feb 2021 17:08:40 +0000 (12:08 -0500)] 
fix: sublevel version overflow in LINUX_VERSION_CODE

The 4.4.256 and 4.9.256 stable release overflow the 8bits allocated to
the sublevel in LINUX_VERSION_CODE which ends means they report
themselves as 4.5.0 and 4.10.0 respectively. The next releases in these
stables branches will have sublevel clamped at 255 and will thus report
themselves as 4.4.255 and 4.9.255 for all subsequent releases.

We need a way to way to properly detect these release since I doubt they
will stop breaking tracepoints declarations. As a workaround, extract
the version information from the Makefile in the kernel headers and use
this information to generate a version code when the sublevel is equal
or greater than 256.

Change-Id: I96ae9f22c0c1ba8c619643946a5311c767fbcf8c
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoNamespace kernel version macros
Michael Jeanson [Fri, 5 Feb 2021 19:31:51 +0000 (14:31 -0500)] 
Namespace kernel version macros

This patch replaces all uses of the LINUX_VERSION_CODE and
KERNEL_VERSION macros by an 'LTTNG_' prefixed version, this will allow
us to override them.

Change-Id: If8fab7fe341dd35e2211d30427519a48dfb708f9
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoaarch64: blacklist gcc prior to 5.1
Mathieu Desnoyers [Fri, 22 Jan 2021 20:25:47 +0000 (15:25 -0500)] 
aarch64: blacklist gcc prior to 5.1

Linux aarch64 requires GCC 5.1 or better because prior versions perform
unsafe access to deallocated stack.

Some Linux distributions may have backported the fix, but it was never
released into earlier upstream gcc versions.

Link: https://lwn.net/Articles/842122/
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63293
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I72993e446f7f54f39d0f360273b68f194be8c13a

3 years agofix: missing include for 'task_struct' in fdtable.h
Michael Jeanson [Tue, 19 Jan 2021 16:34:25 +0000 (11:34 -0500)] 
fix: missing include for 'task_struct' in fdtable.h

In some kernel versions, linux/fdtable.h dereferences a pointer in a
forward declared 'struct task_struct' without an include of 'linux/sched.h'.

Add this missing include to the wrapper.

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

3 years agoFix: counter-api: always inline counter add function
Mathieu Desnoyers [Wed, 6 Jan 2021 20:07:01 +0000 (15:07 -0500)] 
Fix: counter-api: always inline counter add function

The counter add function uses cmpxchg() and cmpxchg_local() on 1, 2, 4,
and 8 bytes types.

In libcounter, the 8 bytes type is only supported on 64-bit
architectures, but the 1, 2, 4 byte type code is present for all
architectures, even though only the 4 byte code is currently used by
lttng-modules.

The ARM implementation of cmpxchg uses the "__bad_cmpxchg" linker error
to report use of cmpxchg on an unsupported size.

Considering that "inline" does not strictly mean always inline (depends
on CONFIG_OPTIMIZE_INLINING on some kernels, and does not mean forced
inlining in recent kernels), the compiler is free to generate a function
rather than perform inlining. If that happens, then the __bad_cmpxchg
linker error is generated even if the 1 and 2 bytes types are unused.

Therefore, use __always_inline for functions in counter-api.h to force
inlining, and therefore removal of unused code before linking, which is
required by this Linux kernel __bad_cmpxchg linker error trick.

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

3 years agofix: genirq: Restrict export of irq_to_desc() (v5.11)
Michael Jeanson [Mon, 18 Jan 2021 19:25:49 +0000 (14:25 -0500)] 
fix: genirq: Restrict export of irq_to_desc() (v5.11)

See upstream commit:

  commit 64a1b95bb9fe3ec76e1a2cd803eff06389341ae4
  Author: Thomas Gleixner <tglx@linutronix.de>
  Date:   Thu Dec 10 20:26:06 2020 +0100

    genirq: Restrict export of irq_to_desc()

    No more (ab)use in drivers finally. There is still the modular build of
    PPC/KVM which needs it, so restrict it to this case which still makes it
    unavailable for most drivers.

Link: https://lore.kernel.org/r/20201210194045.551428291@linutronix.de
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ie5a2af2f02ade07c73e1c7a8aa0fb155280b3d8b

3 years agofix: block: merge struct block_device and struct hd_struct (v5.11)
Michael Jeanson [Wed, 13 Jan 2021 19:27:41 +0000 (14:27 -0500)] 
fix: block: merge struct block_device and struct hd_struct (v5.11)

See upstream commit :

  commit 0d02129e76edf91cf04fabf1efbc3a9a1f1d729a
  Author: Christoph Hellwig <hch@lst.de>
  Date:   Fri Nov 27 16:43:51 2020 +0100

    block: merge struct block_device and struct hd_struct

    Instead of having two structures that represent each block device with
    different life time rules, merge them into a single one.  This also
    greatly simplifies the reference counting rules, as we can use the inode
    reference count as the main reference count for the new struct
    block_device, with the device model reference front ending it for device
    model interaction.

Change-Id: I47702d1867fda0d8fc0754d761aa4d1ae702cdeb
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agofix: kprobes: Remove kretprobe hash (v5.11)
Michael Jeanson [Thu, 7 Jan 2021 19:50:50 +0000 (14:50 -0500)] 
fix: kprobes: Remove kretprobe hash (v5.11)

See upstream commit:

  commit d741bf41d7c7db4898bacfcb020353cddc032fd8
  Author: Peter Zijlstra <peterz@infradead.org>
  Date:   Sat Aug 29 22:03:24 2020 +0900

    kprobes: Remove kretprobe hash

    The kretprobe hash is mostly superfluous, replace it with a per-task
    variable.

    This gets rid of the task hash and it's related locking.

    Note that this may change the kprobes module-exported API for kretprobe
    handlers. If any out-of-tree kretprobe user uses ri->rp, use
    get_kretprobe(ri) instead.

Link: https://lore.kernel.org/r/159870620431.1229682.16325792502413731312.stgit@devnote2
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I855765f390ad7caf481ef5fea334645e852f5b0f

3 years agofix: file: Rename fcheck lookup_fd_rcu (v5.11)
Michael Jeanson [Thu, 7 Jan 2021 17:10:23 +0000 (12:10 -0500)] 
fix: file: Rename fcheck lookup_fd_rcu (v5.11)

See upstream commit:

  commit 460b4f812a9d473d4b39d87d37844f9fc30a9eb3
  Author: Eric W. Biederman <ebiederm@xmission.com>
  Date:   Fri Nov 20 17:14:27 2020 -0600

    file: Rename fcheck lookup_fd_rcu

    Also remove the confusing comment about checking if a fd exists.  I
    could not find one instance in the entire kernel that still matches
    the description or the reason for the name fcheck.

    The need for better names became apparent in the last round of
    discussion of this set of changes[1].

    [1] https://lkml.kernel.org/r/CAHk-=wj8BQbgJFLa+J0e=iT-1qpmCRTbPAJ8gd6MJQ=kbRPqyQ@mail.gmail.com

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

3 years agofix: block: remove the request_queue argument to the block_bio_remap tracepoint ...
Michael Jeanson [Thu, 7 Jan 2021 17:01:40 +0000 (12:01 -0500)] 
fix: block: remove the request_queue argument to the block_bio_remap tracepoint (v5.11)

See upstream commit:

  commit 1c02fca620f7273b597591065d366e2cca948d8f
  Author: Christoph Hellwig <hch@lst.de>
  Date:   Thu Dec 3 17:21:38 2020 +0100

    block: remove the request_queue argument to the block_bio_remap tracepoint

    The request_queue can trivially be derived from the bio.

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

3 years agofix: block: remove the request_queue argument to the block_split tracepoint (v5.11)
Michael Jeanson [Thu, 7 Jan 2021 16:56:25 +0000 (11:56 -0500)] 
fix: block: remove the request_queue argument to the block_split tracepoint (v5.11)

See upstream commit:

  commit eb6f7f7cd3af0f67ce57b21fab1bc64beb643581
  Author: Christoph Hellwig <hch@lst.de>
  Date:   Thu Dec 3 17:21:37 2020 +0100

    block: remove the request_queue argument to the block_split tracepoint

    The request_queue can trivially be derived from the bio.

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

3 years agofix: block: simplify and extend the block_bio_merge tracepoint class (v5.11)
Michael Jeanson [Thu, 7 Jan 2021 16:50:25 +0000 (11:50 -0500)] 
fix: block: simplify and extend the block_bio_merge tracepoint class (v5.11)

See upstream commit:

  commit e8a676d61c07eccfcd9d6fddfe4dcb630651c29a
  Author: Christoph Hellwig <hch@lst.de>
  Date:   Thu Dec 3 17:21:36 2020 +0100

    block: simplify and extend the block_bio_merge tracepoint class

    The block_bio_merge tracepoint class can be reused for most bio-based
    tracepoints.  For that it just needs to lose the superfluous q and rq
    parameters.

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

3 years agofix: block: remove the request_queue to argument request based tracepoints (v5.11)
Michael Jeanson [Thu, 7 Jan 2021 16:17:20 +0000 (11:17 -0500)] 
fix: block: remove the request_queue to argument request based tracepoints (v5.11)

See upstream commit :

  commit a54895fa057c67700270777f7661d8d3c7fda88a
  Author: Christoph Hellwig <hch@lst.de>
  Date:   Thu Dec 3 17:21:39 2020 +0100

    block: remove the request_queue to argument request based tracepoints

    The request_queue can trivially be derived from the request.

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

3 years agofix: remove floating-point arguments in msgpack
Michael Jeanson [Mon, 14 Dec 2020 16:20:11 +0000 (11:20 -0500)] 
fix: remove floating-point arguments in msgpack

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

3 years agoabi: use 0, 1 for counter enumerations
Mathieu Desnoyers [Fri, 11 Dec 2020 15:51:58 +0000 (10:51 -0500)] 
abi: use 0, 1 for counter enumerations

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoCleanup: use tabs in abi.h
Mathieu Desnoyers [Fri, 11 Dec 2020 15:41:27 +0000 (10:41 -0500)] 
Cleanup: use tabs in abi.h

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoBump LTTNG_MODULES_ABI_MINOR_VERSION to 6
Jérémie Galarneau [Fri, 11 Dec 2020 04:40:51 +0000 (23:40 -0500)] 
Bump LTTNG_MODULES_ABI_MINOR_VERSION to 6

New operations were added to the lttng-modules ABI as part of the 2.13
release cycle to support event notifiers.

This will allow future LTTng-tools versions to check for those
capabilities.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Idfd58f3914b87be3688a10a06239a1b0ab556a7c

3 years agoFix: handle default switch case with -EINVAL in lttng-syscalls
Michael Jeanson [Mon, 30 Nov 2020 19:46:07 +0000 (14:46 -0500)] 
Fix: handle default switch case with -EINVAL in lttng-syscalls

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

3 years agofix: use wrapper for hlist_for_each_entry_rcu
Michael Jeanson [Mon, 30 Nov 2020 19:44:36 +0000 (14:44 -0500)] 
fix: use wrapper for hlist_for_each_entry_rcu

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

3 years agofix: asm/barrier.h was introduced in v3.4
Michael Jeanson [Mon, 30 Nov 2020 19:26:23 +0000 (14:26 -0500)] 
fix: asm/barrier.h was introduced in v3.4

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

3 years agoFix: handle default switch case with -EINVAL in __lttng_counter_add
Mathieu Desnoyers [Mon, 30 Nov 2020 19:09:31 +0000 (14:09 -0500)] 
Fix: handle default switch case with -EINVAL in __lttng_counter_add

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoIntroduce lttng smp_store_release smp_load_acquire wrappers
Mathieu Desnoyers [Mon, 30 Nov 2020 16:11:39 +0000 (11:11 -0500)] 
Introduce lttng smp_store_release smp_load_acquire wrappers

Kernels prior to 3.14 do not implement smp_store_release nor
smp_load_acquire. Implement our own wrappers with smp_mb instead for
those older kernels.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agofix: include byteorder.h for 'cpu_to_*'
Michael Jeanson [Mon, 30 Nov 2020 15:23:14 +0000 (10:23 -0500)] 
fix: include byteorder.h for 'cpu_to_*'

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

3 years agoFix: notifier: use store-release/load-acquire for error counter
Mathieu Desnoyers [Fri, 27 Nov 2020 21:03:55 +0000 (16:03 -0500)] 
Fix: notifier: use store-release/load-acquire for error counter

The "record_error" operation is executed concurrently with setting the
error counter in the notifier group without locking, so we need to
explicitly provide existance guarantees.

The only visible transition is from NULL -> !NULL, because the only
situation reverting the error counter back to NULL is on destruction of
the notification group, after an RCU synchronisation guarantees that no
record_error can observe this pointer anymore.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoFix: event-notifier: Groups may not have an error counter
Francis Deslauriers [Fri, 27 Nov 2020 19:40:08 +0000 (14:40 -0500)] 
Fix: event-notifier: Groups may not have an error counter

Issue
=====
If no error counter is attached to an event notifier group, calling
the `record_error()` function leads to a NULL pointer dereference.

Solution
========
Check if the error_counter field is allocated before dereferencing it.

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

3 years agoBump LTTNG_KERNEL_EVENT_NOTIFIER_PADDING to 32 bytes
Mathieu Desnoyers [Thu, 26 Nov 2020 22:08:44 +0000 (17:08 -0500)] 
Bump LTTNG_KERNEL_EVENT_NOTIFIER_PADDING to 32 bytes

Allows using 3 more 64-bit integers, and one extension pointer.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoFix: remove dead code in msgpack.c
Mathieu Desnoyers [Thu, 26 Nov 2020 20:36:20 +0000 (15:36 -0500)] 
Fix: remove dead code in msgpack.c

Identified by Coverity. Comparing unsigned types < 0 is never true.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoFix: counter: cast UINT*_MAX to 64-bit signed type before negative
Mathieu Desnoyers [Thu, 26 Nov 2020 20:29:28 +0000 (15:29 -0500)] 
Fix: counter: cast UINT*_MAX to 64-bit signed type before negative

(long long)-UINT32_MAX leads to value 1 which is not what we expect.
This is due to implicit type promotion from unsigned to signed 32-bit
integer.

Apply this to 8-bit and 16-bit types as well even though they are
not affected by this issue to keep things regular.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoFix: include limits.h wrapper from libcounter
Mathieu Desnoyers [Thu, 26 Nov 2020 14:02:53 +0000 (09:02 -0500)] 
Fix: include limits.h wrapper from libcounter

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoFix: include kernel.h in wrapper/limits.h
Mathieu Desnoyers [Wed, 25 Nov 2020 21:03:15 +0000 (16:03 -0500)] 
Fix: include kernel.h in wrapper/limits.h

linux/kernel.h is present in older kernels, but linux/limits.h is not.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoIntroduce limits wrapper
Mathieu Desnoyers [Wed, 25 Nov 2020 20:50:16 +0000 (15:50 -0500)] 
Introduce limits wrapper

Older kernels (v3.13.11 and older on the CI) miss the U32_MAX
macro. Implement them in a wrapper.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoIntroduce lazy system call event creation
Mathieu Desnoyers [Wed, 25 Nov 2020 20:30:30 +0000 (15:30 -0500)] 
Introduce lazy system call event creation

Introduce lazy system call event creation. If only specific system call
events are enabled, only create the metadata for those.

Align implementation of system call event probes for recording events
with their notifier counterpart.

This is part of the background work required for a future feature (trace
hit counters and map support) which brings benefits on its own.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoImplement event notifier error counter
Francis Deslauriers [Fri, 7 Aug 2020 21:04:05 +0000 (17:04 -0400)] 
Implement event notifier error counter

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

3 years agoImplement lib counter
Mathieu Desnoyers [Wed, 15 Jul 2020 18:13:24 +0000 (14:13 -0400)] 
Implement lib counter

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

3 years agocapture: Replace FIXME by explanation of the limit
Mathieu Desnoyers [Wed, 25 Nov 2020 18:44:38 +0000 (13:44 -0500)] 
capture: Replace FIXME by explanation of the limit

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoImplement capturing payload on event notifier
Francis Deslauriers [Thu, 2 Apr 2020 19:14:45 +0000 (15:14 -0400)] 
Implement capturing payload on event notifier

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

3 years agoFix: comment related to filter bytecode list
Mathieu Desnoyers [Wed, 25 Nov 2020 18:38:38 +0000 (13:38 -0500)] 
Fix: comment related to filter bytecode list

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoFix: use vmalloc for filter bytecode allocation
Mathieu Desnoyers [Wed, 25 Nov 2020 18:29:47 +0000 (13:29 -0500)] 
Fix: use vmalloc for filter bytecode allocation

Given that the filter bytecode can reach 64kB, use vmalloc rather than
kmalloc to minimize the chances of failure on systems with fragmented
memory.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoImplement enum and sequence capture serialization functions
Francis Deslauriers [Wed, 13 May 2020 22:31:23 +0000 (18:31 -0400)] 
Implement enum and sequence capture serialization functions

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

3 years agobytecode: Add `OBJECT_TYPE_{UN,}SIGNED_ENUM` type
Francis Deslauriers [Wed, 13 May 2020 15:42:09 +0000 (11:42 -0400)] 
bytecode: Add `OBJECT_TYPE_{UN,}SIGNED_ENUM` type

Enumerations are currently converted to their integer counterparts as
soon as they are encountered.

In order to use them in captures, we need to differentiate the
enumerations from integers for the entirety of the interpretation.

This commit adds the `OBJECT_TYPE_SIGNED_ENUM` and
`OBJECT_TYPE_UNSIGNED_ENUM` to keep track of these objects

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

3 years agoGeneralize `lttng_enabler_link_bytecode()` bytecode list
Francis Deslauriers [Wed, 13 May 2020 16:56:03 +0000 (12:56 -0400)] 
Generalize `lttng_enabler_link_bytecode()` bytecode list

So it can be used for both filter and capture bytecode runtimes

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

3 years agoCleanup: rename `_lttng_filter_link_bytecode()` -> `link_bytecode()`
Francis Deslauriers [Wed, 13 May 2020 15:24:19 +0000 (11:24 -0400)] 
Cleanup: rename `_lttng_filter_link_bytecode()` -> `link_bytecode()`

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

3 years agoAdd `interpreter_funcs` to `lttng_bytecode_runtime`
Francis Deslauriers [Wed, 13 May 2020 14:32:26 +0000 (10:32 -0400)] 
Add `interpreter_funcs` to `lttng_bytecode_runtime`

Background
==========
The current filter interpreter function signature looks like this:

uint64_t lttng_bytecode_filter_interpret(void *filter_data,
              const char *filter_stack_data);

The upcoming capture interpreter function will need an output parameter
to extract the top of stack register. It will look like this:

uint64_t lttng_bytecode_capture_interpret(void *filter_data,
              const char *filter_stack_data, struct output_register *output);

Problems
========
We can't reuse the same function pointer field in `struct
lttng_bytecode_runtime` as both interpreter functions will have
different signatures.

We can't change the signature of this existing filter function because
it's used in the tracepoint probes.

Solution
========
Add a union of callbacks to hold both interpreter functions. This also
doesn't change the layout of the `struct lttng_bytecode_runtime`
objects.

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

3 years agobytecode: rename `lttng_filter_sync_state()` -> `lttng_bytecode_filter_sync_state()`
Francis Deslauriers [Wed, 13 May 2020 14:36:00 +0000 (10:36 -0400)] 
bytecode: rename `lttng_filter_sync_state()` -> `lttng_bytecode_filter_sync_state()`

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

3 years agoRename filter bytecode types and files
Francis Deslauriers [Tue, 12 May 2020 20:10:04 +0000 (16:10 -0400)] 
Rename filter bytecode types and files

File renames:
- filter-bytecode.h -> bytecode.h
- lttng-filter-interpreter.c -> lttng-bytecode-interpreter.c
- lttng-filter-specialize.c -> lttng-bytecode-specialize.c
- lttng-filter-validator.c -> lttng-bytecode-validator.c
- lttng-filter.c -> lttng-bytecode.c
- lttng-filter.h -> lttng-bytecode.h

Function renames:
- `lttng_filter_interpret_bytecode_false()` -> `lttng_bytecode_filter_interpret_false()`
- `lttng_filter_interpret_bytecode()` -> `lttng_bytecode_filter_interpret()`
- `lttng_filter_specialize_bytecode()` -> `lttng_bytecode_specialize()`
- `lttng_filter_validate_bytecode()` -> `lttng_bytecode_validate()`

Type renames
- `filter_opcode_t` to `bytecode_opcode_t`

Enum renames:
- `enum filter_op` to `enum bytecode_op`
- `FILTER_OP_*` to `BYTECODE_OP_*`
- `enum lttng_filter_ret` -> `enum lttng_bytecode_interpreter_ret`
- `LTTNG_FILTER_DISCARD` -> `LTTNG_INTERPRETER_DISCARD`
- `LTTNG_FILTER_RECORD_FLAG` -> `LTTNG_INTERPRETER_RECORD_FLAG`

Define renames:
- `FILTER_STACK_EMPTY` -> `INTERPRETER_STACK_EMPTY`
- `FILTER_STACK_LEN`-> `INTERPRETER_STACK_LEN`
- `FILTER_MAX_DATA_LEN` -> `BYTECODE_MAX_DATA_LEN`

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

3 years agobytecode: generalize `struct lttng_filter_bytecode_node`
Francis Deslauriers [Tue, 12 May 2020 19:52:41 +0000 (15:52 -0400)] 
bytecode: generalize `struct lttng_filter_bytecode_node`

Rename `struct lttng_filter_bytecode_node` to `struct
lttng_bytecode_node` so it can be used by capture bytecode as well.

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

3 years agoAdd msgpack implementation for serializing captures
Francis Deslauriers [Tue, 12 May 2020 17:04:15 +0000 (13:04 -0400)] 
Add msgpack implementation for serializing captures

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

3 years agobytecode: allow interpreter to return any type
Francis Deslauriers [Tue, 12 May 2020 16:07:50 +0000 (12:07 -0400)] 
bytecode: allow interpreter to return any type

The bytecode interpreter when used by capture bytecode needs to return
types other than an integer or dynamic type.

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

3 years agobytecode: propagate `rev_bo` of element
Francis Deslauriers [Mon, 11 May 2020 20:24:31 +0000 (16:24 -0400)] 
bytecode: propagate `rev_bo` of element

When specializing and executing bytecode.

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

3 years agobytecode: set register type to `REG_PTR` even if not used
Francis Deslauriers [Mon, 11 May 2020 20:09:20 +0000 (16:09 -0400)] 
bytecode: set register type to `REG_PTR` even if not used

There was no need to set the field when using filter as the next
instruction would assume that the top of stack is a `REG_PTR`.

With the upcoming capture feature, we need to ensure this field is
consistent for extraction.

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

3 years agoAdd `lttng_bytecode_interpret_format_output()` for top of stack extraction
Francis Deslauriers [Mon, 11 May 2020 19:57:20 +0000 (15:57 -0400)] 
Add `lttng_bytecode_interpret_format_output()` for top of stack extraction

This new static function will be used to extract the register on the top of
stack after the execution of the bytecode. This is currently not used by the
filter bytecode but will be used by capture bytecode.

The returned value is saved in a tagged union struct named `struct
lttng_interpreter_output` and can be used by the caller of the interpreter
function.

Typically, this struct will be allocated on the stack to avoid dynamic
allocation inside the tracepoint probes.

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

3 years agobytecode: add `REG_U64` interpreter register type
Francis Deslauriers [Thu, 30 Apr 2020 21:30:45 +0000 (17:30 -0400)] 
bytecode: add `REG_U64` interpreter register type

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

3 years agoFix: filter validator: refuse string and star glob input to bitwise operation
Mathieu Desnoyers [Wed, 25 Nov 2020 17:58:27 +0000 (12:58 -0500)] 
Fix: filter validator: refuse string and star glob input to bitwise operation

The validator refuses input ax=string,bx=unknown, but accepts input
ax=unknown,bx=string. Both inputs should be refused.

The same goes for the error glob input.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoFix: bytecode: Validate register type for instructions expecting unknown type
Francis Deslauriers [Tue, 5 May 2020 14:21:41 +0000 (10:21 -0400)] 
Fix: bytecode: Validate register type for instructions expecting unknown type

The bytecode validator allows unknown type as input for some
instructions which are not specialized. The interpreter therefore needs
to check the register type for their input.

Thie requires that every instruction in the interpreter sets the
register type of the output it populates (unless it is unchanged).

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

3 years agoCleanup: Rename filter functions/fields to mention "filter"
Francis Deslauriers [Wed, 1 Apr 2020 21:12:59 +0000 (17:12 -0400)] 
Cleanup: Rename filter functions/fields to mention "filter"

This will be cleaner when we introduce the capture bytecode functions
and fields.

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

3 years agoImplement event notifiers for syscalls
Francis Deslauriers [Thu, 23 Jan 2020 22:47:17 +0000 (17:47 -0500)] 
Implement event notifiers for syscalls

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

3 years agoFix: syscalls: address of statically allocated element never null
Francis Deslauriers [Wed, 25 Nov 2020 15:25:54 +0000 (10:25 -0500)] 
Fix: syscalls: address of statically allocated element never null

This check is intended to confirm that the table element for that syscall
is indeed populated but checked that the element is NULL. This was never
the case because the address of an element of a statically allocated
array cannot be NULL.

Fix this by check if the function pointer is NULL instead. This means
that the element is not populated.

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

3 years agoRename LTTNG_SYSCALL_MATCH_ -> LTTNG_KERNEL_SYSCALL_MATCH_
Francis Deslauriers [Wed, 25 Nov 2020 02:18:46 +0000 (21:18 -0500)] 
Rename LTTNG_SYSCALL_MATCH_ -> LTTNG_KERNEL_SYSCALL_MATCH_

This is done to keep the same name scheme used to all ABI enums.

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

3 years agoAllow LTTNG_KERNEL_SYSCALL_{ENTRY, EXIT}
Francis Deslauriers [Tue, 24 Nov 2020 16:08:14 +0000 (11:08 -0500)] 
Allow LTTNG_KERNEL_SYSCALL_{ENTRY, EXIT}

Signed-off-by: Francis Deslauriers <fdeslaur@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I1ea097797da5db474f2f33d779f66254b7979c46

3 years agosyscalls: extract `lttng_syscall_filter_enable()` for reuse
Francis Deslauriers [Thu, 19 Nov 2020 22:00:19 +0000 (17:00 -0500)] 
syscalls: extract `lttng_syscall_filter_enable()` for reuse

The syscall event notifiers will reuse the concept of syscall filtering
to avoid needlessly preparing arguments for disabled syscalls.

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

3 years agoCleanup: syscall: remove unused `syscall_name` field
Francis Deslauriers [Thu, 19 Nov 2020 20:01:56 +0000 (15:01 -0500)] 
Cleanup: syscall: remove unused `syscall_name` field

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

3 years agofix: adjust version range for trace_find_free_extent()
Michael Jeanson [Tue, 24 Nov 2020 16:27:18 +0000 (11:27 -0500)] 
fix: adjust version range for trace_find_free_extent()

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

3 years agoImprove the release script
Michael Jeanson [Mon, 23 Nov 2020 17:15:43 +0000 (12:15 -0500)] 
Improve the release script

  * Use git-archive, this removes all custom code to cleanup the repo, it
    can now be used in an unclean repo as the code will be exported from
    a specific tag.
  * Add parameters, this will allow using the script on any machine
    while keeping the default behavior for the maintainer.

Change-Id: I9f29d0e1afdbf475d0bbaeb9946ca3216f725e86
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoAdd release maintainer script
Mathieu Desnoyers [Mon, 23 Nov 2020 15:49:57 +0000 (10:49 -0500)] 
Add release maintainer script

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 years agofix: include order for older kernels
Michael Jeanson [Fri, 20 Nov 2020 16:42:30 +0000 (11:42 -0500)] 
fix: include order for older kernels

Fixes a build failure on v3.0 and v3.1.

Change-Id: Ic48512d2aa5ee46678e67d147b92dba6d0959615
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 years agofix: tracepoint: Optimize using static_call() (v5.10)
Michael Jeanson [Mon, 26 Oct 2020 21:09:05 +0000 (17:09 -0400)] 
fix: tracepoint: Optimize using static_call() (v5.10)

See upstream commit :

  commit d25e37d89dd2f41d7acae0429039d2f0ae8b4a07
  Author: Steven Rostedt (VMware) <rostedt@goodmis.org>
  Date:   Tue Aug 18 15:57:52 2020 +0200

    tracepoint: Optimize using static_call()

    Currently the tracepoint site will iterate a vector and issue indirect
    calls to however many handlers are registered (ie. the vector is
    long).

    Using static_call() it is possible to optimize this for the common
    case of only having a single handler registered. In this case the
    static_call() can directly call this handler. Otherwise, if the vector
    is longer than 1, call a function that iterates the whole vector like
    the current code.

Change-Id: I739dd84d62cc1a821b8bd8acff74fa29aa25d22f
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 years agofix: KVM: x86/mmu: Return unique RET_PF_* values if the fault was fixed (v5.10)
Michael Jeanson [Mon, 26 Oct 2020 21:07:13 +0000 (17:07 -0400)] 
fix: KVM: x86/mmu: Return unique RET_PF_* values if the fault was fixed (v5.10)

See upstream commit :

  commit c4371c2a682e0da1ed2cd7e3c5496f055d873554
  Author: Sean Christopherson <sean.j.christopherson@intel.com>
  Date:   Wed Sep 23 15:04:24 2020 -0700

    KVM: x86/mmu: Return unique RET_PF_* values if the fault was fixed

    Introduce RET_PF_FIXED and RET_PF_SPURIOUS to provide unique return
    values instead of overloading RET_PF_RETRY.  In the short term, the
    unique values add clarity to the code and RET_PF_SPURIOUS will be used
    by set_spte() to avoid unnecessary work for spurious faults.

    In the long term, TDX will use RET_PF_FIXED to deterministically map
    memory during pre-boot.  The page fault flow may bail early for benign
    reasons, e.g. if the mmu_notifier fires for an unrelated address.  With
    only RET_PF_RETRY, it's impossible for the caller to distinguish between
    "cool, page is mapped" and "darn, need to try again", and thus cannot
    handle benign cases like the mmu_notifier retry.

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

4 years agofix: kvm: x86/mmu: Add TDP MMU PF handler (v5.10)
Michael Jeanson [Mon, 26 Oct 2020 18:28:35 +0000 (14:28 -0400)] 
fix: kvm: x86/mmu: Add TDP MMU PF handler (v5.10)

See upstream commit :

  commit bb18842e21111a979e2e0e1c5d85c09646f18d51
  Author: Ben Gardon <bgardon@google.com>
  Date:   Wed Oct 14 11:26:50 2020 -0700

    kvm: x86/mmu: Add TDP MMU PF handler

    Add functions to handle page faults in the TDP MMU. These page faults
    are currently handled in much the same way as the x86 shadow paging
    based MMU, however the ordering of some operations is slightly
    different. Future patches will add eager NX splitting, a fast page fault
    handler, and parallel page faults.

    Tested by running kvm-unit-tests and KVM selftests on an Intel Haswell
    machine. This series introduced no new failures.

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

4 years agofix: KVM: x86: Add intr/vectoring info and error code to kvm_exit tracepoint (v5.10)
Michael Jeanson [Mon, 26 Oct 2020 18:11:17 +0000 (14:11 -0400)] 
fix: KVM: x86: Add intr/vectoring info and error code to kvm_exit tracepoint (v5.10)

See upstream commit :

  commit 235ba74f008d2e0936b29f77f68d4e2f73ffd24a
  Author: Sean Christopherson <sean.j.christopherson@intel.com>
  Date:   Wed Sep 23 13:13:46 2020 -0700

    KVM: x86: Add intr/vectoring info and error code to kvm_exit tracepoint

    Extend the kvm_exit tracepoint to align it with kvm_nested_vmexit in
    terms of what information is captured.  On SVM, add interrupt info and
    error code, while on VMX it add IDT vectoring and error code.  This
    sets the stage for macrofying the kvm_exit tracepoint definition so that
    it can be reused for kvm_nested_vmexit without loss of information.

    Opportunistically stuff a zero for VM_EXIT_INTR_INFO if the VM-Enter
    failed, as the field is guaranteed to be invalid.  Note, it'd be
    possible to further filter the interrupt/exception fields based on the
    VM-Exit reason, but the helper is intended only for tracepoints, i.e.
    an extra VMREAD or two is a non-issue, the failed VM-Enter case is just
    low hanging fruit.

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

4 years agofix: ext4: fast commit recovery path (v5.10)
Michael Jeanson [Mon, 26 Oct 2020 21:03:23 +0000 (17:03 -0400)] 
fix: ext4: fast commit recovery path (v5.10)

See upstream commit :

  commit 8016e29f4362e285f0f7e38fadc61a5b7bdfdfa2
  Author: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
  Date:   Thu Oct 15 13:37:59 2020 -0700

    ext4: fast commit recovery path

    This patch adds fast commit recovery path support for Ext4 file
    system. We add several helper functions that are similar in spirit to
    e2fsprogs journal recovery path handlers. Example of such functions
    include - a simple block allocator, idempotent block bitmap update
    function etc. Using these routines and the fast commit log in the fast
    commit area, the recovery path (ext4_fc_replay()) performs fast commit
    log recovery.

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

4 years agofix: btrfs: make ordered extent tracepoint take btrfs_inode (v5.10)
Michael Jeanson [Tue, 27 Oct 2020 16:10:05 +0000 (12:10 -0400)] 
fix: btrfs: make ordered extent tracepoint take btrfs_inode (v5.10)

See upstream commit :

  commit acbf1dd0fcbd10c67826a19958f55a053b32f532
  Author: Nikolay Borisov <nborisov@suse.com>
  Date:   Mon Aug 31 14:42:40 2020 +0300

    btrfs: make ordered extent tracepoint take btrfs_inode

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

4 years agofix: btrfs: tracepoints: output proper root owner for trace_find_free_extent() (v5.10)
Michael Jeanson [Tue, 27 Oct 2020 15:42:23 +0000 (11:42 -0400)] 
fix: btrfs: tracepoints: output proper root owner for trace_find_free_extent() (v5.10)

See upstream commit :

  commit 437490fed3b0c9ae21af8f70e0f338d34560842b
  Author: Qu Wenruo <wqu@suse.com>
  Date:   Tue Jul 28 09:42:49 2020 +0800

    btrfs: tracepoints: output proper root owner for trace_find_free_extent()

    The current trace event always output result like this:

     find_free_extent: root=2(EXTENT_TREE) len=16384 empty_size=0 flags=4(METADATA)
     find_free_extent: root=2(EXTENT_TREE) len=16384 empty_size=0 flags=4(METADATA)
     find_free_extent: root=2(EXTENT_TREE) len=8192 empty_size=0 flags=1(DATA)
     find_free_extent: root=2(EXTENT_TREE) len=8192 empty_size=0 flags=1(DATA)
     find_free_extent: root=2(EXTENT_TREE) len=4096 empty_size=0 flags=1(DATA)
     find_free_extent: root=2(EXTENT_TREE) len=4096 empty_size=0 flags=1(DATA)

    T's saying we're allocating data extent for EXTENT tree, which is not
    even possible.

    It's because we always use EXTENT tree as the owner for
    trace_find_free_extent() without using the @root from
    btrfs_reserve_extent().

    This patch will change the parameter to use proper @root for
    trace_find_free_extent():

    Now it looks much better:

     find_free_extent: root=5(FS_TREE) len=16384 empty_size=0 flags=36(METADATA|DUP)
     find_free_extent: root=5(FS_TREE) len=8192 empty_size=0 flags=1(DATA)
     find_free_extent: root=5(FS_TREE) len=16384 empty_size=0 flags=1(DATA)
     find_free_extent: root=5(FS_TREE) len=4096 empty_size=0 flags=1(DATA)
     find_free_extent: root=5(FS_TREE) len=8192 empty_size=0 flags=1(DATA)
     find_free_extent: root=5(FS_TREE) len=16384 empty_size=0 flags=36(METADATA|DUP)
     find_free_extent: root=7(CSUM_TREE) len=16384 empty_size=0 flags=36(METADATA|DUP)
     find_free_extent: root=2(EXTENT_TREE) len=16384 empty_size=0 flags=36(METADATA|DUP)
     find_free_extent: root=1(ROOT_TREE) len=16384 empty_size=0 flags=36(METADATA|DUP)

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

4 years agofix: objtool: Rename frame.h -> objtool.h (v5.10)
Michael Jeanson [Mon, 26 Oct 2020 17:41:02 +0000 (13:41 -0400)] 
fix: objtool: Rename frame.h -> objtool.h (v5.10)

See upstream commit :

  commit 00089c048eb4a8250325efb32a2724fd0da68cce
  Author: Julien Thierry <jthierry@redhat.com>
  Date:   Fri Sep 4 16:30:25 2020 +0100

    objtool: Rename frame.h -> objtool.h

    Header frame.h is getting more code annotations to help objtool analyze
    object files.

    Rename the file to objtool.h.

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

4 years agoRevert "Implement event notifiers for syscalls"
Mathieu Desnoyers [Thu, 19 Nov 2020 16:41:11 +0000 (11:41 -0500)] 
Revert "Implement event notifiers for syscalls"

This reverts commit 8ced8896fe832af52b749d429b8eceb872a83d1b.

This commit was not ready and was committed by error.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 years agoFix: ressource leak in id tracker
Mathieu Desnoyers [Thu, 19 Nov 2020 16:03:17 +0000 (11:03 -0500)] 
Fix: ressource leak in id tracker

Memory leak found by Coverity:

CID 1412251 (#2 of 2): Resource leak (RESOURCE_LEAK)
21. leaked_storage: Variable head going out of scope leaks the storage it points to.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 years agoImplement event notifiers for syscalls
Francis Deslauriers [Thu, 23 Jan 2020 22:47:17 +0000 (17:47 -0500)] 
Implement event notifiers for syscalls

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Ic8f17feb45aef6e933252908c761d3241123cfe4

4 years agolttng-syscalls.c: extract function calling actual probe
Francis Deslauriers [Thu, 23 Jan 2020 23:31:06 +0000 (18:31 -0500)] 
lttng-syscalls.c: extract function calling actual probe

This function will be reused by the event notifier infrastructure.

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

4 years agoNamespace syscall code relating to events
Francis Deslauriers [Wed, 5 Feb 2020 17:44:22 +0000 (12:44 -0500)] 
Namespace syscall code relating to events

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

4 years agoImplement event notifiers for uprobes
Francis Deslauriers [Tue, 21 Jan 2020 23:20:53 +0000 (18:20 -0500)] 
Implement event notifiers for uprobes

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

4 years agoNamespace uprobe functions relating to events
Francis Deslauriers [Tue, 21 Jan 2020 23:45:11 +0000 (18:45 -0500)] 
Namespace uprobe functions relating to events

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

4 years agodoc: event notifier on kretprobe is not supported
Francis Deslauriers [Tue, 21 Jan 2020 20:57:16 +0000 (15:57 -0500)] 
doc: event notifier on kretprobe is not supported

The kretprobe behavior is to fire twice (entry and exit of target
function), placing an event notifier on such function does not make
sense at first glance. If we come up with a use case it will be quite
easy to enable.

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

4 years agoImplement event notifiers for kprobes
Francis Deslauriers [Tue, 14 Jan 2020 20:12:28 +0000 (15:12 -0500)] 
Implement event notifiers for kprobes

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

4 years agoNamespace kprobe functions relating to events
Francis Deslauriers [Tue, 14 Jan 2020 20:34:54 +0000 (15:34 -0500)] 
Namespace kprobe functions relating to events

The event notifier support for kprobe will soon be introduce and kprobe
code will be reused.

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

4 years agoImplement event notifiers for tracepoints
Francis Deslauriers [Wed, 5 Feb 2020 19:47:19 +0000 (14:47 -0500)] 
Implement event notifiers for tracepoints

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

4 years agoImplement event notifier probes
Francis Deslauriers [Wed, 5 Feb 2020 19:46:08 +0000 (14:46 -0500)] 
Implement event notifier probes

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

4 years agoFix: event notifier: adapt read iterator state to poll expectations
Mathieu Desnoyers [Tue, 4 Feb 2020 20:46:41 +0000 (15:46 -0500)] 
Fix: event notifier: adapt read iterator state to poll expectations

When completing to read a subbuffer, ensure that the state of the
iterator is moved forward so the "put_subbuf" is performed before
returning to the user, so poll() will not return POLLIN when there
is actually no data available to read.

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

4 years agoFix: event-notifier: do not flush packet if it only contains subbuf header
Mathieu Desnoyers [Mon, 3 Feb 2020 20:52:02 +0000 (15:52 -0500)] 
Fix: event-notifier: do not flush packet if it only contains subbuf header

This poll behavior returns POLLIN in situations where there is
actually no event to read, which causes read to block when it
should not.

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

4 years agoImplement lttng_event_notifier_group_notif_fops read, poll, open, release ABI
Mathieu Desnoyers [Mon, 3 Feb 2020 19:19:13 +0000 (14:19 -0500)] 
Implement lttng_event_notifier_group_notif_fops read, poll, open, release ABI

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

4 years agoImplement event notifier send notification
Francis Deslauriers [Wed, 5 Feb 2020 19:44:02 +0000 (14:44 -0500)] 
Implement event notifier send notification

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

4 years agoAdd event notifier and event notifier enabler
Francis Deslauriers [Wed, 5 Feb 2020 19:34:36 +0000 (14:34 -0500)] 
Add event notifier and event notifier enabler

Idea
====
The purpose of the event notifiers is to allow the session daemon to
react to events in the tracer. For example, the user will be able to
start or stop tracing on a session when a specific tracepoint is fired.

An event notifier is really similar to a regular event. The main
difference is that when the tracepoint is fired the action of the event
notifier is to notify the session daemon about it. This mechanism will
use a special purpose ring buffer to expose these notifications to
userspace.

Unlike regular events, there are no claim on the timeliness of such
notifications.

Implementation
==============
This commit adds structures and functions related to event notifiers
mimicking what we currently do with regular events.

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

4 years agoImplement event notifier group create
Francis Deslauriers [Wed, 5 Feb 2020 19:13:42 +0000 (14:13 -0500)] 
Implement event notifier group create

Event notifier groups will contain the event notifiers.
All event notifiers of a group will share the same ring buffer to save
the tracer notifications.

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

4 years agoAdd token to `struct lttng_kernel_event`
Francis Deslauriers [Fri, 13 Nov 2020 17:15:52 +0000 (12:15 -0500)] 
Add token to `struct lttng_kernel_event`

This token is provided by the user when registering an event rule to the
kernel. It is going to used to identify messages from event notifiers, and
counter bucket owners in the upcoming event notifier and map counter
features.

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

4 years agolttng-events: move lttng_transport_find earlier in source file
Francis Deslauriers [Wed, 5 Feb 2020 18:51:51 +0000 (13:51 -0500)] 
lttng-events: move lttng_transport_find earlier in source file

Will be used by upcoming event notifier code which is earlier in source
file.

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

4 years agolib ring buffer: move subbuffer_consume_record into LTTNG_RING_BUFFER_COUNT_EVENTS...
Mathieu Desnoyers [Mon, 3 Feb 2020 19:49:16 +0000 (14:49 -0500)] 
lib ring buffer: move subbuffer_consume_record into LTTNG_RING_BUFFER_COUNT_EVENTS ifdef

When event accounting is disabled, counting of event records consumed by
the iterator should be disabled as well, otherwise it triggers
CHAN_WARN_ON() because the accounting of events produced is not
performed.

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

4 years agolib ring buffer iterator: introduce lib_ring_buffer_put_current_record
Mathieu Desnoyers [Tue, 4 Feb 2020 20:44:55 +0000 (15:44 -0500)] 
lib ring buffer iterator: introduce lib_ring_buffer_put_current_record

Ensure that the current subbuffer is put after client code has read the
payload of the current record.

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

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