Jon Bernard [Fri, 15 Nov 2013 14:12:47 +0000 (09:12 -0500)]
Escape minus signs in lttng-ust-cyg-profile manpage
By default, "-" chars are interpreted as hyphens (U+2010) by groff, not
as minus signs (U+002D). Since options to programs use minus signs
(U+002D), this means for example in UTF-8 locales that you cannot cut
and paste options, nor search for them easily.
JP Ikaheimonen [Thu, 7 Nov 2013 10:22:35 +0000 (12:22 +0200)]
Add a check against excluders
When matching enablers with events, first check against all
excluders of the enabler. If the event matches with any of the excluders,
then the event does not match with the enabler.
[ Edit by Mathieu Desnoyers: apply coding style changes. ]
JP Ikaheimonen [Thu, 7 Nov 2013 10:22:34 +0000 (12:22 +0200)]
Add handler for LTTNG_UST_EXCLUSION in UST ABI
Add message handler for the LTTNG_UST_EXCLUSION command in
UST ABI. Copy the exclusion data into a lttng_ust_excluder_node
structure and pass it to the enabler command handler.
JP Ikaheimonen [Thu, 7 Nov 2013 10:22:33 +0000 (12:22 +0200)]
Store exclusions to enablers
Implement a function that adds exclusions to the list in the enabler.
Call this function in the enabler command handler when the
LTTNG_UST_EXCLUSION command is received.
JP Ikaheimonen [Thu, 7 Nov 2013 10:22:32 +0000 (12:22 +0200)]
Add excluders to enabler structure
Define a structure that holds excluders and can be used in lists.
Add a list holding these structures to the enabler structure.
Initialize and destroy the list when the enabler is initialized
and destroyed.
David Goulet [Thu, 7 Nov 2013 21:34:23 +0000 (16:34 -0500)]
Add liblttng-ust-jul for JUL support
The build system creates a jar file named liblttng-ust-jul.jar to be
linked with the Java application. A public library named
liblttng-ust-jul.so is also created and must be in the library path of
the Java application in order for the LTTngAgent to use it for the
tracer's JNI call.
A unit test is also added and integrated with the "make check" command.
Signed-off-by: David Goulet <dgoulet@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: application SIGBUS when starting in parallel with sessiond
There is a race between application startup and sessiond startup, where
there is an intermediate state where applications can SIGBUS if they see
a zero-sized shm, if the shm has been created, but not ftruncated yet.
On the UST side, fix this by ensuring that UST can read the shared
memory file descriptor with a read() system call before they try
accessing it through a memory map (which triggers the SIGBUS if the
access goes beyond the file size).
On the sessiond side, another commit needs to ensure that the shared
memory is writeable by applications as long as its size is 0, which
allow applications to perform ftruncate and extend its size.
We need to perform both connect and sending registration message before
doing the next connect otherwise we may reach unix socket connect queue
max limits and block on the 2nd connect while the session daemon is
awaiting the first connect registration message.
This happens in scenarios where unix socket connect queues are nearly
full.
Fix: ust-comm recvmsg should handle partial receive
Handles cases where unix socket buffer is full. Without this fix, the
session daemon kicks out application that happen to have their
registration message split into multiple recvmsg on the sessiond side.
For the "ordered comparison of pointer with integer zero" warning, fix
this by comparing (type) -1 against (type) 0 instead of just 0, so if
"type" is a pointer type, this pointer type will be applied to the right
operand too, thus fixing the warning.
Ikaheimonen, JP [Mon, 7 Oct 2013 13:33:02 +0000 (09:33 -0400)]
Add usage reference count for tracepoints
Keep track of how many libraries use a tracepoint, and disable the
tracepoint when the number of users drops to zero.
A new reference counter is added to tracepoint_entry. This keeps track
of how many callsites use that tracepoint.
When you have libraries and/or executables sharing tracepoints, you
cannot just disable your tracepoints when the library is unregistered.
You must check that the tracepoint is not used by any other libraries
before you disable it.
Function lib_disable_tracepoints becomes unnecessary, and is removed.
These new calls export the data required for the consumer to
generate the index while tracing :
- timestamp begin
- timestamp end
- events discarded
- context size
- packet size
- stream id
Prepare the ring-buffer config to have custom callbacks. These custom
callbacks are not related to the ring-buffer operations but allow
applications to add custom functions.
No additional feature or change in behaviour in this patch.
Allow overriding the path where the system-wide sessiond is expected to
keep its runtime files.
It does _not_ allow multiple instances of system-wide sessiond to run in
parallel though, because the wait shm files still requires having only
one single system-wide sessiond at any given time.
Amit Margalit [Mon, 8 Jul 2013 16:10:31 +0000 (12:10 -0400)]
Allow environment variable LTTNG_HOME to override HOME
Patch functionality - If LTTNG_HOME environment variable exists, it is
used instead of HOME. Reason for patch - We are trying to deploy LTTng
on a system where $HOME is on a filesystem mounted read-only, but cannot
afford to run lttng as a different user and cannot move the home
directories of users to writeable locations.
This function allows the consumer to write at most one packet of data to
the channel, that way we can push data to the ring buffer without
risking to block on subbuffer switch.
Fix: ring buffer: handle concurrent update in nested buffer wrap around check
With stress-test loads that trigger sub-buffer switch very frequently
(small 4kB sub-buffers, frequent flush) in lttng-modules, we currently
observe this kind of warnings once every few minutes:
[65335.896208] ring buffer relay-overwrite-mmap, cpu 5: records were lost. Caused by:
[65335.896208] [ 0 buffer full, 1 nest buffer wrap-around, 0 event too big ]
It appears that the check for nested buffer wrap-around does not take
into account that a concurrent execution contexts (either nested for
per-cpu buffers, or from another CPU or nested for global buffers) can
update the commit_count value concurrently.
What we really want to do with this check is to ensure that if we enter
a sub-buffer that had an unbalanced reserve/commit count, assuming there
is no hope that this gets rebalanced promptly, we detect this and drop
the current event. However, in the case where the commit counter has
been concurrently updated by another reserve or a switch, we want to
retry the entire reserve operation.
One way to detect this is to sample the reserve offset twice, around the
commit counter read, along with the appropriate memory barriers.
Therefore, we can detect if the mismatch between reserve and commit
counter is actually caused by a concurrent update, which necessarily has
updated the reserve counter.
Cleanup: lib_ring_buffer_switch_new_end() only calls subbuffer_set_data_size()
lib_ring_buffer_switch_new_end() is always called when an event exactly
fills a sub-buffer, which makes padding_size always 0. However, there is
one side-effect that lib_ring_buffer_switch_new_end() needs to have: it
calls subbuffer_set_data_size() to update the size of the data to be
read from the sub-buffer.
lib_ring_buffer_write() could be passed a length of 0. This typically
has no side-effect as far as writing into the buffers is concerned,
except for one detail: in overwrite mode, there is a check to make sure
the sub-buffer can be written into. This check is performed even if
length is 0. In the case where this would fall exactly at the end of a
sub-buffer, the check would fail, because the offset would fall exactly
at the beginning of the next sub-buffer.
Cleanup: ring buffer: remove lib_ring_buffer_switch_new_end()
lib_ring_buffer_switch_new_end() is a leftover from the days where an
event that would exactly fill the current sub-buffer would automatically
trigger a sub-buffer switch into the next sub-buffer.
Even before the ring buffer code has been moved into lttng-modules, this
behavior had been changed: an event that exactly fills a sub-buffer only
fills this current sub-buffer, and does not need to switch into the
next one to populate the sub-buffer header. This change had been done so
periodical timer switch, which shares the same semantic as an event
exactly filling a sub-buffer, would not create tons of empty
sub-buffers.
However, when doing this change, lib_ring_buffer_switch_new_end() has
not been removed, but clearly should have been. Its job is now performed
by the event "commit".
lib_ring_buffer_switch_new_end() has no effect, since padding_size is
always 0.
Takes care of autotools issue caused by renaming tp.c to tp.cpp. make
distclean was required when switching between old and newer versions.
It's not needed anymore.
Fix: Add --no-as-needed to the demo example's Makefile
Some distributions now ship with the --as-needed linker flag
set by default (Ubuntu 13.04). This will cause the linker to
remove the references to lttng-ust from the provider objects
thus causing the application to fail when preloading them.
Fix: liblttng-ust process startup hang when sessiond is stopped
Ensure the listener thread owns socket and notify_socket, so they don't
have to hold the ust_lock() while connecting to the sessiond and reading
from this socket.
Therefore, after process fork, we can safely cleanup those retources,
because the thread has been removed by the operating system. On exit,
however, let the OS teardown those sockets, so exit path does not race
with the listener thread.
Zifei Tong [Thu, 30 May 2013 14:11:52 +0000 (10:11 -0400)]
Allow tracepoint providers to be compiled with g++
Move enumeration definition out of lttng_ust_lib_ring_buffer_config to
make them visible at global scope for C++ compilers.
Modify designated initializers: reordering initializers, add missing
initializers, reformat nested initializers, in order to make g++
compile.
Relevant discussion:
> So each field need to be listed ? We usually don't put NULL
> initialization for structures that are always in zero-initialized
> memory. (coding style)
This is related to a known issue of g++:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55606 (Bug 55606 - sorry,
unimplemented: non-trivial designated initializers not supported).
g++'s 'trivial designated initializers' means no out-of-order
initialization, no missing
initialization (except the fields on the tail of a struct), and nested
initialization should be done in the form {.foo = {.bar = 1}} instead of
{.foo.bar = 1}. That's why I made such modification.
> Are those changes also compatible with the LLVM c++ compiler ?
Actually, clang++ have designated initializers better supported than g++.
All the modification about designated initializers are not required for
clang++. No need to add NULL initialization, reorder initializations or
change {.foo.bar = 1} into {.foo = {.bar = 1}}. These (ugly) hacks are just
to make g++ happy.
[ Updates done by Mathieu Desnoyers to fix merge conflicts. Updated
README. ]
Actually, $^ here is "demo.o", not "demo. Also, the libs should appear
after the objects on the command line. See the "-l" section in
http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html. On most setup
this doesn't matter, since -Wl,--no-as-needed was the default pretty
much everywhere. Ubuntu decided to use -Wl,--as-needed to avoid
unnecessary dependencies, so the order becomes important. If you try
to manual build on a recent Ubuntu you will get undefined references
to dlopen and such. So this patch is good.
If you read carefully the log sent by Alexandre, you see that it is
when building the shared libs in this directory
(lttng-ust-provider-ust-tests-demo.so) that the build fails. I don't
know why it fails, but Alexandre hinted that passing "-fPIE -pie" to
build a shared library is weird (it is usually -fPIC -pic). I am not
sure where that comes from. This behaviour only happens when building
the package, not when building manually.
Actually, $^ here is "demo.o", not "demo. Also, the libs should appear
after the objects on the command line. See the "-l" section in
http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html. On most setup
this doesn't matter, since -Wl,--no-as-needed was the default pretty
much everywhere. Ubuntu decided to use -Wl,--as-needed to avoid
unnecessary dependencies, so the order becomes important. If you try
to manual build on a recent Ubuntu you will get undefined references
to dlopen and such. So this patch is good.
If you read carefully the log sent by Alexandre, you see that it is
when building the shared libs in this directory
(lttng-ust-provider-ust-tests-demo.so) that the build fails. I don't
know why it fails, but Alexandre hinted that passing "-fPIE -pie" to
build a shared library is weird (it is usually -fPIC -pic). I am not
sure where that comes from. This behaviour only happens when building
the package, not when building manually.