Francis Deslauriers [Thu, 12 Dec 2019 14:32:00 +0000 (09:32 -0500)]
liblttng-ust-comm: move `_unlock_fd_tracker()` after `close()` on error paths
Right now, receiving an error from `lttng_ust_add_fd_to_tracker()` means that
the fd was _not_ added to the fd set. So the `lttng_ust_safe_close_fd()`
(overriding `close()`) call will indeed close the fd as expected. So, it
doesn't matter if the `close()` is before or after the `_unlock_`.
Even considering that, I believe that it's clearer and more common to
have all related operations within the `_lock_` and `_unlock_`
functions. Also, `lttng_ust_add_fd_to_tracker()` might be modified in
the future and fail for some other reason.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Id29a6ab004cfd5ca601615e1a70c74cf754b12e2
Francis Deslauriers [Fri, 13 Dec 2019 22:24:25 +0000 (17:24 -0500)]
Cleanup: liblttng-ust: change `int` flag to `bool`
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I78b35b6b99afe8a84aba6c836df3bce8d2532760
Francis Deslauriers [Fri, 6 Dec 2019 22:49:35 +0000 (17:49 -0500)]
liblttng-ust: exit loop early on event enabler match
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I0fa3215f7cd6a2d32ac00d66cf5fc184abd14612
Francis Deslauriers [Wed, 11 Dec 2019 22:14:43 +0000 (17:14 -0500)]
Cleanup: remove redundant memory barrier
This memory barrier is redundant with the one already issued in
`rcu_assign_pointer()` function during the `set_tracepoint()` call.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I78decd9ae87a63d7663928ad99e03831155548f7
Francis Deslauriers [Fri, 13 Dec 2019 15:17:30 +0000 (10:17 -0500)]
Cleanup: remove unused `lttng_bytecode_runtime::event` field
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Id946b69e8cb4e79415d221f0be0889cfe707b439
Francis Deslauriers [Wed, 18 Dec 2019 21:46:21 +0000 (16:46 -0500)]
Docs: explain why unused `lttng_enabler::ctx` is kept around
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I93cc035ced57e29f3d675c8c611d5319194e6cfb
Francis Deslauriers [Thu, 28 Nov 2019 19:26:20 +0000 (14:26 -0500)]
Cleanup: remove unused `lttng_free_enabler_filter_bytecode()` func
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Id9326aec2e6758ffffeb3eb9805bb0fa85d3076c
Francis Deslauriers [Thu, 28 Nov 2019 19:20:43 +0000 (14:20 -0500)]
Cleanup: move unused function to deprecated symbol list
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I9c75feee029364ab17ef3783a6c8f0d45ff2948b
Francis Deslauriers [Tue, 3 Dec 2019 21:53:47 +0000 (16:53 -0500)]
Cleanup: remove unused `__check_ust_safe_fmt()` function
Usages of this function were removed by this commit:
commit
5e96a46756a5dcd6e348afd84078b9e26438245d
Author: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Date: Tue Aug 9 09:46:51 2011 -0400
Add UST_DEBUG env. var. support
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I535028fc9338c0c2cef51a993bcab8f0e6c062c6
Francis Deslauriers [Tue, 3 Dec 2019 21:07:44 +0000 (16:07 -0500)]
Cleanup: silence unused parameter `ps` warning
This function was copied here from one of the BSDs by this commit:
e5bc3b0f4d6c0407492ebdea863483925393e1bc with the /*ARGSUSED*/
lint-style comment to prevent any `unused` warning.
It seems clang doesn't support those lint-style comments, so it prints
this warning:
CC libustsnprintf_la-core.lo
mbrtowc_sb.c:39:68: error: unused parameter 'ps' [-Werror,-Wunused-parameter]
ust_safe_mbrtowc(wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
So mark that parameter as unused to prevent any warning.
We could also simply remove the unused parameter and change the
signature of the function.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I09f4fd3938058ed985c1525d8b9b06a27529691e
Francis Deslauriers [Thu, 5 Dec 2019 23:17:31 +0000 (18:17 -0500)]
Cleanup: apply `include-what-you-use` guideline for `close()`
I saw that some files use the `close()` function but there are not
including a header for it. The `close()` function is defined by the
following header: <unistd.h>
So, to follow the best practice of including what is used in a file, I
added `#include <unistd.h>` in files using `close()`.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I07e104e957857c869576af7c2704e98584ecc763
Francis Deslauriers [Tue, 3 Dec 2019 22:17:42 +0000 (17:17 -0500)]
Cleanup: apply `include-what-you-use` guideline for `uint*_t`
I saw that some files use `uint*_t` types but there are not including a
header for it. The `uint*_t` types is defined by the following header:
<stdint.h>
So, to follow the best practice of including what is used in a file, I
added `#include <stdint.h>` in files using `uint*_t`.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I5da13744858a57fc8c9bf6a6cf1b29299c2211cc
Francis Deslauriers [Tue, 3 Dec 2019 20:47:24 +0000 (15:47 -0500)]
Cleanup: apply `include-what-you-use` guideline for `mbstate_t`
I saw that some files use the `mbstate_t` type but there are not including
a header for it. The `mbstate_t` type is defined by the following header:
<wchar.h>
So, to follow the best practice of including what is used in a file, I
added `#include <wchar.h>` in files using `mbstate_t`.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I103d144ede1a8488d2662d3b8ba5337accafda99
Francis Deslauriers [Tue, 3 Dec 2019 20:42:33 +0000 (15:42 -0500)]
Cleanup: apply `include-what-you-use` guideline for `fpos_t`
I saw that some files use the `fpos_t` type but there are not including
a header for it. The `fpos_t` type is defined by the following header:
<stdio.h>
So, to follow the best practice of including what is used in a file, I
added `#include <stdio.h>` in files using `fpos_t`.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I808ad0b23f04389fd56f89aa001095b771a327d6
Francis Deslauriers [Tue, 3 Dec 2019 20:33:22 +0000 (15:33 -0500)]
Cleanup: apply `include-what-you-use` guideline for `size_t`
I saw that some files use the `size_t` type but there are not including
a header for it. The `size_t` type is defined by the following headers:
<stddef.h>
<stdio.h>
<stdlib.h>
<string.h>
<time.h>
<wchar.h>
So, to follow the best practice of including what is used in a file, I
added `#include <stddef.h>` in files using `size_t` but did not include
any of the previously listed header.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ica1d82691335294decf13ffcdf4257e35d6a44c2
Francis Deslauriers [Wed, 27 Nov 2019 19:14:24 +0000 (14:14 -0500)]
Cleanup: typo: column -> colon
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I6873c94805ad02e4bba1431f7202ae0185d9698f
Francis Deslauriers [Wed, 27 Nov 2019 20:16:06 +0000 (15:16 -0500)]
Add git-review config
Add .gitreview for contributors wishing to use gerrit for patch
reviews.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I3ba853d0d68a660ac5d2d24c757e0f28b634977c
Mathieu Desnoyers [Wed, 5 Feb 2020 15:37:32 +0000 (10:37 -0500)]
Version 2.12.0-rc1
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Thu, 16 Jan 2020 15:59:14 +0000 (10:59 -0500)]
Fix: build with -fno-common
GCC 10 will default to building with -fno-common, this inhibits the
linker from merging multiple tentative definitions of a symbol in an
archive. Keep only the declaration in the libustsnprintf.la convenience
library.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I8fb7c72811ce7e62f10342f55fcabeeabfdd4c67
Mathieu Desnoyers [Fri, 20 Dec 2019 15:49:20 +0000 (10:49 -0500)]
Bump LTTNG_UST_ABI_MINOR_VERSION to 1
Increment the minor version of lttng-ust ABI to 1, to take into
account that the "clear" command was added in this release cycle.
This will allow future LTTng-tools versions to check for this
capability.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Wed, 23 Oct 2019 16:57:47 +0000 (12:57 -0400)]
lttng-clear: stop tracing required
Require that tracing is stopped when buffers are cleared. Update
comments and warning checks to that effect.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Simon Marchi [Mon, 18 Nov 2019 18:44:14 +0000 (13:44 -0500)]
doc: fix build failure due to wrong whitespace character
The previous, commit:
54435b75df4c ("doc: reformat long lines in doc/examples/Makefile.am")
introduced the following build failure, when the support for JUL is
enabled:
make[1]: Entering directory '/home/smarchi/build/lttng-ust/doc/examples/java-jul'
javac -classpath "../../../liblttng-ust-java-agent/java/lttng-ust-agent-jul/lttng-ust-agent-jul.jar:../../../liblttng-ust-java-agent/java/lttng-ust-agent-common/lttng-ust-agent-common.jar:." -g Hello.java
javac -classpath "../../../liblttng-ust-java-agent/java/lttng-ust-agent-jul/lttng-ust-agent-jul.jar:../../../liblttng-ust-java-agent/java/lttng-ust-agent-common/lttng-ust-agent-common.jar:." -g FilterChangeListenerExample.java
javac -classpath "../../../liblttng-ust-java-agent/java/lttng-ust-agent-jul/lttng-ust-agent-jul.jar:../../../liblttng-ust-java-agent/java/lttng-ust-agent-common/lttng-ust-agent-common.jar:." -g ApplicationContextExample.java
make[1]: *** No rule to make target ' '. Stop.
make[1]: Leaving directory '/home/smarchi/build/lttng-ust/doc/examples/java-jul'
Makefile:979: recipe for target 'all-local' failed
make: *** [all-local] Error 1
I inadvertently inserted a character that looks like a space, but that
is not a space. make tries to interpret it as a target name, which
obviously fails.
Replace it with a proper space.
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Simon Marchi [Mon, 18 Nov 2019 17:07:51 +0000 (12:07 -0500)]
doc: reformat long lines in doc/examples/Makefile.am
Format the long lines in the all-local target a bit like the "cmake"
target is formatted already. I think it helps readability to have one
argument per line instead of very long lines.
At the same time, I removed the "cd .." at the end of parentheses. The
parentheses start a new subshell, so it's unnecessary to do "cd .."
before the subshell exits.
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Simon Marchi [Mon, 18 Nov 2019 17:07:50 +0000 (12:07 -0500)]
doc: pass AR when building examples
As reported here [1], when cross-compiling lttng-ust, the
"hello-static-lib" example uses the ar tool made for the --build machine
instead of the prefixed one, for the --host machine.
The Makefiles in the subdirectories of doc/examples are written by hand,
so that they can be easily copied and modified by users. They are
therefore not integrated in the automake build system, and any value
detected by configure must be passed explicitly when invoking it.
For example, the CC value is already explicitly passed, so that the
compiler value found by configure is passed down. We just need to do
the same for AR.
This patch adds AM_PROG_AR in configure.ac, so that configure finds the
prefixed version of ar, if cross-compiling.
It then sets the AR variable in doc/examples/Makefile.am, when invoking
sub-Makefiles. I don't think we really need it in the cmake case, but
it doesn't hurt to have it there.
[1] https://lists.lttng.org/pipermail/lttng-dev/2019-November/029388.html
Reported-by: Rolf Eike Beer <eb@emlix.com>
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Thu, 7 Nov 2019 18:48:52 +0000 (13:48 -0500)]
Require automake >= 1.12
The test suite LOG_DRIVER statement requires that automake >= 1.12 be used
during bootstrap.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Jonathan Rajotte [Fri, 28 Jun 2019 21:28:15 +0000 (17:28 -0400)]
Add procname to lttng_ust_statedump information
Adding the process procname to the statedump allows users to disable
procname context in scenario for which the data and serialization overhead
of the procname process is problematic. Users can stitch information in
post-processing based on other contexts (pid).
Users can skip this statedump via the
LTTNG_UST_WITHOUT_PROCNAME_STATEDUMP env variable.
Note that the procname statedump value is the procname seen at
application start (lttng_ust_init). Subsequent calls to pthread_setname_np
or equivalent have no effect on this value.
Since we cannot use the current thread name due to the
lttng_pthread_setname_np call in ust_listener_thread, we store the
process name inside the sock_info struct before the call to
lttng_pthread_setname_np. This data structure is already present as the
"owner" object in the statedump mechanism. During the statedump, we fetch
the procname from the "owner" object.
Use LTTNG_HIDDEN to reduce visibility of lttng_ust_sockinfo_get_procname.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Jérémie Galarneau [Thu, 24 Oct 2019 19:08:28 +0000 (15:08 -0400)]
Docs: LTTNG-UST(3): missing references to some namespace man pages
The LTTNG-UST(3) manual page is missing references to the mount,
network, ipc, and uts namespace man pages.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Wed, 23 Oct 2019 15:31:32 +0000 (11:31 -0400)]
Set version to 2.12-pre
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Wed, 23 Oct 2019 15:11:30 +0000 (11:11 -0400)]
Add pkgconfig support for liblttng-ust-ctl
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Tue, 22 Oct 2019 19:29:48 +0000 (15:29 -0400)]
Fix: uninitialized variable in lib_ring_buffer_reserve_committed
This internal function implemented in libringbuffer is not used within
lttng-ust actually, but uses an uninitialized variable:
As reported by clang:
./frontend_internal.h:263:75: warning: variable 'idx' is uninitialized when used here [-Wuninitialized]
struct commit_counters_hot *cc_hot = shmp_index(handle, buf->commit_hot, idx);
^~~
./shm.h:74:86: note: expanded from macro 'shmp_index'
____ptr_ret = (__typeof__(____ptr_ret)) _shmp_offset((handle)->table, &(ref)._ref, index, sizeof(*____ptr_ret)); \
^~~~~
./frontend_internal.h:262:27: note: initialize the variable 'idx' to silence this warning
unsigned long offset, idx, commit_count;
^
= 0
In file included from ring_buffer_backend.c:29:
In file included from ./backend.h:33:
./frontend_internal.h:263:75: warning: variable 'idx' is uninitialized when used here [-Wuninitialized]
struct commit_counters_hot *cc_hot = shmp_index(handle, buf->commit_hot, idx);
^~~
./shm.h:74:86: note: expanded from macro 'shmp_index'
____ptr_ret = (__typeof__(____ptr_ret)) _shmp_offset((handle)->table, &(ref)._ref, index, sizeof(*____ptr_ret)); \
^~~~~
./frontend_internal.h:262:27: note: initialize the variable 'idx' to silence this warning
unsigned long offset, idx, commit_count;
^
= 0
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Mon, 21 Oct 2019 17:04:31 +0000 (13:04 -0400)]
Fix: document proper liburcu version dependency
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Mon, 21 Oct 2019 17:04:14 +0000 (13:04 -0400)]
Fix: Add missing files to distribution
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Tue, 12 Feb 2019 15:40:48 +0000 (10:40 -0500)]
Add userspace vuid/vgid contexts
Add a context for each available namespaced user and group IDs
* vuid : real user ID
* veuid : effective user ID
* vsuid : saved set-user ID
These are the IDs as seen in the current user namespace, see
user_namespaces(7) and credentials(7) for details on each type.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Tue, 12 Feb 2019 15:38:25 +0000 (10:38 -0500)]
Add userspace namespace contexts
Add a context for each available kernel namespace which currently are :
cgroup, ipc, mnt, net, pid, user and uts. The id chosen to identify the
namespaces is the inode number of the file representing each one of them
in the proc filesystem.
This was introduced in kernel v3.8.0, if any of these context are
enabled on a system running an older kernel, zero will be returned.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Mon, 7 Oct 2019 19:45:46 +0000 (15:45 -0400)]
Fix: lttng perf counter deadlock
Using the ust_lock() to lazily setup the perf counters introduces
a scenario where this lock is nested within the urcu-bp read-side
lock.
However, the LTTNG_UST_WAIT_QUIESCENT ust command requires that
urcu-bp synchronize_rcu() is performed with the ust_lock() held.
This inter-dependency introduces a deadlock:
Thread A Thread B
rcu_read_lock()
ust_lock()
synchronize_rcu() (blocked by rcu
read-side lock)
ust_lock() <-- deadlock
Introduce a new lttng_perf_lock to protect the lttng perf context
data structures from concurrent modifications and from fork. This
lock can be nested within the ust_lock, but never the opposite.
This removes the circular locking dependency involving urcu bp.
Fixes: #1202
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Fri, 11 Oct 2019 14:11:39 +0000 (10:11 -0400)]
Revert "Fix: fd tracker: do not allow signal handlers to close lttng-ust FDs"
This reverts commit
48a143c09cc97bf7a2ace811277e7d60b294b5f6.
Fixes: #1204
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Mon, 7 Oct 2019 19:41:10 +0000 (15:41 -0400)]
Fix: fd tracker: do not allow signal handlers to close lttng-ust FDs
Split the thread_fd_tracking state from the ust_fd_mutex_nest used to
track whether a signal handler is nested over a fd tracker lock.
lttng-ust listener threads need to invoke
lttng_ust_fd_tracker_register_thread() so the fd tracker can
distinguish them from application threads.
Otherwise, using ust_fd_mutex_nest to try to distinguish between
ust and application threads makes it possible for signal handlers
to appear as if they are ust listener threads, and thus attempt to
close UST file descriptors.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fixes: #1199
Mathieu Desnoyers [Fri, 4 Oct 2019 19:04:13 +0000 (15:04 -0400)]
Fix: fd tracker: provide async-signal-safety for close wrapper
close(3) is part of the async-signal-safe functions. Therefore, it is
expected that the close wrapper provided by liblttng-ust-fd-tracker
behaves in a async-signal-safe way.
Use a similar strategy as ust_lock() does: disable signals when taking
and releasing the lock, and keep track of nesting with a TLS variable.
This ensures signals are restored to their original state when close(3)
ends up being invoked.
Fixes: #1199
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Fri, 4 Oct 2019 14:15:37 +0000 (10:15 -0400)]
Fix: Disable cancellation around fd tracker lock
When using the ust fd tracker LD_PRELOAD library (liblttng-ust-fd.so),
cancelling other threads while they issue "close()" leads to deadlocks.
Fixes: #1201
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Fri, 4 Oct 2019 14:07:03 +0000 (10:07 -0400)]
Fix: Lock FD tracker across fork
If fork() is performed while other threads are holding the fd tracker
lock, it will stay in locked state in the child process and eventually
cause a deadlock.
One way to solve this is to hold the fd tracker lock across fork(), in
the same way we do for the ust_lock. This ensures no other threads are
holding that lock in the parent, and therefore provides a consistent
lock state in the child.
Fixes: #1199
Fixes: #1200
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Philippe Proulx [Tue, 22 May 2018 15:47:07 +0000 (11:47 -0400)]
doc/man: include build version in GitHub links
Linking to master branch files on GitHub is not safe because files could
be renamed, whereas the layout stays the same for a given version tag.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Maxime SORIN [Fri, 17 May 2019 12:30:01 +0000 (14:30 +0200)]
Check if the AR environment variable exists for cross compilation
Signed-off-by: Maxime SORIN <msorin@msorin.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Wed, 30 May 2018 00:28:01 +0000 (02:28 +0200)]
ustctl: Implement ring buffer clear
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Simon Marchi [Tue, 20 Aug 2019 01:51:06 +0000 (21:51 -0400)]
Make bitfield.h C++-friendly
This patch changes bitfield.h to be usable in C++11.
It will probably never be compiled as C++ in the context of
lttng-ust, but this is just to keep things sync'ed across projects.
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Fri, 2 Aug 2019 14:43:35 +0000 (10:43 -0400)]
Fix: don't wait for initial statedump when 0 session active
commit
eb0e6022d5e2 "Fix: wait for initial statedump before proceeding
to the main program"
introduced a regression when an application interacts with a session
daemon which has 0 session active.
An application linked against lttng-ust started with
LTTNG_UST_REGISTER_TIMEOUT=-1 hangs forever.
Fix this by decrementing the semaphore if no statedump was requested
when the registration done command is received.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Gabriel-Andrew Pollo-Guilbert [Mon, 29 Jul 2019 22:05:35 +0000 (18:05 -0400)]
Fix: wait for initial statedump before proceeding to the main program
In the case of short lived applications, the application may exit before
the initial statedump has completed.
Higher-level trace analysis features such as translating addresses to
symbols rely on statedump. That information is required for those
analyses to work on such short-lived applications.
Force the statedump to occur before handing the control to the
application.
Fixes #1190
Signed-off-by: Gabriel-Andrew Pollo-Guilbert <gabriel.pollo-guilbert@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Jonathan Rajotte [Mon, 29 Jul 2019 18:49:59 +0000 (14:49 -0400)]
Use MAP_POPULATE to reduce pagefault when available
Any ring buffer configuration bigger than PAGE_SIZE would result
in an increased latency for the first tracepoint hit (1200ns) landing on a
new PAGE_SIZE sized chunk of the mapped memory. This happens at least
for the first ring buffer traversal.
To alleviate this we can use MAP_POPULATE that will "prefault" the page
tables.
A similar flag seems to exist on freebsd (MAP_PREFAULT_READ) but I do
not have access to a system to test it and ensure it does indeed results
in the same effect. It mostly indicates that it prefaults for the
read case so I doubt it is the case.
Default to using MAP_POPULATE on Linux only for now. Support of
prefaulting on other platforms will be added as needed.
Link: https://lists.lttng.org/pipermail/lttng-dev/2019-July/029116.html
Link: https://lists.lttng.org/pipermail/lttng-dev/2019-July/029122.html
Tested-by: Yiteng Guo <guoyiteng@gmail.com>
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Gabriel-Andrew Pollo-Guilbert [Mon, 29 Jul 2019 15:14:26 +0000 (11:14 -0400)]
Fix: remove uninitialised value
Commit
973eac638e4fd introduces an uninitialised value that may prevent
shared memory from being allocated. The compiler didn't give any warning
because the pointer to the value is sent to a function that don't do anything
with it. We simply pass NULL to that function.
Signed-off-by: Gabriel-Andrew Pollo-Guilbert <gabriel.pollo-guilbert@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Gabriel-Andrew Pollo-Guilbert [Fri, 26 Jul 2019 22:00:07 +0000 (18:00 -0400)]
Fix: GCC unaligned pointer warnings
The release of GCC 9 added the following warning:
-Waddress-of-packed-member, enabled by default, warns about an
unaligned pointer value from the address of a packed member of a
struct or union.
The warning is triggered in some place in LTTng-UST in cases where we
pass a pointer to get a result. Rather than passing the pointer directly
from the struct member, we get the result into a local storage, then
write into in the struct.
Signed-off-by: Gabriel-Andrew Pollo-Guilbert <gabriel.pollo-guilbert@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Jonathan Rajotte [Thu, 4 Jul 2019 18:51:37 +0000 (14:51 -0400)]
Fix: do not use diagnostic pragma when GCC version is lower than 4.6.0
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Jonathan Rajotte [Thu, 4 Jul 2019 18:51:36 +0000 (14:51 -0400)]
Fix: missing define when not building with gcc
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Tue, 4 Jun 2019 18:36:44 +0000 (14:36 -0400)]
Fix: client_sequence_number may dereference NULL pointer
Found by Coverity:
CID
1400710 (#1 of 1): Dereference null return value (NULL_RETURNS)
3. dereference: Dereferencing a null pointer header.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Mon, 3 Jun 2019 19:25:32 +0000 (15:25 -0400)]
Fix: namespace our gettid wrapper
Since glibc 2.30, a gettid wrapper was added that conflicts with our
static declaration. Namespace our wrapper so there is no conflict,
we'll add support for the glibc provided wrapper in a further commit.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Mon, 3 Jun 2019 18:21:10 +0000 (14:21 -0400)]
Fix: get tid not pid in vtid context
Looks like an over enthusiastic copy/paste error in
commit
98357ffd0125c23387d42d4b706c56077392326d.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Fri, 17 May 2019 13:55:23 +0000 (09:55 -0400)]
Cleanup: bitfields: streamline use of underscores
Do not prefix macro arguments with underscores. Use one leading
underscore as prefix for local variables defined within macros.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Tue, 14 May 2019 14:49:37 +0000 (10:49 -0400)]
Silence compiler "always false comparison" warning
Compiling the bitfield test with gcc -Wextra generates those warnings:
../../include/babeltrace/bitfield-internal.h:38:45: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
#define _bt_is_signed_type(type) ((type) -1 < (type) 0)
This is the intent of the macro. Disable compiler warnings around use of
that macro.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com
Mathieu Desnoyers [Tue, 14 May 2019 14:48:15 +0000 (10:48 -0400)]
Fix: bitfield: shift undefined/implementation defined behaviors
bitfield.h uses the left shift operator with a left operand which
may be negative. The C99 standard states that shifting a negative
value is undefined.
When building with -Wshift-negative-value, we get this gcc warning:
In file included from /home/smarchi/src/babeltrace/include/babeltrace/ctfser-internal.h:44:0,
from /home/smarchi/src/babeltrace/ctfser/ctfser.c:42:
/home/smarchi/src/babeltrace/include/babeltrace/ctfser-internal.h: In function ‘bt_ctfser_write_unsigned_int’:
/home/smarchi/src/babeltrace/include/babeltrace/bitfield-internal.h:116:24: error: left shift of negative value [-Werror=shift-negative-value]
mask = ~((~(type) 0) << (__start % ts)); \
^
/home/smarchi/src/babeltrace/include/babeltrace/bitfield-internal.h:222:2: note: in expansion of macro ‘_bt_bitfield_write_le’
_bt_bitfield_write_le(ptr, type, _start, _length, _v)
^~~~~~~~~~~~~~~~~~~~~
/home/smarchi/src/babeltrace/include/babeltrace/ctfser-internal.h:418:3: note: in expansion of macro ‘bt_bitfield_write_le’
bt_bitfield_write_le(mmap_align_addr(ctfser->base_mma) +
^~~~~~~~~~~~~~~~~~~~
This boils down to the fact that the expression ~((uint8_t)0) has type
"signed int", which is used as an operand of the left shift. This is due
to the integer promotion rules of C99 (6.3.3.1):
If an int can represent all values of the original type, the value is
converted to an int; otherwise, it is converted to an unsigned int.
These are called the integer promotions. All other types are unchanged
by the integer promotions.
We also need to cast the result explicitly into the left hand
side type to deal with:
warning: large integer implicitly truncated to unsigned type [-Woverflow]
The C99 standard states that a right shift has implementation-defined
behavior when shifting a signed negative value. Add a preprocessor check
that the compiler provides the expected behavior, else provide an
alternative implementation which guarantees the intended behavior.
A preprocessor check is also added to ensure that the compiler
representation for signed values is two's complement, which is expected
by this header.
Document that this header strictly respects the C99 standard, with
the exception of its use of __typeof__.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Stefan Wallentowitz [Fri, 10 May 2019 14:00:58 +0000 (16:00 +0200)]
Fix: Update coding style link
The documentation at kernel.org changed and the coding style has
moved.
Signed-off-by: Stefan Wallentowitz <stefan@wallentowitz.de>
Mathieu Desnoyers [Fri, 10 May 2019 15:51:10 +0000 (11:51 -0400)]
Fix: alignment of ring buffer shm space reservation
commit
a9ff648cc "Implement file-backed ring buffer" changes the order
of backend fields with respect to the frontend per-subbuffer
commit_counters_hot and commit_counters_cold arrays, but does not change
that order when calculating the space needed in the initial pass.
This discrepancy can be an issue for field alignment calculation.
Let's analyse the situation. If the incorrect position of alignment
calculation leads to a larger space reserved than the actual
allocations, no ill effect will be perceived by the user. However,
if space calculation is less than the allocations, it will cause the
ring buffer (and thus channel) creation to fail.
The fields that are incorrectly misplaced in size calculation (in
officially released versions) are:
* struct commit_counters_hot is aligned on CAA_CACHE_LINE_SIZE,
* struct commit_counters_cold is aligned on CAA_CACHE_LINE_SIZE,
Those are placed after (should be before) the backend fields:
* struct lttng_ust_lib_ring_buffer_backend_pages_shmp aligned on the
natural alignment of ssize_t,
* alignment on page size,
* struct lttng_ust_lib_ring_buffer_backend_pages, aligned on the natural
alignment of ssize_t,
* struct lttng_ust_lib_ring_buffer_backend_subbuffer, aligned on natural
alignment of unsigned long,
* struct lttng_ust_lib_ring_buffer_backend_counts, aligned on natural
alignment of uint64_t.
The largest alignment is the alignment on page size in the backend
fields. If we have a channel configured within specific ranges of
sub-buffer count, we should reach commit counters array dimensions
which cause the page size alignment to be lower than it should be in
the space calculation, and therefore leads to a problematic scenario
where space allocation will fail, thus leading to channel creation
failures.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Gabriel-Andrew Pollo-Guilbert [Fri, 10 May 2019 15:26:32 +0000 (11:26 -0400)]
Fix: allocate ts_end in ringbuffer shared memory
Allocate the memory used by the ts_end field added by commit
6c737d05.
When allocating lots of subbuffer for a channel (512 or more),
zalloc_shm() will fail to allocate all the objects because the allocated
memory map didn't take account the newly added field.
With lttng-tools version:
b14f53d4 (2.12.0-pre)
Steps to reproduce the bug:
1. lttng-sessiond -vvv --verbose-consumer
2. start a traced application
3. lttng create "test-sesssion"
4. lttng enable-channel --userspace --num-subbuf 512 \
--subbuf-size 8k --overwrite channel
5. lttng enable-event -u -a -c channel
6. lttng start
After these steps, the following error message show should be thrown:
Error: ask_channel_creation consumer command failed
Error: Error creating UST channel "channel" on the consumer daemon
Signed-off-by: Gabriel-Andrew Pollo-Guilbert <gabriel.pollo-guilbert@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Tue, 30 Apr 2019 15:23:44 +0000 (11:23 -0400)]
Fix: timestamp_end field should include all events within sub-buffer
Fix for timestamp_end not including all events within sub-buffer. This
happens if a thread is preempted/interrupted for a long time between
reserve and commit (e.g. in the middle of a packet), which causes the
timestamp used for timestamp_end field of the packet header to be lower
than the timestamp of the last events in the buffer (those following the
event that was preempted/interrupted between reserve and commit).
The fix involves sampling the timestamp when doing the last space
reservation in a sub-buffer (which necessarily happens before doing the
delivery after its last commit). Save this timestamp temporarily in a
per-sub-buffer control area (we have exclusive access to that area until
we increment the commit counter).
Then, that timestamp value will be read when delivering the sub-buffer,
whichever event or switch happens to be the last to increment the commit
counter to perform delivery. The timestamp value can be read without
worrying about concurrent access, because at that point sub-buffer
delivery has exclusive access to the sub-buffer.
This ensures the timestamp_end value is always larger or equal to the
timestamp of the last event, always below or equal the timestamp_begin
of the following packet, and always below or equal the timestamp of the
first event in the following packet.
This changes the layout of the ring buffer shared memory area, so we
need to bump the LTTNG_UST_ABI version from 7.2 to 8.0, thus requiring
locked-step upgrade between liblttng-ust in applications, session
daemon, and consumer daemon. This fix therefore cannot be backported
to existing stable releases.
Fixes: #1183
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Tue, 16 Apr 2019 20:17:31 +0000 (16:17 -0400)]
Harmonize rw_prog_cxx_works macro across projects
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Tue, 16 Apr 2019 20:17:30 +0000 (16:17 -0400)]
Update macros from the autoconf archive
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Wed, 10 Apr 2019 15:14:03 +0000 (11:14 -0400)]
ust-ctl API: clarify getter usage requirements
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Wed, 10 Apr 2019 14:31:47 +0000 (10:31 -0400)]
Fix: don't access packet header for stream_id and stream_instance_id getters
The stream ID and stream instance ID are invariant for a stream, so
there is no point reading them from the packet header currently owned by
the consumer (between get/put subbuf).
Actually, the consumer try to access the stream_id from the live timer
when sending a live beacon without getting the reader subbuffer first.
Doing so is racy against producers. In typical live scenarios
(non-overwrite channels), the producers will always write the same
stream id and stream instance id values at the same header offsets,
which will "work", except for the initial state of an empty buffer:
the value "0" will be returned (erroneously).
For the less frequently used scenario of a live session with "overwrite"
channels, this is handled by issuing a CHAN_WARN_ON, which disables
tracing for the channel, and prints warning to the consumerd console
when running consumerd with LTTNG_UST_DEBUG=1.
In the case where a ring buffer does not have any data ready, it makes
no sense to try to get a subbuffer for reading anyway, so the approach
was broken.
So return the stream id and stream instance id from the internal
data structures rather than reading it from the ring buffer.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Tue, 26 Mar 2019 16:41:30 +0000 (12:41 -0400)]
Add LTTNG_PACKED ifdefs to validate that it is defined
If LTTNG_PACKED is used to specify whether a structure is packed, but we
end up forgetting inclusion of lttng/ust-compiler.h (which defines it),
we end up silently _not_ packing the data structure, because
LTTNG_PACKED will be considered to be an identifier by the compiler,
and therefore simply ignored.
There are no such instances in lttng-ust, but let's add a ifdef check.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Wed, 20 Mar 2019 21:02:25 +0000 (17:02 -0400)]
Report perf integration status at configure
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Wed, 20 Mar 2019 15:07:35 +0000 (11:07 -0400)]
compat: work around broken _SC_NPROCESSORS_CONF on MUSL libc
On MUSL libc the _SC_NPROCESSORS_CONF sysconf will report the number of
CPUs allocated to the task based on the affinity mask instead of the
total number of CPUs configured on the system.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Thu, 14 Mar 2019 16:31:35 +0000 (12:31 -0400)]
Code cleanup in contexts
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sebastien Boisvert [Thu, 14 Mar 2019 12:56:15 +0000 (08:56 -0400)]
doc: remove repeated word in coding style
Signed-off-by: Sebastien Boisvert <seb@boisvert.info>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Thu, 14 Mar 2019 15:39:59 +0000 (11:39 -0400)]
tap-driver.sh: flush stdout after each test result
This is useful in a CI system where stdout is fully buffered and you
look at the console output to see which test is hanging.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Jonathan Rajotte [Fri, 8 Mar 2019 15:01:12 +0000 (10:01 -0500)]
Move wait_shm_mmap initialization to library constructor
Prevent us from deadlocking ourself if some glibc implementation
decide to hold the dl_load_* locks on fork operation.
This happens on Yocto Rocko and up when performing python tracing (import
lttngust). Why Yocto decided to patch glibc this way is a mystery
(ongoing effort) [1][2][3].
Anyhow, we can prevent this by moving the initialization of the
wait_shm_mmap to the library constructor since the dl_load_* locks are
nestable mutex.
Nothing in the git log for the wait_shm_mmap indicate a specific reason
to why it was done inside the listener thread. Doing it inside
wait_for_sessiond can help in some corner cases were /dev/shm
(or the shm path) files are unlinked. This is not much of an advantage.
[1] From yocto master branch:
ee9db1a9152e8757ce4d831ff9f4472ff5a57dad
[2] From OE-Core:
f2e586ebf59a9b7d5b216fc92aeb892069a4b0c1
[3] https://www.mail-archive.com/openembedded-core@lists.openembedded.org/msg101186.html
This was tested on a Yocto Rocko qemu x86-64 image with python agent
enabled.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 14 Feb 2019 21:39:57 +0000 (16:39 -0500)]
Fix: additional compiler barriers for procname context
Use additional volatile load/stores and compiler barriers to make
sure the compiler do not reorder the nesting counter wrt procname cache
content load/stores.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 14 Feb 2019 21:14:42 +0000 (16:14 -0500)]
Fix: procname context async-signal safety
Ensure an instrumented signal handler interrupting the procname
context code will not write a partial process name string into the
trace context.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 14 Feb 2019 20:47:34 +0000 (15:47 -0500)]
Cleanup vtid/vpid context caches
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Thu, 7 Feb 2019 20:24:31 +0000 (15:24 -0500)]
Cleanup: fix typo 'acces' -> 'access'
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Jonathan Rajotte [Wed, 14 Nov 2018 19:38:37 +0000 (14:38 -0500)]
Fix: Initialize fd field of struct lttng_ust_elf to -1 at allocation
In rare cases when the executable cannot be open, using a default value
of zero lead to invalid close call and fd tracker removal.
fixes #1171
Reported-by: Stefan Palade <stefan.palade@windriver.com>
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Mon, 14 Jan 2019 21:29:28 +0000 (16:29 -0500)]
Cleanup: test Makefiles
Remove unnessary complexity and use specific names for test programs.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Thu, 20 Dec 2018 20:22:42 +0000 (15:22 -0500)]
Add silent mode to examples Makefiles
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Thu, 20 Dec 2018 20:22:41 +0000 (15:22 -0500)]
Add silent rules support for docs
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Thu, 20 Dec 2018 20:22:40 +0000 (15:22 -0500)]
Use config.h to define SONAME major number
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Thu, 20 Dec 2018 20:22:39 +0000 (15:22 -0500)]
Use a variable to select the dlopen lib in Makefiles
Instead of multiple conditionnals, it makes for cleaner and more
readable Makefiles.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Wed, 12 Dec 2018 21:41:28 +0000 (16:41 -0500)]
Add hello-many to gitignore
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Wed, 28 Nov 2018 21:56:59 +0000 (16:56 -0500)]
Adapt lttng-ust to use multiflavor symbols from liburcu 0.11
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 8 Nov 2018 17:42:29 +0000 (12:42 -0500)]
Clarify lib_ring_buffer_switch_slow() requirements
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Wed, 17 Oct 2018 20:07:56 +0000 (16:07 -0400)]
tests: hello-many
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Wed, 17 Oct 2018 19:48:16 +0000 (15:48 -0400)]
Fix: sync event enablers before choosing header type
On session start, we should allocate the event IDs before figuring
out the number of events per channel and select the proper header
type.
Without this, the number of events is always perceived to be 0,
which selects the "compact" header type.
With UST, the order of those two actions is not the only one
affecting the chosen header type: UST can receive the session
start command before all probe provider library constructors
have completed running, therefore finding less events than
eventually enabled within the process. Moreover, with per-uid
buffers, many processes end up registering events into shared
buffers. Therefore, the guess based on number of events from
the first process to use the buffer is incorrect.
Considering that we typically have applications with more than
30 events, we will modify the session daemon so it selects the
"large" header type independently of the number of events.
We still want to swap the order of the enablers sync vs header
type getter because we may revisit how session enabling is done
in a process wrt constructor completion, which may allow us to
do a more precise choice for per-pid buffers in the future.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Omair Majid [Thu, 11 Oct 2018 18:28:49 +0000 (14:28 -0400)]
Fix: address shellcheck warnings/errors in example scripts
ShellCheck points out a number of warnings in the example scripts. In
particular, a number of normal and special shell variables are not
quoted correctly.
Signed-off-by: Omair Majid <omajid@redhat.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 27 Sep 2018 19:21:16 +0000 (15:21 -0400)]
Fix: check for event class/instance prototype mismatch
The TP_ARGS() for an event instance belonging to an event class
must have compatible types with the event class TP_ARGS().
Failure to follow this rule leads to a prototype mismatch between the
tracepoint call site and the probe function. A common effect perceived
is that events with prototype mismatch between call site and probe
function are never traced.
Fix this by enforcing a compile-time check of the event instance and
class prototypes, similarly to what is done in LTTng modules.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 20 Sep 2018 18:11:17 +0000 (14:11 -0400)]
Fix: race between statedump and library destructor
The locking scheme for ust_lock() returns a teardown state (variable
lttng_ust_comm_should_quit) which is set by library destructor with lock
held.
It requires that when ust listener threads use this lock to protect
against concurrent accesses to a data structure, in addition to take
the lock, they need to check the return value of ust_lock() and
skip their critical section entirely if the return value indicates
that teardown is ongoing.
Iteration over all loaded libraries by lttng_ust_dl_update() starts by
iter_begin which grabs the lock, and sets data->cancel state
appropriately if teardown is ongoing. Then extract_bin_info_events()
uses the data->cancel state to skip over use of the protected structures
as needed, but iter_end() fails to take this data->cancel state into
account. Therefore, it can access data structures concurrently while
their teardown is ongoing which leads to crashes.
Fixes: #1169
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Fri, 7 Sep 2018 15:28:51 +0000 (11:28 -0400)]
Fix: reset procname on fork in child process
lttng-ust(3) documents:
procname
Thread name, as set by exec(3) or prctl(2). It is recommended
that programs set their thread name with prctl(2) before
hitting the first tracepoint for that thread.
We can rightfully expect that this applies to the first thread created
within a child process upon fork. Reset the procname cache in the child
on fork.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 6 Sep 2018 15:32:24 +0000 (11:32 -0400)]
Version 2.11.0-rc1
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Wed, 5 Sep 2018 19:56:59 +0000 (15:56 -0400)]
Fix: add missing stdbool.h include
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Francis Deslauriers [Tue, 4 Sep 2018 21:05:14 +0000 (17:05 -0400)]
Move symbol preventing unloading of probe providers
Issue
=====
Calling dlclose on the probe provider library that first loaded
__tracepoints__disable_destructors in the symbol table does not
unregister the probes from the callsites as the destructors are not
executed.
The __tracepoints__disable_destructors weak symbol is exposed by probe
providers, liblttng-ust.so and liblttng-ust-tracepoint.so libraries. If
a probe provider is loaded first into the address space, its definition
is bound to the symbol. All the subsequent loaded libraries using the
symbol will use the existing definition of the symbol, thus creating a
situation where liblttng-ust.so or liblttng-ust-tracepoint.so depend on
the probe provider library.
This prevents the dynamic loader from unloading the library as it is
still in use by other libraries. Because of this, the execution of its
destructors and the unregistration of the probes is postponed. Since the
unregistration of the probes is postponed, event will be generated if
the callsite is executed even though the probes should not be loaded.
Solution
========
To overcome this issue, we no longer expose this symbol in the
tracepoint.h file to remove the explicit dependency of the probe
provider on the symbol. We instead use the existing dlopen handle on
liblttng-ust-tracepoint.so and use dlsym to get handles on functions
that disable and get the state of the destructors.
Version compatibility
=====================
- This change is backward compatible with UST applications and libraries
built on lttng-ust version before 2.11. Those applications will use
the __tracepoints__disable_destructors symbol that is now exposed
as a weak symbol in the liblttng-ust-tracepoint.so library. This
symbol is alway checked in 2.11 in case an old app is running.
- Applications built with this change will also work in older versions
of lttng-ust as there is a check to see if the new destructor state
checking method should be used, if it is not we fallback to a
compatibility method. To ensure compatibility in this case, we also
look up and keep up-to-date the __tracepoints__disable_destructors
value using the dlopen-dlsym combo.
- A mix of applications/probes builds in part against 2.10 and 2.11
also work. When setting the destructor state from a binary built
against 2.11 headers, both old/new states are set, so a binary built
against 2.10 will correctly see the old state. When querying the state
from a binary built against 2.11 headers, both old and new states are
queried, so if the state has been set from a binary built against
2.10 headers, the old state will be set.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Mon, 20 Aug 2018 21:20:05 +0000 (17:20 -0400)]
Fix: Remove unused line from liblttng-ust-fd makefile
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Vitaly Lipatov [Sat, 30 Jun 2018 09:07:34 +0000 (12:07 +0300)]
Fix: add liblttng-ust dependency to liblttng-ust-fd
Signed-off-by: Vitaly Lipatov <lav@etersoft.ru>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Vitaly Lipatov [Sat, 30 Jun 2018 09:07:21 +0000 (12:07 +0300)]
Fix: use LIBDL/LIBC_DL to select either libdl or libc
Use LTTNG_UST_BUILD_WITH_LIBDL/LIBC_DL variables to choose between -ldl
and -lc.
Add a missing direct dependency against -ldl or -lc to
liblttng_ust_tracepoint_la_LIBADD.
Signed-off-by: Vitaly Lipatov <lav@etersoft.ru>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 7 Jun 2018 16:11:03 +0000 (12:11 -0400)]
Fix: lttng filter validator ERANGE error handling
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Mon, 25 Sep 2017 20:24:02 +0000 (16:24 -0400)]
Filter: implement dynamic typing for load object
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Mon, 25 Sep 2017 15:37:28 +0000 (11:37 -0400)]
Filter: add FILTER_OP_RETURN_S64 instruction
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
This page took 0.048496 seconds and 4 git commands to generate.