Philippe Proulx [Wed, 15 Feb 2017 16:38:36 +0000 (11:38 -0500)]
Add support for "full" star globbing patterns in event names and filters
This patch adds the support for "full" star-only globbing patterns to be
used in event names and filter literal strings. A star-only globbing
pattern is a globbing pattern with the star (`*`) being the only special
character. This means `?` and character sets (`[abc-k]`) are not
supported here. We cannot support them without a strategy to
differentiate the globbing pattern because `?` and `[` are not special
characters in event names passed on the command line and filter literal
strings right now. The eventual strategy to support them would probably
look like this for event names:
lttng enable-event --userspace --glob 'hell?-wo*rl[Ddz]42'
and like this for filter strings:
filename =* "?sys*.[ch]"
The reason this patch adds the feature for both the event names and the
filter strings at the same time is that, for some agent domains, a
filter string is used to filter the logger name. For example:
lttng enable-event --python 'hello*world'
In this case, the UST event name is always `lttng_python`, but a filter
string is added to the event rule:
logger_name == "hello*world"
If I don't add support for filter strings in this patch, then the
globbing feature for event names would not work for all the domains.
src/bin/lttng/commands/enable_events.c
--------------------------------------
The exclusion validation code is cleaner. strutils_split() is used to
split the list (which also supports `\,` to escape delimiters). Then, if
the event name is a globbing pattern which only contains a wildcard star
at the end (the only valid globbing pattern before this patch), the
exclusions which also only contain a wildcard star at the end or no star
at all are validated like it was done previously, with the exception
that escape characters are considered now (that is, in the exclusion
`hello\*world`, `\*` is parsed as is: the star is not a wildcard).
src/bin/lttng-sessiond/cmd.c
----------------------------
The event name validation function is removed because the only thing it
checks is that a star can only appear at the end of the name. This is
not true anymore.
It is expected that the tracers's globbing matching algorithm expect
a globbing pattern without two or more consecutive stars:
hello**world
Thus in _cmd_enable_event(), strutils_normalize_star_glob_pattern() is
used to "normalize" the star globbing patterns of event names and
exclusion names in place (if they exist). Normalizing here means
crushing consecutive stars as a single one, without considering escaped
stars:
hello*\***world**** -> hello*\**world*
Note that this also means that the event and exclusion names given by
the user are not necessarily the ones remaining after the enable-event
command is executed. This should not be a problem as `lttng status`
shows the normalized names and normalization is an identity function
when the string is already normalized.
src/lib/lttng-ctl/filter/filter-visitor-generate-ir.c
-----------------------------------------------------
The literal string transformation is modified to include the type of
literal string in the node amongst:
* IR_LOAD_STRING_TYPE_PLAIN
* IR_LOAD_STRING_TYPE_GLOB_STAR_END
* IR_LOAD_STRING_TYPE_GLOB_STAR
This type is used for post-validation and bytecode translation.
src/lib/lttng-ctl/filter/filter-bytecode.h
src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c
-----------------------------------------------------------
A new load bytecode operation is added: FILTER_OP_LOAD_STAR_GLOB_STRING.
When this operation is executed, it should load a string literal as a
full star globbing pattern. The star-at-the-end-only use case is still
expected to be handled by the FILTER_OP_LOAD_STRING operation to avoid
changing anything to the current behaviour.
src/bin/lttng-sessiond/lttng-ust-abi.h
--------------------------------------
Version 7.1 bumped to version 7.2 because a new "load" filter operation
is added to the list of bytecode operations, but the current operation
codes are not changed, so a 7.2 filter interpreter should interpret a
7.1 filter bytecode just fine.
src/common/kernel-ctl/kernel-ioctl.h
------------------------------------
Version 2.2 bumped to version 2.3 because a new "load" filter operation
is added to the list of bytecode operations, but the current operation
codes are not changed, so a 2.3 filter interpreter should interpret a
2.2 filter bytecode just fine.
src/lib/lttng-ctl/filter/filter-visitor-ir-normalize-glob-patterns.c
--------------------------------------------------------------------
This IR visitor normalizes the literal string nodes when their type is
IR_LOAD_STRING_TYPE_GLOB_STAR_END or IR_LOAD_STRING_TYPE_GLOB_STAR.
src/lib/lttng-ctl/filter/filter-visitor-ir-validate-globbing.c
--------------------------------------------------------------
This IR visitor validates that:
1. When there's a binary operation between two literal strings, if one
of them has the IR_LOAD_STRING_TYPE_GLOB_STAR type, the other one has
the IR_LOAD_STRING_TYPE_PLAIN type.
In other words, you cannot compare two globbing patterns, except for
two globbing patterns with only a star at the end for backward
compatibility reasons.
2. When there's a binary operation between two literal strings, if one
of them is a (full) star globbing pattern, the binary operation is
either == or !=.
src/lib/lttng-ctl/filter/filter-visitor-ir-validate-string.c
------------------------------------------------------------
The code to ensure that a wildcard star can only appear at the end of a
literal string is removed.
src/lib/lttng-ctl/lttng-ctl.c
-----------------------------
New visitors are called.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 17 Feb 2017 02:58:19 +0000 (21:58 -0500)]
Add string-utils convenience library
The new src/common/string-utils/libstring-utils.la library has a few
utility functions to manipulate and check strings. See string-utils.h
for more details.
One such function which should prove useful in this codebase is
strutils_split(): it splits an input string with a given delimiter and
returns a NULL-terminated array of newly allocated substrings. This
function supports escaping the delimiter with `\` in the input string.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 4 Apr 2017 21:27:58 +0000 (17:27 -0400)]
doc: lttng-destroy(1): document --no-wait option
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 4 Apr 2017 21:28:20 +0000 (17:28 -0400)]
doc: lttng-stop(1): replace tabs with spaces
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 15 Mar 2017 00:28:35 +0000 (20:28 -0400)]
doc/man: add typical `$` and `#` prompts to command lines
It is more instinctive for the typical reader to immediately recognize
command lines when they start with the classic prompts.
On the online version of the man pages, those prompts are treated
specially to make them non-selectable. This makes it possible to copy
multiple command lines at once (without copying the prompts) and to
paste them to your shell.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 30 Nov 2016 20:24:36 +0000 (15:24 -0500)]
bin/lttng: remove double "help" command and sort list
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 30 Nov 2016 20:40:43 +0000 (15:40 -0500)]
lttng help: use command's --help directly
Do the same thing for both `lttng cmd --help` and
`lttng help cmd`, so that if we change what's done, the
behaviour remains the same for both methods.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 1 Dec 2016 06:29:38 +0000 (01:29 -0500)]
Add --enable-embedded-help option to embed --help messages in binaries
This patch adds a configuration option to embed the help message within
the various executables of LTTng-tools instead of always launching the
man pager. This applies to the following commands:
lttng --help
lttng CMD --help
lttng help CMD
lttng-crash --help
lttng-relayd --help
lttng-sessiond --help
This is meant to be used by distributions which remove man pages or do
not have a man pager (embedded distributions, mostly). For example,
Buildroot is known to remove all man pages before it creates the final
image:
rm -rf $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/man
If you pass the `--enable-embedded-help` option to the `configure`
script:
1. The configure script checks if `man` exists in the `PATH` environment
variable. This tool is needed to generate the text versions of the
man pages.
2. When you build LTTng-tools with `make`, the man pages are generated
as usual (or they already exist in their troff version from a
tarball), and their text versions are generated with `man`, with a
fixed width set to 80 columns.
3. The text versions of the man pages are converted to literal C strings
thanks to some `sed` magic:
a. Replace `\` with `\\`.
b. Replace `"` with `\"`.
c. Add `"` prefix and `\n"` suffix to each line.
This file is named `NAME.SECTION.h`, where `NAME` is the name of the
man page and `SECTION` is its section. For example,
`lttng-create.1.h`.
I needed to add a `.PRECIOUS` target in `doc/man/Makefile.am` because
otherwise `make` treats the troff man page files as intermediate
files and removes them automatically. Then they need to be rebuilt
to be installed.
4. In each C file where to show a help message, we check if the
`--enable-embedded-help` option is set, and if so, we assign the
included help message string to a static variable to be printed
instead of executing the man pager.
This string added to the object file in #4 takes binary space, why is
why the `--enable-embedded-help` option is turned off by default.
The directories in the "master" `SUBDIRS` (`Makefile.am`) are reordered
so that `doc` is built before `src` since there's a direct dependency
when you pass `--enable-embedded-help`.
The `--disable-man-pages` and `--enable-embedded-help` options do not
form a valid configuration.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 5 May 2017 03:53:50 +0000 (23:53 -0400)]
Expose monitor timer interval to lttngctl and client
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 5 May 2017 03:53:27 +0000 (23:53 -0400)]
Tests: add placeholder symbol to allow unit tests to link
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 5 May 2017 03:52:24 +0000 (23:52 -0400)]
Implement consumer ring buffer position sampling
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 5 May 2017 03:38:55 +0000 (23:38 -0400)]
Add new snapshot ustctl API
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 5 May 2017 03:30:56 +0000 (23:30 -0400)]
Add kernctl RING_BUFFER_SNAPSHOT_SAMPLE_POSITIONS command
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 5 May 2017 03:29:51 +0000 (23:29 -0400)]
Handle trigger registration and unregistration in sessiond
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 5 May 2017 03:27:04 +0000 (23:27 -0400)]
Start notification subsystem thread in sessiond initialization
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 5 May 2017 03:24:27 +0000 (23:24 -0400)]
Clean-up: fix comment type in lttng-consumerd.c
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 5 May 2017 03:17:39 +0000 (23:17 -0400)]
Add the sessiond notification-handling subsystem
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 5 May 2017 03:15:37 +0000 (23:15 -0400)]
Clean-up: comment fix in agent_thread_manage_registration
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 5 May 2017 03:08:47 +0000 (23:08 -0400)]
Add client notification API
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 5 May 2017 02:59:18 +0000 (22:59 -0400)]
Add utils_get_count_order_u64 to utils
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 5 May 2017 02:58:25 +0000 (22:58 -0400)]
Implement poll mask modification support in poll wrappers
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 5 May 2017 02:56:30 +0000 (22:56 -0400)]
Add the container_of() macro to macro.h
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 5 May 2017 02:54:17 +0000 (22:54 -0400)]
Add pipe_release utils to the pipe wrapper
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 5 May 2017 02:53:22 +0000 (22:53 -0400)]
Add named pipe support to the pipe wrapper
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 5 May 2017 04:14:02 +0000 (00:14 -0400)]
Add non_block version of functions to UNIX socket wrapper
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 5 May 2017 02:49:35 +0000 (22:49 -0400)]
Add lttng_buffer_view util
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 5 May 2017 02:48:25 +0000 (22:48 -0400)]
Add lttng_dynamic_buffer util
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 2 Mar 2017 22:22:08 +0000 (17:22 -0500)]
Clean-up: fix typo in sessiond main.c comment
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 1 Mar 2017 17:15:11 +0000 (12:15 -0500)]
Docs: fix comment describing ust_cmd_queue
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Thu, 2 Feb 2017 22:09:43 +0000 (17:09 -0500)]
Port: Link with no-undefined on Windows
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Thu, 26 Jan 2017 20:09:22 +0000 (15:09 -0500)]
Port: win32 DLLs don't support hidden symbols
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Thu, 26 Jan 2017 20:09:21 +0000 (15:09 -0500)]
Port: add cygwin support to endian compat
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Thu, 26 Jan 2017 19:55:46 +0000 (14:55 -0500)]
Fix: Remove unused headers
This is a portability fix, these headers are unused and not available on
some platforms.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Thu, 26 Jan 2017 19:53:03 +0000 (14:53 -0500)]
Fix: tests: register thread for RCU operations.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Thu, 26 Jan 2017 19:36:45 +0000 (14:36 -0500)]
Fix: Lazily initialize max poll set size in poll compat
This was applied to the epoll implementation in commit
22dad56815ce0201c5ae7d5ef5d79cc0c6a42c5e
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Tue, 17 Jan 2017 15:08:47 +0000 (10:08 -0500)]
Fix: null dereference on error path for create_ctx_type
When zmalloc of type->opt fail the destroy_ctx_type would result in a
null dereference.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Tue, 17 Jan 2017 15:08:22 +0000 (10:08 -0500)]
Fix: test_ust_data dereference of null pointer
Skip test on NULL value to prevent null dereference.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Tue, 17 Jan 2017 15:07:31 +0000 (10:07 -0500)]
x is never reused, no need to shift it
Also remove noise in scanbuild report.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Tue, 17 Jan 2017 15:02:08 +0000 (10:02 -0500)]
Fix: test_kernel_data dereference of null pointer
Skip tests when tested struct is null.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Fri, 13 Jan 2017 22:04:42 +0000 (17:04 -0500)]
Man: move [SESSION] before options
The previous synopses for the live mode can cause confusion to users
since it can lead to an error while trying one of the simplest create
command for live session that the synopsis is proposing:
lttng create --live test.
Other synopsis are modified for symmetry.
Fixes #1081
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Wed, 11 Jan 2017 20:49:49 +0000 (15:49 -0500)]
Fix: consumerd: add missing put_subbuf for ust and kernel errors
While reading a sub-buffer, error handling need to put the sub-buffer,
else all future attempts to use the stream will trigger warnings.
The affects recent features added to UST and kernel tracing.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Wed, 11 Jan 2017 20:49:48 +0000 (15:49 -0500)]
Fix: sessiond: only send streams to consumer once
Session daemon should not send streams to consumer daemon
repeatedly when CPU hotplug is performed while doing kernel
tracing.
This causes the consumer daemon to have multiple file descriptors
on the same stream, and thus try to perform operations like reading
a sub-buffer and checking for data pending concurrently. This triggers
safety-net warnings in the kernel tracer.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 19 Jan 2017 00:23:27 +0000 (19:23 -0500)]
Fix: consumerd main: needs to be a registered RCU thread
main->lttng_consumer_destroy->destroy_data_stream_ht requires a RCU
read-side lock.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 19 Jan 2017 00:23:26 +0000 (19:23 -0500)]
Fix: thread_dispatch_ust_registration needs to be a RCU thread
It uses a read-side lock.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 19 Jan 2017 00:23:09 +0000 (19:23 -0500)]
Fix: don't abort metadata push on closed metadata
The failure/exit of any of the consumerd, relayd or applications
(in per-PID buffer mode) will cause the metadata closed flag to
be set.
While pushing new metadata updates to the consumerd (and relayd
in streaming/live scenarios) will fail, those conditions should
be handled in-place.
Applications are _expected_ to exit during the course of a per-PID
session. However, they will typically have pushed their metadata
to the metadata cache before doing so. The session daemon must
flush the unconsumed metadata to the consumerd in this case.
Failure to answer to the metadata request originating from the
consumerd can cause it to keep the stream lock held and, thus,
prevent the channel poll thread from cleaning up on channel
close.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Nathan Lynch [Mon, 9 Jan 2017 22:14:28 +0000 (16:14 -0600)]
lttng-tools: remove bogus interpreter line from utils shell library
tests/utils/utils.sh is always sourced, never executed, and
/src/bin/bash is not a typical path for a shell interpreter. Just
delete it.
Signed-off-by: Nathan Lynch <nathan_lynch@mentor.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Mon, 9 Jan 2017 16:23:16 +0000 (11:23 -0500)]
Fix: consumerd: order of metadata cache vs stream lock
The locking order comment in consumer.h is incorrect. First, its
description of locking order is not in sync with the comment found in
consumer-metadata-cache.h. The comment in struct consumer_metadata_cache
only states that the metadata cache lock nests inside the consumer_data
lock, and does not mention the stream lock, which implies that the
metadata cache lock does NOT nest inside the stream lock. But let's
investigate further to confirm:
* lttng_consumer_read_subbuffer() acquires the stream lock, and then
calls lttng_ustconsumer_read_subbuffer() with stream lock held,
and then invokes commin_one_metadata_packet(), which acquires the
metadata cache lock.
* lttng_ustconsumer_sync_metadata() acquires the metadata stream lock,
and calls commit_one_metadata_packet(), which takes the metadata cache
lock.
Therefore, update the comment in consumer.h to state that the metadata
cache lock nests INSIDE the stream lock, and update
consumer_del_metadata_stream() accordingly.
This should take care of fixing the locking order reversal found by
Coverity.
CID
1368314 (#1 of 1): Thread deadlock (ORDER_REVERSAL)
CID
1368319: Program hangs (ORDER_REVERSAL)
Fixes: 5feafd4130 "Fix: protect the channel's metadata stream using the metadata cache lock"
Fixes: 1ea6cc572b "Fix: lock nesting order reversed"
Fixes: fb549e7ac2 "Fix: reverse channel and metadata cache lock nesting order"
Reported-by: Coverity Scan
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Wed, 21 Dec 2016 22:59:38 +0000 (17:59 -0500)]
Fix: add missing rcu_barrier before daemon teardown
When performing the "cleanup" of sessiond, consumerd, and relayd, we
destroy data structures that may still be concurrently accessed by
call_rcu worker thread.
Ensure no more work is present in the call_rcu worker thread by issuing
a rcu_barrier barrier. Note that this expects call_rcu handlers don't
chain work to other call_rcu handlers.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Mon, 5 Dec 2016 20:39:26 +0000 (15:39 -0500)]
Fix: Add missing pthread.h include
Some libc like musl and uClibc requires explicit includes of pthread.h
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Tue, 20 Dec 2016 21:31:26 +0000 (16:31 -0500)]
Fix: support for older versions of Babeltrace in test script
A new context field was introduced in version LTTng 2.8 that is printed
by Babeltrace prior to v1.2.5. This regex thus fails to match the
output. Since the context fields are not used by the script, we create a
non-capturing group for these fields that matches on both old and new
Babeltrace.
This is causing problems on Ubuntu 14.04 Trusty when building
lttng-tools from source and using the Babeltrace package from the
official repository (v1.2.1) to run the test suite.
Also, this patch removes commented and used code in the function but
keeps the names of non-capturing groups for readability.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
CC: Philippe Proulx <pproulx@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sun, 8 Jan 2017 19:29:09 +0000 (14:29 -0500)]
Fix: reverse channel and metadata cache lock nesting order
CID
1368319: Program hangs (ORDER_REVERSAL)
The lttng_consumer_channel lock must be nested outside of the
metadata cache lock, as indicated in the structure's comments.
Reported-by: Coverity Scan
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sat, 7 Jan 2017 18:42:12 +0000 (13:42 -0500)]
Fix: only lock the metadata_cache in userspace consumers
The kernel consumer, which re-uses the consumer_del_metadata_stream
function, has no metadata cache. Therefore, it can't be used to
protect the metadata stream (see
5feafd41).
However, only the userspace consumers invoke
consumer_metadata_cache_write() which the previous fix seeked to
protect against. It is therefore safe to omit this lock in the
kernel consumer case.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sat, 7 Jan 2017 17:32:13 +0000 (12:32 -0500)]
Fix: lock nesting order reversed
The lttng_consumer_stream lock must nest INSIDE the metadata
cache lock, as indicated in the structure's comments
(see consumer.h:340).
CID
1368314 (#1 of 1): Thread deadlock (ORDER_REVERSAL)
Reported-by: Coverity Scan
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Tue, 20 Dec 2016 23:25:17 +0000 (18:25 -0500)]
Fix: lttng-relayd: forcefully close stream on relayd shutdown
Add an "aborted" field to relay_session struct to indicate that on
shutdown pending data for a stream is no relevant and should not be
waited for.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 21 Dec 2016 22:56:24 +0000 (17:56 -0500)]
Fix: protect the channel's metadata stream using the metadata cache lock
The consumer_thread_data_poll and consumer_thread_metadata_poll
both access the channel's metadata stream.
During a session destruction, consumer_thread_metadata_poll will
destroy all metadata streams. However, the consumer_thread_data_poll
may still invoke a consumer_metadata_cache_write() triggered
by a "ready" subbuffer. Hence, the metadata stream must be protected
from this action by the metadata cache lock.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 20 Dec 2016 20:00:04 +0000 (15:00 -0500)]
Fix: double unlock of metadata mutex on error
lttng_ustconsumer_sync_metadata must leave the metadata lock
in its initial state. Otherwise an error may result in a
double unlock in the caller.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Mon, 12 Dec 2016 21:39:17 +0000 (16:39 -0500)]
Fix: free previous instance of url (alloc_url) on default live url assignation
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 15 Dec 2016 11:13:19 +0000 (12:13 +0100)]
Fix: add element length check in lttng_index_file_open
Handle cases where the index file header would contain a corrupted
value.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 16 Dec 2016 08:10:00 +0000 (03:10 -0500)]
Assert that index_file does not exist before setting a new one
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 15 Dec 2016 10:04:57 +0000 (11:04 +0100)]
Fix: relayd vs consumerd compatibility
relay and consumerd 2.7 and 2.8 are expected to negociate compatibility
with the lowest common minor version.
If a consumer daemon 2.8 interacts with a relayd 2.7, it needs to send
the index fields for ctf index 1.0. Same if a relayd 2.8 interacts with
a consumer daemon 2.7: relayd should expect ctf index 1.0 fields, and
generate a ctf index 1.0 index file layout.
If both relayd and consumerd versions are 2.8+, then we can send the ctf
index 1.1 fields over the protocol, and store them in the index files.
Whenever the relayd live viewer server opens and reads an index file,
it needs to use the file's header to figure out the index "element"
size.
[ Should be applied to master, stable-2.9, stable-2.8. ]
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Tue, 8 Nov 2016 22:59:12 +0000 (17:59 -0500)]
tests: Implement tests for lttng-ust LTTNG_UST_BLOCKING_RETRY_TIMEOUT
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
CC: "Carlos O'Donell" <carlos@redhat.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 30 Nov 2016 17:29:06 +0000 (12:29 -0500)]
lttng-add-context(1): add missing man: prefix
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 28 Nov 2016 23:54:41 +0000 (18:54 -0500)]
lttng-add-context(1): fix style
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 28 Nov 2016 23:27:53 +0000 (18:27 -0500)]
lttng-snapshot(1): fix style
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 28 Nov 2016 23:27:43 +0000 (18:27 -0500)]
lttng-metadata(1): fix style
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 28 Nov 2016 23:25:28 +0000 (18:25 -0500)]
doc/man: put short option's argument too
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 28 Nov 2016 23:14:55 +0000 (18:14 -0500)]
Remove `metadata` command from various help resources
This command is now deprecated. Its own man page remains available
and warns the user that it's deprecated and suggests to look at
lttng-regenerate(1) instead.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 28 Nov 2016 23:06:34 +0000 (18:06 -0500)]
List the `regenerate` command in various help resources
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 28 Nov 2016 22:57:06 +0000 (17:57 -0500)]
lttng-load(1): fix synopsis and style
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Liguang Li [Mon, 28 Nov 2016 08:37:47 +0000 (16:37 +0800)]
Fix: truncate the metadata file in shm-path
In the shm-path mode, the metadata will be backuped to a metadata
file, when run the lttng command "lttng metadata regenerate" to
resample the wall time following a major NTP correction, the metadata
file will not be truncated and regenerated.
Add the function clear_metadata_file() to truncate and regenerate the
metadata file.
Signed-off-by: Liguang Li <liguang.li@windriver.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Thu, 24 Nov 2016 22:14:22 +0000 (17:14 -0500)]
Load: add message indication that a name override was carried out
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Thu, 24 Nov 2016 21:44:17 +0000 (16:44 -0500)]
Load: expose overrides elements in mi
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Thu, 24 Nov 2016 19:33:32 +0000 (14:33 -0500)]
Fix: assign values to path, ctrl and data uris during configuration load
Since overrides can be partial (name only, etc.) always assign a base
value from the configuration being loaded then apply overrides.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Thu, 24 Nov 2016 19:27:28 +0000 (14:27 -0500)]
Load: test that name override does not have side effects
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 24 Nov 2016 16:07:42 +0000 (11:07 -0500)]
Docs: remove invalid short option -U and move option descriptions
Reported-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Mon, 21 Nov 2016 17:36:00 +0000 (12:36 -0500)]
Fix: add missing refcount of loaded modules
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 18 Nov 2016 21:35:34 +0000 (16:35 -0500)]
Fix: only unload successfully loaded kernel modules
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Thu, 10 Nov 2016 20:26:35 +0000 (15:26 -0500)]
Fix: test cases now rely on explicit workloads
Run a process explicitly in the tracing session to generate the enabled events
rather than relying on the events generated by the lttng CLI.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 2 Nov 2016 07:25:25 +0000 (03:25 -0400)]
m4/pprint.m4: update with correct quoting
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 28 Oct 2016 23:01:19 +0000 (19:01 -0400)]
configure.ac: move warning to end of output for the end user
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 28 Oct 2016 22:33:19 +0000 (18:33 -0400)]
doc/man: only require asciidoc-attrs.conf when building the man pages
Situations:
* If you want to and can build the man pages:
* If it's a tarball tree:
* Make the man page destinations depend on asciidoc-attrs.conf.
Since it's a generated file, its date is greater than the
date of the prebuilt man pages, therefore the man pages are
built again, which is a good thing because they include the
default values of this build.
* If it's a Git tree:
* Always build the man pages anyway (no prebuilt man pages here).
* If you want to, but cannot build the man pages:
* If it's a tarball tree:
* Make the man page destinations NOT depend on asciidoc-attrs.conf,
because its recent date would ask said destinations to be rebuilt
and this is not possible because we don't have the tools.
However, warn the user at configure time that the prebuilt man
pages will be installed, which means that they will contain the
project's default values, not this build's default values.
* If it's a Git tree:
* Not valid: error at configure time as usual.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 10 Nov 2016 19:47:14 +0000 (14:47 -0500)]
Test fix: increase test count in plan of test_perf_raw
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Mon, 12 Sep 2016 20:57:10 +0000 (16:57 -0400)]
Create a dedicated test suite for Perf
Introduce the perf_regression test suite that must be run manually to
check if the support for the Perf-related features are available on the
current machine. This test cannot be run automatically since there are
some platforms where it can fail (VMs, some SoCs, etc).
For now, the test only makes sure that we can trace events with perf
contexts enabled by raw ID in kernel and user-space. The test only works
if libpfm is installed on the system and fails if it is not installed.
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Nathan Lynch [Tue, 1 Nov 2016 17:25:47 +0000 (11:25 -0600)]
Tests: accommodate stricter mktemp implementations in tests
Busybox's mktemp command uses mkstemp(3) which requires the last six
characters of the template to be X's. Extend the mktemp templates
used in the test scripts.
Signed-off-by: Nathan Lynch <nathan_lynch@mentor.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Anders Wallin [Thu, 20 Oct 2016 05:58:55 +0000 (07:58 +0200)]
Add version info to lttng-relayd help
lttng-relayd man pages states that the option
-V --version is available, but it it's missing in the code
Signed-off-by: Anders Wallin <wallinux@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 20 Oct 2016 21:05:14 +0000 (17:05 -0400)]
Fix: stop sessiond threads on health thread error
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 20 Oct 2016 19:45:42 +0000 (15:45 -0400)]
Fix: stop lttng-relayd threads on health thread error
The lttng-relayd health thread may fail to initialize for
a variety of reason (notably, a too long unix domain socket
address), which will cause it to never notify that it is
ready.
In such circumstances, the lttng-relayd command, in background or
daemonize mode, will never return as the daemon's "readyness"
will never be signaled.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 20 Oct 2016 19:45:13 +0000 (15:45 -0400)]
Fix: report an error if unix socket address is too long
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 20 Oct 2016 18:58:36 +0000 (14:58 -0400)]
Remove unmaintained TODO file
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 20 Oct 2016 15:53:57 +0000 (11:53 -0400)]
Remove outdated comment about run_as open being broken
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 20 Oct 2016 15:38:31 +0000 (11:38 -0400)]
Remove run-as compat wrapper from internal code
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Tue, 18 Oct 2016 22:09:53 +0000 (18:09 -0400)]
Fix: save: leak of configuration file fd
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 7 Oct 2016 23:17:08 +0000 (19:17 -0400)]
Update master version to 2.10.0-pre
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 7 Oct 2016 21:03:26 +0000 (17:03 -0400)]
Fix: warn when a loaded session can't be set as the default
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 7 Oct 2016 20:39:46 +0000 (16:39 -0400)]
Warning fix: forward declare struct lttng_ust_calibrate
lttng-ust's ust-ctl.h still refers to struct lttng_ust_calibrate
which causes gcc to emit a "‘struct lttng_ust_calibrate’ is
declared inside a parameter list" warning.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 9 Aug 2016 19:17:25 +0000 (15:17 -0400)]
lttng-enable-channel(1): remove redundant --discard from synopsis
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Thu, 6 Oct 2016 21:12:38 +0000 (17:12 -0400)]
test: load --override-name
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Fri, 7 Oct 2016 16:03:34 +0000 (12:03 -0400)]
load: introduce --override-name
The --override-name option allow users to override the name of the
session to be loaded using the command-line.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Wed, 5 Oct 2016 21:04:33 +0000 (17:04 -0400)]
man: lttng-load fix up
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 7 Oct 2016 19:04:44 +0000 (15:04 -0400)]
Docs: grammar fix in load.h
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
This page took 0.046168 seconds and 5 git commands to generate.