Mathieu Desnoyers [Sat, 1 Oct 2016 22:59:17 +0000 (18:59 -0400)]
Fix: perform TLS fixup in all UST entry points from each thread
Each entry point into lttng-ust that end up taking the ust lock need to
perform a TLS fixup for each thread. Add a TLS fixup in both listener
threads, in fork and base address dump helper libs, and in app context
and tracepoint probe registration/unregistration functions, which can be
called from application threads.
Those ensure we don't take the libc dl lock within the ust lock when
performing the TLS lazy fixup.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Jonathan Rajotte [Mon, 3 Oct 2016 14:42:45 +0000 (10:42 -0400)]
Fix: build: pass configure flags to cmake example
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Sun, 25 Sep 2016 16:31:11 +0000 (12:31 -0400)]
Performance: implement lttng_inline_memcpy
Because all length parameters received for serializing data coming from
applications go through a callback, they are never constant, and it
hurts performance to perform a call to memcpy each time.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Sun, 25 Sep 2016 14:50:22 +0000 (10:50 -0400)]
Performance: mark ring buffer do_copy callers always inline
The underlying copy operation is more efficient if the size is a
constant, which only happens if this function is inlined in the caller.
Otherwise, we end up calling memcpy for each field.
Force inlining for performance reasons for:
- lib_ring_buffer_write,
- lib_ring_buffer_do_strcpy,
- lib_ring_buffer_strcpy.
Note that in lttng-ust, the probe provider serialization functions need
to call the lttng_event_write() client callback, which will fallback to
the memcpy operation.
Inlining those functions helps for the event header code, which can
inline them.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Mon, 19 Sep 2016 02:52:39 +0000 (22:52 -0400)]
Performance: cache the backend pages pointer in context
Getting the backend pages pointer requires walking through the ring
buffer backend tables through multiple shmp operations. Cache the
current value so it can be re-used for all backend write operations
writing fields for the same event.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Sat, 24 Sep 2016 14:25:10 +0000 (10:25 -0400)]
Add ctx_len field to ring buffer context
Allow extending the structure beyond its original size.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Mon, 19 Sep 2016 02:10:53 +0000 (22:10 -0400)]
ring buffer: handle shmp errors
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Mon, 19 Sep 2016 01:45:32 +0000 (21:45 -0400)]
Cleanup: libringbuffer: remove duplicate shmp() invocations in slow paths
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Mon, 19 Sep 2016 01:38:38 +0000 (21:38 -0400)]
Performance: Only dereference shmp once
Dereferencing shared-memory pointers is expensive: many bound checks are
performed. Ensure the shmp is only dereferenced once in the commit
fast-path.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Mon, 19 Sep 2016 01:31:02 +0000 (21:31 -0400)]
Performance: Mark channel and buffer event disabled check unlikely
Channel and buffer are typically enabled when tracing, else the probes
would not be connected. Ensure the compiler optimizes for the right
usual case.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Sun, 18 Sep 2016 04:25:58 +0000 (00:25 -0400)]
Performance: Relax atomicity constraints for crash handling
Use a store rather than a cmpxchg() for the update of the
sequential commit counter. This speeds up commit. The downside
is that short race windows between the if() check to see if the
counter is larger than the new value and the update could result
in the counter going backwards, in unlikely preemption or signal
delivery scenarios.
Accept that we may lose a few events in a crash dump for the
benefit of tracing speed.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Mon, 12 Sep 2016 22:58:50 +0000 (18:58 -0400)]
Fix: compat: -ust suffix sprintf error handling
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Fri, 9 Sep 2016 20:54:20 +0000 (16:54 -0400)]
Performance: disable event counting by default
Disable event counting in the ring buffer, which can count the number of
events produced per ring-buffer, as well as the number of events
overwritten in overwrite mode.
This feature is currently unused anyway: it is not saved in the ring
buffer header, nor made available to lttng-tools.
This saves 70 ns/event in lttng-ust on the ARM32 Cubietruck.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Fri, 2 Sep 2016 19:20:41 +0000 (15:20 -0400)]
Fix: remove unlock in getcpu
Causes unbalanced RCU read-side lock if nesting safety net is triggered.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Sat, 16 Jul 2016 17:48:09 +0000 (13:48 -0400)]
Performance: remove rcu read lock from ring buffer get/put cpu
The tracepoints are already protected by a RCU-bp read-side lock, so
trying to take this nested lock is useless. We gain 132 ns/event on the
ARM32 Cubietruck by removing this nested rcu read-side lock.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Sat, 16 Jul 2016 16:18:32 +0000 (12:18 -0400)]
Performance: define _LGPL_SOURCE in LGPL c files
Brings a performance gain of 55 ns/event on the ARM32 Cubietruck by
adding _LGPL_SOURCE to ring buffer clients.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Sat, 16 Jul 2016 03:22:08 +0000 (23:22 -0400)]
Performance: split check deliver fast/slow paths
On ARMv7l (Cubietruck), the compiler generates a function call for each
lib_ring_buffer_check_deliver, even though it typically only do an
unlikely check. Split it into an inline fast path, and a function call
for the slow path. This brings a performance gain of about 500ns/event
on the Cubietruck.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 18 Aug 2016 18:21:46 +0000 (14:21 -0400)]
Fix: perf counters build against kernel headers < 3.12
Copy Linux kernel perf_event.h installed headers into lttng-ust to know
the recent ABI layout, and use the bit description detailed in the
following Linux kernel commit:
https://github.com/torvalds/linux/commit/
fa7315871046b9a4c48627905691dbde57e51033
to check whether the kernel supports rdpmc.
Fall-back on the perf read system call for kernels prior to 3.12,
because older kernels have an ABI bug where a union was used for both
cap_usr_time and cap_usr_rdpmc.
Ensure setup_perf set the pc pointer value before checking whether we
need to the file descriptor open or not.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 18 Aug 2016 20:07:30 +0000 (16:07 -0400)]
Fix: perf counter context deadlock
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Mon, 8 Aug 2016 21:08:00 +0000 (17:08 -0400)]
Fix: many-events registration/unregistration speed
Batch invocation of synchronize_rcu() when unregistering many events
from a session.
Also batch invocation of synchronize_rcu() when registering the same
events within many concurrent sessions (starting from the 2nd session).
Those slowdowns are noticeable with applications processes that have a
short life-time, e.g. shell scripts spawning multiple short-lived
processes take significantly longer to complete when LD_PRELOADing a UST
probe provider.
This slowdown only occurs when UST tracing sessions are created in the
session daemon.
tracepoint_probe_update_all() (currently unused) implements a similar
mechanism which has the downside of iterating on all events in all probe
libraries (not as efficient). Move synchronize_rcu() in
tracepoint_probe_update_all() outside of the iteration on all events to
free in this function, because it is only needed between the last
callsite update and the first memory reclaim, not between list removal
and reclaim.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Tue, 26 Jul 2016 20:54:55 +0000 (16:54 -0400)]
Fix: pre-fault TLS in ust-malloc instrumentation
Faulting the TLS variable when accessed for the first time can trigger
deadlocks with internal libc lock when using the liblttng-ust-malloc
wrapper. Fix this by pre-faulting it in a library constructor, similarly
to the approach taken for all other TLS variables in lttng-ust.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Tue, 19 Jul 2016 20:52:21 +0000 (16:52 -0400)]
Fix: ust-ctl: use LTTNG_UST_HAVE_PERF_EVENT to report perf counter availability
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 14 Jul 2016 21:47:08 +0000 (17:47 -0400)]
Fix: reset vtid cache before releasing urcu locks
When tracing pthread mutex lock/unlock, we need to reset the vtid
context cache before unlocking the urcu lock, else we have vtid/vpid
discrepancies.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 14 Jul 2016 16:21:13 +0000 (12:21 -0400)]
Fix: cleanup local_apps.allowed flag on lib cleanup
In case of applications using fork/clone, which drop their privileges,
we need to clear the local_apps.allowed flag, otherwise those
application get an assertion when using the liblttng-ust-fork helper:
e.g.
varnishd: lttng-ust-comm.c:423: setup_local_apps: Assertion `local_apps.allowed == 0' failed.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Alexandre Montplaisir [Wed, 13 Jul 2016 19:36:19 +0000 (15:36 -0400)]
Fix: Correctly handle invalid agent port file
Handle the cases where the Java agent could find a port file
that is either empty, or contains text that cannot be parsed
to a number.
Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Wed, 13 Jul 2016 19:13:28 +0000 (15:13 -0400)]
Fix: memory corruption in compat.h
Found by Coverity:
CID
1357641 (#1 of 1): Out-of-bounds write (OVERRUN)2. sprintf_overrun:
sprintf will overrun its first argument &name[len] which can accommodate
4 bytes. The number of bytes written may be 5 bytes, including the
terminating null.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Tue, 12 Jul 2016 20:28:45 +0000 (16:28 -0400)]
Introduce lttng_ust_loaded weak symbol
This variable can be tested by applications to check whether lttng-ust
is loaded. They simply have to define their own "lttng_ust_loaded" weak
symbol, and test it. It is set to 1 by the library constructor.
The main use-case is to allow applications to detect that they should
not try to close file descriptors that do not belong to them (e.g. BSD
closefrom). This is a common pattern with applications invoking
daemon(3).
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Tue, 12 Jul 2016 20:22:36 +0000 (16:22 -0400)]
Revert "Introduce LTTNG_UST_LOADED environment variable"
This reverts commit
2315088b93f925c5cccee865ccb8f6bc542e52dc.
We will introduce a solution based on a weak symbol instead, which does
not "leak" to children's exec.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Tue, 12 Jul 2016 19:11:06 +0000 (15:11 -0400)]
Introduce LTTNG_UST_LOADED environment variable
Set internally by liblttng-ust's constructor. Can be used by
applications to detect if lttng-ust is loaded, even if liblttng-ust is
not directly linked by the application.
The main use-case is to allow applications to detect that they should
not try to close file descriptors that do not belong to them (e.g.
BSD closefrom). This is a common pattern with applications invoking
daemon(3).
Note that this environment variable is passed to children of a traced
process, and through exec calls. Therefore, an application might think
that lttng-ust is loaded even though it's not loaded in its own address
space if it was loaded by one of its parent processes.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Tue, 12 Jul 2016 13:51:40 +0000 (09:51 -0400)]
Fix: remove invalid free
On this error path, we should not free lttng_chan, because it is located
within an allocated shm memory area associated with the channel now. It
is invalid to free this pointer.
This is invoked on a channel creation error path.
Reported-by: Aravind HT <aravind.ht@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Philippe Proulx [Fri, 8 Jul 2016 17:20:52 +0000 (13:20 -0400)]
Use AC_PROG_MKDIR_P (generic mkdir -p)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Philippe Proulx [Fri, 8 Jul 2016 17:18:37 +0000 (13:18 -0400)]
Split CMake example build steps on different lines
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Philippe Proulx [Fri, 8 Jul 2016 17:13:32 +0000 (13:13 -0400)]
Fix: CMake example: specify source/built includes/libs
Fixes: #1042
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Wed, 6 Jul 2016 20:19:57 +0000 (16:19 -0400)]
configure: allow building perf support across all architectures
Now that we use a read fallback for reading pmu counters, allow building
perf support across all architectures.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Wed, 6 Jul 2016 19:16:30 +0000 (15:16 -0400)]
Fix: use-after-free in statedump lib iter_end
Found by Coverity:
** CID
1357361: Memory - corruptions (USE_AFTER_FREE)
/liblttng-ust/lttng-ust-statedump.c: 440 in iter_end()
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Wed, 6 Jul 2016 19:11:57 +0000 (15:11 -0400)]
Add generic fallback for perf counter read
On x86, test the cap_user_rdpmc flag and fall-back on a system call if
unset.
On all other architectures, use the system call fallback.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Wed, 6 Jul 2016 18:47:00 +0000 (14:47 -0400)]
Fix: perf counters: sign-extend pmc register
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Geneviève Bastien [Wed, 6 Jul 2016 15:36:35 +0000 (11:36 -0400)]
doc: Add flags for JUL and python agent compiling
The compilation flag documentation is added to the README.md and
configure.ac files for easier access to them.
Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Philippe Proulx [Mon, 4 Jul 2016 21:47:30 +0000 (17:47 -0400)]
tests/hello.cxx: add ctf_enum_auto() entries
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Philippe Proulx [Mon, 4 Jul 2016 21:04:42 +0000 (17:04 -0400)]
Add ctf_enum_auto() for autoincrementing enumeration values
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Tue, 5 Jul 2016 20:09:32 +0000 (16:09 -0400)]
Add missing ust_lib.c and ust_lib.h
The new lib load/unload events are implemented in those two files.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Mon, 4 Jul 2016 21:06:04 +0000 (17:06 -0400)]
dl instrumentation: add dlmopen event, trace dlopen flags
Add missing dlmopen(3) instrumentation, and add the "flags" field to
dlopen instrumentation.
Link: http://man7.org/linux/man-pages/man3/dlopen.3.html
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Mon, 4 Jul 2016 19:39:01 +0000 (15:39 -0400)]
Add library load/unload tracking events
Track library load and unload, with the following new events:
lttng_ust_lib:load
lttng_ust_lib:build_id
lttng_ust_lib:debug_link
lttng_ust_lib:unload
This takes care of correctly tracing the mapping of direct dependencies
of dlopen'd libraries, which was not appropriately done by tracing just
dlopen events.
Fixes: #1035
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Tue, 5 Jul 2016 17:10:11 +0000 (13:10 -0400)]
Communication protocol: use fixed-size integer rather than enum
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Julien Desfossez [Thu, 30 Jun 2016 15:43:50 +0000 (11:43 -0400)]
Add ustctl command to regenerate the statedump
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 14 Apr 2016 19:13:05 +0000 (15:13 -0400)]
Implement statedump command in UST
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Philippe Proulx [Tue, 28 Jun 2016 23:40:36 +0000 (19:40 -0400)]
tests/hello.cxx: add enumeration field
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Philippe Proulx [Tue, 28 Jun 2016 23:11:04 +0000 (19:11 -0400)]
Fix: ctf_enum_value() does not work with g++
g++ does not support non-trivial designated initializers like
C99 does, thus the fields must be initialized in order
in ctf_enum_value().
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Tue, 28 Jun 2016 03:06:25 +0000 (23:06 -0400)]
Fix: lttng context perf: missing stdbool.h header include
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Julien Desfossez [Mon, 27 Jun 2016 21:40:01 +0000 (17:40 -0400)]
Add perf context support for ARMv7
Allow to add perf context to UST traces. ARMv7 does not have a reliable
way to read perf PMU counters entirely from user-space like we do on
x86, so this approach requires a system call every time a counter needs
to be read which has a significant performance impact.
ARMv7 does not have way to read PMU from userspace because it requires
write access to the debug coprocessor to select which PMU counter to
read which defeats user-space/kernel protection. For that reason, the
bits required to allow user-space access to those registers are not
enabled in the kernel and Perf does not expose any information in the
shared mmap page, so we do not know what is the counter index. Also, for
ARMv7 we cannot set the exclude_kernel flag, so the counter stays active
even when the process is executing in kernel context (system calls
mainly).
This generic approach might work on other architecture, but it has not
yet been tested so it is not enabled in the code.
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Julien Desfossez [Mon, 27 Jun 2016 21:40:00 +0000 (17:40 -0400)]
Keep perf context FD open for other architectures
Instead of closing the perf context after the page has been mapped, keep
it open so it can be used with the read() system call if the
architecture does not support direct access from user-space.
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Mon, 27 Jun 2016 16:38:35 +0000 (12:38 -0400)]
Doc: cmake example: fix coding style
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sebastien Boisvert [Fri, 17 Jun 2016 03:32:05 +0000 (23:32 -0400)]
Doc: ship cmake example with 'make distcheck'
The file Makefile.am in the examples directory was modified. The
modifications were done to include the new cmake example. The new cmake
example is built when make is invoke in the root directory. Further,
this new example also ships in the tarball when the latter is created
("make distcheck").
Acked-by: Philippe Proulx <eeppeliteloop@gmail.com>
Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Sebastien Boisvert <sboisvert@gydle.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sebastien Boisvert [Thu, 16 Jun 2016 15:41:11 +0000 (11:41 -0400)]
Doc: add CMake example
In doc/examples/cmake-multiple-shared-libraries/, a new example lives.
This example requires a C++ compiler (HAVE_CXX) and it requires also a
cmake executable (HAVE_CMAKE). This example relies on the cmake module
called FindLTTngUST, which was kindly provided by Philippe Proulx.
The alignment of a small amount of lines was improved in the FindLTTngUST
module.
This new example generates a shared library (tracepoint provider) that
links with dl and with lttng-ust. Two other shared libraries are also
generated, and these two are linked with the tracepoint provider shared
library.
Link: https://lists.lttng.org/pipermail/lttng-dev/2016-June/026213.html
Link: https://lists.lttng.org/pipermail/lttng-dev/2016-June/026203.html
Link: https://www.pastery.net/fvanfh/raw/
Acked-by: Philippe Proulx <eeppeliteloop@gmail.com>
Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Sebastien Boisvert <sboisvert@gydle.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sebastien Boisvert [Tue, 21 Jun 2016 01:11:00 +0000 (21:11 -0400)]
configure.ac: check cmake availability
In the configure.ac file, detect if a cmake executable is
available. Two new variables are now available in any
Makefile.am file: HAVE_CXX (which tells if a C++ compiler
is available) and HAVE_CMAKE (which indicates whether a cmake
executable is available).
Acked-by: Philippe Proulx <eeppeliteloop@gmail.com>
Acked-by: Sebastien Boisvert <sboisvert@gydle.com>
Signed-off-by: Sebastien Boisvert <sboisvert@gydle.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Thu, 16 Jun 2016 15:33:51 +0000 (11:33 -0400)]
Only build python lib when agent is enabled
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Thu, 16 Jun 2016 15:33:34 +0000 (11:33 -0400)]
doc: information has no plural
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Wed, 15 Jun 2016 20:34:09 +0000 (16:34 -0400)]
Fix: allow non-LGPL modules to use tracepoints
Non-LGPL modules that use tracepoint instrumentation, but have no
compile unit defining either TRACEPOINT_DEFINE or
TRACEPOINT_CREATE_PROBES fail to build due to undefined reference to
`tracepoint_dlopen_ptr'.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Raphaël Beamonte [Sun, 5 Jun 2016 22:00:10 +0000 (18:00 -0400)]
Add -ust to the name of UST threads of the application
Add the required functions to change the thread name of the UST
threads and add the -ust string at its end. This will help to
identify LTTng-UST processes when analyzing the trace of a process.
Signed-off-by: Raphaël Beamonte <raphael.beamonte@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Alexandre Montplaisir [Thu, 2 Jun 2016 09:26:54 +0000 (05:26 -0400)]
Comment the locking mechanisms in ContextInfoManager
Coverity didn't like our non-locking of the get() method. The
lock is actually only needed for the registration/unregistration
of retrievers, the get() can access the ConcurrentHashMap
directly.
Add a few comments to help explain this.
Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Alexandre Montplaisir [Thu, 2 Jun 2016 09:22:13 +0000 (05:22 -0400)]
Fix: Null-check return value of log4j.Category.getAllAppenders()
Coverity points out this can be null, null-check it to be safe.
If it in indeed null, we must still continue on to verify the
parent loggers.
Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Alexandre Montplaisir [Thu, 2 Jun 2016 09:15:47 +0000 (05:15 -0400)]
Add liblttng-ust-agent.jar to the .gitignore
This is a compatibility symlink that is now installed by
lttng-ust-agent-all.
Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Alexandre Montplaisir [Thu, 2 Jun 2016 09:12:44 +0000 (05:12 -0400)]
Fix: Specify encoding when reading agent port file
FileReader uses the default platform encoding. InputStreamReader
on the other hand allows supplying an encoding, which is always
safer to do.
Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Alexandre Montplaisir [Thu, 2 Jun 2016 07:29:48 +0000 (03:29 -0400)]
Fix: Include child loggers in the output of "lttng list"
The case where a parent logger has an handler attached but the
tracepoint comes from a child logger is not correctly handled
by the "lttng list -j/-l" command.
For example, if the logger "org.myapp" has a LTTng handler
attached, its child logger "org.myapp.mycomponent" would be
absent from the lttng list output even if it exists.
When checking for events to list, search through the parent
tree of each logger to find a potential LTTng handler.
This should also fix the problem of "lttng list" always
returning empty when the deprecated, but still supported,
LTTngAgent API was used, since that one attaches only one
handler to the root logger.
Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Alexandre Montplaisir [Thu, 2 Jun 2016 07:05:31 +0000 (03:05 -0400)]
Fix: Handle both agent config files pointing to same port
The expected locations for the user and root agent sessiond
configuration files are ~/.lttng/agent.port and
/var/run/lttng/agent.port, respectively. These files indicate
which port an agent should connect to to reach its respective
sessiond.
If by some bad luck both files indicate the same port, then
both Java TCP clients would end up connecting to the same
sessiond, resulting in weird results, like "lttng list" listing
all events twice.
Make sure the target ports are different, and avoid duplicate
connections in case there are not.
Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Alexandre Montplaisir [Thu, 2 Jun 2016 03:03:07 +0000 (23:03 -0400)]
Suppress static method warning
The LTTngAgent#dispose method is static on purpose (see commit
9355f049), and will remain so as long as this agent will be
supported, so we can suppress the compiler warning telling
us the method can be made static.
Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Alexandre Montplaisir [Thu, 2 Jun 2016 01:15:31 +0000 (21:15 -0400)]
Add more logging to the LttngTcpSessiondClient
There can be up to 4 TCP clients running at the same time
(for all combinations of user/root and jul/log4j), the
logging should differentiate between them.
Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Mon, 30 May 2016 20:31:33 +0000 (16:31 -0400)]
Use config.h to detect sched_getcpu support
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Mon, 30 May 2016 20:31:32 +0000 (16:31 -0400)]
Fix: use limits.h in ust-elf test
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Mon, 30 May 2016 20:31:31 +0000 (16:31 -0400)]
Fix: strerror_r behavior is glibc specific
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Mon, 30 May 2016 20:31:30 +0000 (16:31 -0400)]
Add support for musl libc to ust-dlfcn.h
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Mon, 30 May 2016 16:47:50 +0000 (18:47 +0200)]
Fix: don't generate 0-len array in tracepoint probes
It is forbidden by C99, and gcc/g++ in pedantic mode generates errors
for e.g. field-less events.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Jonathan Rajotte [Thu, 26 May 2016 22:05:12 +0000 (18:05 -0400)]
Fix: log4j example: set logger level to prevent unexpected level inheritance
BSF or other jars can ship with log4j.properties file embedded. This
causes problem when launching application with a general class path (e.g
/usr/share/java/*) since log4j will look for a property file in all
loaded jars. If any contains directive for the root logger it will
affect any logger with no level who are directly under the root logger.
This could result in an unexpected behaviour (e.g no events triggered
etc.).
Link: https://issues.apache.org/jira/browse/BSF-24
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Wed, 25 May 2016 23:39:15 +0000 (19:39 -0400)]
Fix: no LGPL define for malloc and pthread wrappers
Do _not_ define _LGPL_SOURCE because we don't want to create a circular
dependency loop between this malloc wrapper, liburcu and libc.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Wed, 25 May 2016 21:15:21 +0000 (17:15 -0400)]
Fix: all lttng-ust source files should be tagged _LGPL_SOURCE
Defining tracepoint call sites and probes as _LGPL_SOURCE allows
inlining RCU code into lttng-ust, which improves performance.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Wed, 25 May 2016 21:19:35 +0000 (17:19 -0400)]
Fix: initialize RCU callbacks with mixed LGPL/non-LGPL objects
Linking both _LGPL_SOURCE and non-_LGPL_SOURCE objects into the same
module may result in having the RCU callbacks left to NULL, which
prevents tracing for tracepoints and/or probes which sit in the non-LGPL
compile unit.
This happens if the contructor of the LGPL compile unit is executed
first, thus incrementing the __tracepoint_registered counter, which will
prevent later execution of that same constructor in the non-LGPL compile
unit to initialize the RCU callbacks in __tracepoint__init_urcu_sym().
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Wed, 25 May 2016 21:17:41 +0000 (17:17 -0400)]
Fix: incorrect structure layout with mixed LGPL/non-LGPL objects
Linking both _LGPL_SOURCE and non-_LGPL_SOURCE objects into the same
module may result in corruption. If the tracepoint_dlopen object used is
the one declared by a LGPL compile unit, a non-LGPL compile unit may try
to initialize fields beyond the end of the structure.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Tue, 24 May 2016 22:58:14 +0000 (18:58 -0400)]
Fix: don't call __builtin_return_address(0) on 32-bit powerpc
Invoking __builtin_return_address(0) corrupts the stack, as previously
noticed for the "ip" context. Disable its use on 32-bit powerpc
everywhere else in the lttng-ust code base.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Tue, 24 May 2016 20:14:25 +0000 (16:14 -0400)]
Update version name TBD
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Tue, 24 May 2016 20:05:02 +0000 (16:05 -0400)]
Update version to 2.9.0-pre
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Mon, 23 May 2016 16:06:33 +0000 (12:06 -0400)]
Fix: tracepoint header: declare tracepoint_dlopen_ptr
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Mon, 23 May 2016 15:37:07 +0000 (11:37 -0400)]
Fix: update debug message about weak-hidden symbols
We actually deal OK with compilers that treats weak-hidden symbols as
different addresses between compile units part of the same module.
Simply report this without statement on whether or not the compiler
producing this code is broken.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Mon, 23 May 2016 15:05:21 +0000 (11:05 -0400)]
Fix: tracepoint-rcu header: use tracepoint_dlopen_ptr
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Mon, 23 May 2016 01:29:58 +0000 (21:29 -0400)]
Fix: test: relax requirement on weak-hidden symbol address
Now that tracepoint.h works around gcc issues by adding a pointer
indirection, we can relax the requirement on weak-hidden symbol
addresses.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Mon, 23 May 2016 00:07:48 +0000 (20:07 -0400)]
Fix: work-around gcc optimisation oddness on 32-bit powerpc
Deal with gcc O1 optimisation issues with weak hidden symbols. gcc 4.8
and prior does not have the same behavior for symbol scoping on 32-bit
powerpc depending on the object size: symbols for objects of 8 bytes or
less have the same address throughout a module, whereas they have
different addresses between compile units for objects larger than 8
bytes. Add this pointer indirection to ensure that the symbol scoping
match that of the other weak hidden symbols found in tracepoint.h.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Sun, 22 May 2016 15:26:00 +0000 (11:26 -0400)]
Fix: test weak-hidden symbols
On many architectures (arm32, arm64, powerpc64) gcc chooses to assign
different addresses to weak-hidden symbols from different compile units
within the same module.
This is unfortunate, but still OK with respect to tracepoints.
The real issue is on 32-bit powerpc, where gcc (in O1 or more) assigns
different addresses only for objects larger than 8 bytes, but same
addresses for objects of 8 bytes or less (int and pointers).
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Fri, 20 May 2016 19:23:06 +0000 (15:23 -0400)]
Print DBG() message about compiler weak hidden symbol behavior
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Fri, 20 May 2016 17:02:47 +0000 (13:02 -0400)]
test: add test for gcc issue with weak hidden symbol on powerpc
On Ubuntu 32-bit powerpc, gcc 4.4, 4.6, 4.8, gcc -O1 (and O2) causes
weak hidden symbols to have different addresses within the same module.
It seems to be fixed in gcc 4.9 on powerpc.
This issue causes some tracepoints to be silently hidden from LTTng.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Alexandre Montplaisir [Thu, 19 May 2016 21:55:02 +0000 (17:55 -0400)]
Restrict Java context retriever names to a set of valid characters
Since the context/retriever names end up as-is as part of the
metadata, only alphanumerical characters, periods "." and
underscores "_" should be accepted. The names must also not
start with a number.
Refuse registration of retriever names that do not respect these
conditions, so that the problem is reported right away to the
application.
Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Alexandre Montplaisir [Thu, 19 May 2016 19:59:50 +0000 (15:59 -0400)]
Fix: Correctly compute Java agent list loggers response size
The code was assuming that (number of characters == number of bytes),
which is not always the case!
The notions of number of bytes and data sizes only make sense when
the strings are encoded into byte arrays. The response's getBytes()
method should the only one handling these concepts.
Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 19 May 2016 20:10:26 +0000 (16:10 -0400)]
Add support for aarch64_be
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Alexandre Montplaisir [Thu, 19 May 2016 19:10:04 +0000 (15:10 -0400)]
Fix: Fix synchronization of LTTngAgent#dispose
Commit
9355f049 changed the dispose() back to non-static. However,
"static synchronized" and "synchronized" are not the same thing!
The latter synchronizes on the instance, but the former synchronizes
on the class object.
In this case we need to synchronize on the class object manually.
Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Alexandre Montplaisir [Thu, 19 May 2016 18:54:59 +0000 (14:54 -0400)]
Fix: Verify number of bytes contained in sessiond agent commands
The command header indicates the number of bytes in the payload.
Make sure those bytes were really present on the socket, and throw
an error if they were not.
Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Alexandre Montplaisir [Thu, 19 May 2016 18:49:06 +0000 (14:49 -0400)]
Fix: Avoid potential null dereference with log4j loggers
Coverity warns that the return of LogManager.getCurrentLoggers()
can contain null elements. Add an explicit null check to skip those.
Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Alexandre Montplaisir [Thu, 19 May 2016 18:31:20 +0000 (14:31 -0400)]
Specify UTF-8 encoding for all Java agent commands
Context info was already set to UTF-8, but agent enabled/disabled
and list-loggers commands should also specify the UTF-8 encoding.
Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Wed, 18 May 2016 19:18:05 +0000 (15:18 -0400)]
Fix: merge tap tests stdout and stderr
This makes the output and error statement ordered in the log
file and ensure that the first line is the tap test plan. Some tap
parser are confused if the test plan is not on the first line.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Wed, 18 May 2016 14:06:45 +0000 (10:06 -0400)]
Documentation: ring buffer: SWITCH_FLUSH can be used when active
Snapshot mode tracing may use SWITCH_FLUSH while tracing is active.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Tue, 17 May 2016 16:05:10 +0000 (12:05 -0400)]
Fix: unchecked return value in trace_clock_read64_monotonic
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Mon, 16 May 2016 19:07:05 +0000 (15:07 -0400)]
Fix: portability: no arith on void pointer
Reported by cppcheck.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Mon, 16 May 2016 18:00:16 +0000 (14:00 -0400)]
Fix: initialize build id and debug link flags to 0
When trace_baddr is called for [vdso], those fields are used without
being initialized.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
This page took 0.046339 seconds and 4 git commands to generate.