Michael Jeanson [Fri, 2 Apr 2021 15:19:44 +0000 (11:19 -0400)]
Move all sources to 'src/'
This will align the source tree structure with our other projects and
will make it easier to move the private headers currently located in the
global 'include' directory.
Change-Id: Ib016ec0c31de74990b1a8bb0792df2e7470bb994
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Wed, 7 Apr 2021 16:01:15 +0000 (12:01 -0400)]
Fix: pass private data to context callbacks
commit
4e48b5d2debaf ("Refactoring: add back constness of public API structures")
changes the type of the first argument received by context callbacks
from a struct lttng_ust_ctx_field pointer to a void private data pointer.
That commit failed to change some call sites, which were still passing
the struct lttng_ust_ctx_field pointer rather than the private data
pointer. This was not caught by compiler errors because we are loosening
from a structure pointer to a void pointer.
Fixes: #1303
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I653f454b5dc4cfcc229b3a0e17b2dc6abe9fd658
Mathieu Desnoyers [Tue, 6 Apr 2021 19:45:36 +0000 (15:45 -0400)]
Fix: app contexts: do not leak app context name, event field, context field
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I4f0655034d37024a3fa024a3b45f0168a3aeb9cd
Mathieu Desnoyers [Tue, 6 Apr 2021 17:46:50 +0000 (13:46 -0400)]
Remove TRACEPOINT_INCLUDE_FILE undef
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I107b8f98199e93a1fdf0202ee9fc0fbe9ebe0282
Mathieu Desnoyers [Tue, 6 Apr 2021 17:45:42 +0000 (13:45 -0400)]
Remove TRACEPOINT_INCLUDE_FILE macro
Now that we bump the soname major version, we can remove old macros
which only purpose is compatibility with LTTng-UST 2.0.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ic8c840a5ae219d15f0915821aa1049786a135d40
Mathieu Desnoyers [Tue, 6 Apr 2021 17:39:06 +0000 (13:39 -0400)]
Remove app context backward compatibility dead code
This code is unused since the recent ABI break which removes backward
compatibility.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: If29720ebb3689e63c5f9327e23457843d6bf0ae2
Mathieu Desnoyers [Tue, 6 Apr 2021 17:34:29 +0000 (13:34 -0400)]
Cleanup: Unaligned vs aligned ring buffer access comment
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I03950fda0df7eb3a4b5880ee66c74b6a6abd387f
Mathieu Desnoyers [Mon, 5 Apr 2021 21:37:52 +0000 (17:37 -0400)]
Update unaligned vs aligned ring buffer access comment
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I57ca4e63bc5eb9c39a502a27c079a395cbecb42e
Mathieu Desnoyers [Mon, 5 Apr 2021 12:32:11 +0000 (08:32 -0400)]
Refactoring: add back constness of public API structures
Probes defining type, enumeration label, enumeration description,
event, and probe structures should be able to define them as "const",
because those are indeed const data which never need to be changed by
the tracer.
In order to allow struct lttng_ust_probe_desc definition to be constant,
move the "head", "lazy_init_head" and "lazy" fields to an internal
structure, "struct lttng_ust_registered_probe". It is opaque from the
point of view of the probe provider, but its pointer is now used as a
cookie between registration and unregistration. Moving the list heads
into an internal structure is an overall cleanup hiding private data
from the public API.
Use a similar scheme for registration of the context provider:
internalize the "hlist" field into an internal registration structure
(opaque from the point of view of the public API), which is now used as
a cookie between registration and unregistration.
This allows to fix an issue which was introduced by a prior refactoring
of the code dealing with contexts: the RCU update of context callbacks
was broken because the context fields were shared between the old and
the new array of contexts, thus leading to non-atomic update of the 3
callback pointers. This is fixed by making struct lttng_ust_ctx private,
and changing the array of pointers to context fields to an array of
context fields.
The functions lttng_ust_context_set_session_provider,
lttng_ust_add_app_context_to_ctx_rcu, and
lttng_ust_context_set_provider_rcu are now private.
For all contexts except the "perf" context fields, define the context
field as a static const variable rather than use memory allocation. This
means freeing the event field and type is not required anymore, and the
perf context field is handled through a destroy callback using the
private data pointer.
Move struct lttng_ust_ctx_field to an internal header. The only reason
why it was public is because the callbacks expected it as an argument.
Change the callbacks to receive a private data pointer instead to
achieve the same goal without exposing our internal structures.
The internal helpers lttng_ust_create_type_integer,
lttng_ust_create_type_array_text and lttng_ust_destroy_type are removed,
and replaced by internal macro helpers lttng_ust_static_type_integer,
lttng_ust_static_type_array_text, lttng_ust_static_event_field, and
lttng_ust_static_ctx_field, to facilitate static definitions in context
code.
Because there is no need to embed list and hlist nodes in the probe
descriptor nor the context provider, there is no need to include those
list headers from public APIs anymore.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I556e00d1d99a956b6f981dd2f5eae53589303f9d
Michael Jeanson [Wed, 31 Mar 2021 21:52:30 +0000 (17:52 -0400)]
Add 'ctf_unused' tracepoint field type
Some tracepoint definitions have one or more arguments that don't have a
corresponding field to allow passing a value to a probe without
recording it in the trace buffer nor using it in the filter.
This results in tracepoint macros generating inline functions with unused
arguments which prevents us from turning on -Wunuse-parameter.
Add a new tracepoint field type name 'ctf_unused' to adress this and
properly handle unused values in the tracepoint macros.
[ Mathieu: ctf_unused() takes only the _src parameter, no "type",
because an unused "field" does not have any representation in the ring
buffer nor the filter. If this ends up limiting us in the future, I
accept all the blame. ]
Change-Id: I56d8024926340e9c965ca01fa24a0fff7b7c5baa
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Wed, 31 Mar 2021 16:19:05 +0000 (12:19 -0400)]
cleanup: explicitly mark unused parameters (-Wunused-parameter)
Add the 'unused' attribute to function parameters that are unused to
allow turning on -Wunused-parameter and distinguish unused parameters
that are actual errors.
Change-Id: I5a4b3790ae84da0c5135a214f2a63b513bb199eb
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Wed, 24 Mar 2021 19:28:18 +0000 (15:28 -0400)]
cleanup: rename template headers
Rename the ring buffer client template headers to make it more obvious
they are templates and not regular headers.
Change-Id: I0916331d32c8602edf92615e92efec45a4b0ee1e
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Fri, 26 Mar 2021 19:34:21 +0000 (15:34 -0400)]
fix: string constants (-Wwrite-strings)
Do not use an anonymous string literal with a non-const char pointer as
this will discard the implicit const, use static non-const string
instead when appropriate. Otherwise, we could end up trying to write to
a string constant.
Change-Id: Ie2bb0e5ab7978930f9edcdb379bd181caaacc15c
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Wed, 24 Mar 2021 20:12:34 +0000 (16:12 -0400)]
fix: all functions have declarations (-Wmissing-prototypes -Wold-style-definition)
Make sure that all non-static functions have a declaration.
Change-Id: I4057795631c53c4281127457a1ee5a538ee7fcce
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Tue, 30 Mar 2021 23:30:49 +0000 (19:30 -0400)]
cleanup: function attribute 'always_inline'
Function attributes should be located after the declaration.
Change-Id: If2b7dbb9a80870ec403b6ffbd115154dd739b508
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Tue, 30 Mar 2021 19:44:02 +0000 (15:44 -0400)]
cleanup: function attribute 'hidden'
Function attributes should be located after the declaration.
Change-Id: I519421804e62181b49173f9239a43d6d9c21c216
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Tue, 30 Mar 2021 19:42:44 +0000 (15:42 -0400)]
cleanup: function attribute 'no_instrument_function'
Function attributes should be located after the declaration.
Change-Id: I88688e01ca54f525c4c20173c5e8e36b5f2740fa
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Tue, 30 Mar 2021 19:35:19 +0000 (15:35 -0400)]
cleanup: function attribute 'destructor'
Function attributes should be located after the declaration.
Change-Id: Iad766f5861a6b2de0d9dd3a0f87909ed7f8dc092
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Tue, 30 Mar 2021 19:29:42 +0000 (15:29 -0400)]
cleanup: function attribute 'constructor'
Function attributes should be located after the declaration.
Change-Id: Ie3ef444bf150824b3a57e8485417f019cecc61be
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Tue, 30 Mar 2021 19:19:13 +0000 (15:19 -0400)]
cleanup: function attribute 'unused'
Function attributes should be located after the declaration.
Change-Id: I62e4c3e521705756b99571281937bba6d5a6d063
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Wed, 31 Mar 2021 14:27:32 +0000 (10:27 -0400)]
tests: benchmark: improve benchmark scalability accuracy
Testing with a fixed number of loops per-thread only works if the
workload is distributed perfectly across CPUs. For instance, if a lock
is held in the workload (e.g. internally by open() and close()), those
may cause starvation of some threads, and therefore cause the benchmark
to be wrong because it will wait for the slowest thread to complete its
loops.
It is also not good for testing overcommit of threads vs cpus.
Change the test to report the number of loops performed in a given wall
time, and use this to report the average and std.dev. of tracing
overhead per event on each active CPU.
Change the benchmark workload to be only CPU-bound and not generate
system calls to minimize the inherent non-scalability of the workload
(e.g. locks held within the kernel).
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I5245f36831875bd9f87854618a4ed0cb31e56a4d
Mathieu Desnoyers [Wed, 31 Mar 2021 00:05:44 +0000 (20:05 -0400)]
tests: benchmark: use cpu-bound workload, calculate average and std.dev.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: If5cd9d920dd0cfe0e235b5386359080bc99efbb2
Mathieu Desnoyers [Tue, 30 Mar 2021 20:33:26 +0000 (16:33 -0400)]
tests: improve benchmark script
Kill session daemon after script, conditionally drop caches if root
(else it is forbidden to do so), handle cleanup on trap, use snapshot
(flight recorder) tracing to benchmark ring buffer, output the result in
nanoseconds, removing trailing numbers after dot.
Before this, the test was pretty much always resulting in an output of
"0s" extra overhead due to truncation of significant numbers in the
output.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ia7844f3a52821da972b24bf9f39158c24329f63a
Michael Jeanson [Tue, 30 Mar 2021 19:10:57 +0000 (15:10 -0400)]
cleanup: function attribute 'format'
Function attributes should be located after the declaration.
Change-Id: I1c1622b3102f4a9d2fc5df35b5dfc290abac48aa
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Tue, 30 Mar 2021 19:59:02 +0000 (15:59 -0400)]
Fix: liblttng-ust-ctl: missing ring buffer and counter clients init/exit symbols
Move init/exit functions to ust-core.c which is linked against by both
liblttng-ust and liblttng-ust-ctl to make them available to the control
library.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I70bd2841c941df8e4d25629a0747aaebe57e0569
Mathieu Desnoyers [Tue, 30 Mar 2021 13:54:23 +0000 (09:54 -0400)]
New API: lttng_ust_init_thread() for async-signal tracing
LTTng-UST uses Global Dynamic model TLS variables rather than IE
model because many versions of glibc don't preallocate a pool large
enough for TLS variables IE model defined in other shared libraries,
and causes issues when using LTTng-UST for Java tracing.
Because of this use of Global Dynamic TLS variables, users wishing to
trace from signal handlers need to explicitly trigger the lazy
allocation of those variables for each thread before using them.
This can be triggered by calling lttng_ust_init_thread().
Hide the public symbols for ring buffer and counter clients init/exit.
Expose new symbols for init/exit of all ring buffer and counter clients
instead. Those new symbols are only used by liblttng-ust-ctl, and are
thus in an internal header.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I389be1db96e5ff1e9a116311b8adf8676c9752cb
Michael Jeanson [Wed, 24 Mar 2021 23:05:55 +0000 (19:05 -0400)]
fix: redundant decl of channel_destroy (-Wredundant-decls)
Change-Id: If1ebe0225a848936bf94fb98edf19884909295ee
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Tue, 30 Mar 2021 16:07:51 +0000 (12:07 -0400)]
Fix: tls-compat with hidden ring buffer context
There are additional missing URCU_TLS() accessors in the refactoring of
the ring buffer context. Moreover, when indexing an array, it must be
done outside of the URCU_TLS() accessor.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ief9d31e26e16fa5decf797b23ed6304b5a8c79ca
Mathieu Desnoyers [Tue, 30 Mar 2021 16:03:32 +0000 (12:03 -0400)]
Fix: tls-compat with hidden ring buffer context
There is a missing URCU_TLS() accessor in the refactoring of the ring
buffer context, which fails the tls-compat build.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ied620bf7dc3821bd3af87b500201130769b037df
Mathieu Desnoyers [Mon, 29 Mar 2021 20:32:58 +0000 (16:32 -0400)]
Refactoring: hide internal fields of ring buffer context
The public ring buffer context is allocated on the probe stack, but
contains many internal fields which are of no use to the probe. They
belong to that structure for the sake of passing information between
reserve, write, commit, strcpy, and other ring buffer callbacks.
Move those fields to a newly introduced private data structure, which is
allocated into a TLS stack belonging to the ring buffer client. It is
indexed with the TLS ring buffer nesting counter to allow recursive use
of the ring buffer (e.g. signal handlers).
While doing this, also move the "offset alignment" operation to the ring
buffer write callback. The alignment is now an additional parameter
expected by the write callback. Note that the strcpy and pstrcpy_pad
callbacks never need to do any alignment, so simply remove those
no-op alignments.
The event reserve callback does not need to have an explicit event id
parameter. It can fetch it from the client private data.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I806c1b5de58446649fdfe433bfdc138b44e8f8af
Michael Jeanson [Wed, 24 Mar 2021 18:44:05 +0000 (14:44 -0400)]
Move private ABI counter client symbols to dedicated header
The counter client percpu functions are provided by liblttng-ust and used
by liblttng-ust-ctl. Make them part of the private ABI.
Change-Id: I5fe3c16cb46ac3998dbdc037ccdb71170fc03f61
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Wed, 24 Mar 2021 23:28:52 +0000 (19:28 -0400)]
fix: add fallthrough annotations (-Wimplicit-fallthrough)
Change-Id: I7d6c1197d6ff126f2c6fe6fb6ad8a0f575fc661d
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Fri, 26 Mar 2021 18:37:35 +0000 (14:37 -0400)]
fix: add format attribute to relevant functions (-Wsuggest-attribute=format)
Change-Id: Ie0828d4bbf560275cc8e1cd550737f8be2ab0aae
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Fri, 26 Mar 2021 18:36:30 +0000 (14:36 -0400)]
fix: use proper format specifiers in tests (-Wformat)
Also rework the snprintf test to not use a 'gnu_printf' style format
string as the function is annotated as expecting 'printf' style.
Change-Id: Idca3a4003bcb06c70795bff399a7698fada041ca
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Wed, 24 Mar 2021 21:03:46 +0000 (17:03 -0400)]
fix: shadowed local variable in macros (-Wshadow)
Add a prefix to the local variable names defined in the PERROR macro to
reduce the risk of shadowing variables with generic names.
Remove the local variable '____ptr_ret' in the shmp_index macro
Change-Id: I5d33e8eb4c760ffb527ac02cf8901105b500b28d
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Wed, 24 Mar 2021 23:09:41 +0000 (19:09 -0400)]
fix: size_t is unsigned, can't be negative
Change-Id: Id4e2c5b3c984978d26b6224794c0073b5c6eaf8a
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Wed, 24 Mar 2021 20:41:29 +0000 (16:41 -0400)]
Import libtap from babeltrace
Import the fixes to our local copy of libtap from the babeltrace
repository. This will allow enabling stricter compiler warnings down the
line.
Change-Id: I639b317c5f1c22b48e223b8e5649cf727a1f25c3
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Thu, 25 Mar 2021 15:01:17 +0000 (11:01 -0400)]
Add unit tests for utils macros
Change-Id: I1908e7031f8b4493813f7a5fe6ac1ab90d062afc
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Thu, 25 Mar 2021 16:03:12 +0000 (12:03 -0400)]
Add a C++ version of lttng_ust_is_signed_type
Change-Id: Iee3da5491bb00fb5144ecf631a122969396d1b40
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Thu, 25 Mar 2021 17:07:21 +0000 (13:07 -0400)]
fix: int8_t is not considered an integer
Add 'signed char' to the list of types we consider integers. Since 'char'
being signed or unsigned is implementation dependant, we have to
explicitly list 'char', 'signed char' and 'unsigned char' as integer
types.
Change-Id: I3aace2621f14f54e5d88d43de509a6cffde66c5b
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Thu, 25 Mar 2021 17:21:18 +0000 (13:21 -0400)]
Add unit tests for lttng_ust_strerror
Change-Id: I0c85780835b41a1ace9e91f0edc104bfd272f51f
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Thu, 25 Mar 2021 17:19:34 +0000 (13:19 -0400)]
Re-implement lttng_ust_strerr
Re-implement lttng_ust_strerr based on the tools internal
implementation.
* Require a negative error code from enum lttng_ust_error_code or zero
* Don't handle negative error codes as system errors anymore
Change-Id: I89a95f4f6b0c392c8fa7bdb3ad40a8d6ea918acf
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Fri, 26 Mar 2021 17:20:51 +0000 (13:20 -0400)]
Namespace 'lttng_alignof' to 'lttng_ust_rb_alignof'
Add the standard prefix and make it clearer this is a macro specific to
the ring buffer and not a generic wrapper over alignof.
Change-Id: If929f9744a98ea6980f4239456a59630bd1fc8e9
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Wed, 24 Mar 2021 16:04:21 +0000 (12:04 -0400)]
Namespace remaining symbols in lttng/ringbuffer-context.h
The major SONAME bump to '1' gives us the opportunity to properly
namespace some older parts of the API.
Change-Id: I0393d22738f8b98ac5ed73455aaaa0b84db0297d
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Wed, 3 Mar 2021 17:10:20 +0000 (12:10 -0500)]
Python agent lib soname major bump
Make the python agent library follow the main library soname for
co-installability with previous versions. Also use the value provided by
the build system instead of manually synchronizing it.
Change-Id: Ieef9b9ca6dcfd08b7834e5faafef3935a6a1a232
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Thu, 18 Mar 2021 20:50:27 +0000 (16:50 -0400)]
Introduce SONAME defines
Folowing the refactor of the autotools code, the major soname number of each
library is now available as a define in 'lttng/ust-version.h'. Use them
instead of literal value that have to be synchronized manually.
Change-Id: I7d777d32c2a710708c1ac2546111458c281fce13
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Tue, 23 Mar 2021 21:23:53 +0000 (17:23 -0400)]
Namespace ust-fork symbols
Namespace the public symbols used by liblttng-ust-fork and move them a
more appropriatly named header.
The major SONAME bump to '1' gives us the opportunity to properly
namespace some older parts of the API.
Change-Id: Ic44998cbf77c3ae8cd7e73c9ad789d743cefdd05
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Tue, 23 Mar 2021 20:56:21 +0000 (16:56 -0400)]
Namespace RING_BUFFER_ALIGN macros
Also add comments to clarify why efficient memory access impacts the
layout of the ringbuffer.
Change-Id: I752f8b6dec6b00b8222500194cd53428db7d0da5
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Tue, 23 Mar 2021 20:31:22 +0000 (16:31 -0400)]
cleanup: Remove redefinition of CHAR_BIT
Remove the redefinition of CHAR_BIT in 'lttng/ust-tracer.h', it is
defined in 'limits.h' by all major Linux libc and even other Unices.
Explicitly include <limits.h> in all files using CHAR_BIT.
Change-Id: I917f6ee16898a6f99fa32db5d6ebd701e95400cc
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Tue, 23 Mar 2021 15:17:53 +0000 (11:17 -0400)]
cleanup: Namespace public utils macros
Namespace utils macros in public headers under the 'lttng_ust_' prefix
and regroup them in single header file.
Change-Id: I65f133b25c54f8ef59070c9b56c79fbaf5ca84d2
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Fri, 26 Mar 2021 15:13:25 +0000 (11:13 -0400)]
tracepoint probe refactoring: Move provider name to provider descriptor
The provider name is currently repeated for each event name as:
<provider name>:<event name>
This repetition requires that each event embeds the provider name within
its own name.
Use this ABI break to clean this up: instead, each event descriptor has
a pointer to its probe descriptor, and each probe descriptor has a
provider name.
Implement name size validation and event name formatting internal
helpers, and use them across the tracer.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ief8a4696a2030bf3b9c785b8422f382079c6bf06
Mathieu Desnoyers [Mon, 29 Mar 2021 15:42:44 +0000 (11:42 -0400)]
Refactoring: remove ring buffer channel pointer from struct lttng_ust_channel_buffer
This pointer can be moved to an internal data structure, and be
populated by the ring buffer client rather than the probes.
Also transition all ring buffer client callbacks to use buffer and
channel structures rather than shm handle.
Also remove the handle from struct ustctl_consumer_stream (internal to
ustctl.c) because it is redundant.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I9c389626de5a02cf2ac7377d9f1e2802128992c4
Mathieu Desnoyers [Fri, 26 Mar 2021 20:30:21 +0000 (16:30 -0400)]
API cleanup: Remove handle from struct lttng_ust_channel_buffer
Now that the handle is fetched from struct lttng_ust_lib_ring_buffer_channel
by the ring buffer client callbacks, there is no need to keep it around
in the public API struct lttng_ust_channel_buffer.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Id41d1ffb171ea64150e2ceebd51c9679071ee337
Mathieu Desnoyers [Fri, 26 Mar 2021 20:25:41 +0000 (16:25 -0400)]
Remove handle field from ring buffer context
The ring buffer handle is available in the struct lttng_ust_lib_ring_buffer_channel,
therefore passing it through the ring buffer context is redundant.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I7baca38b86743ba88a55b9d336135df2256756d1
Mathieu Desnoyers [Fri, 26 Mar 2021 17:52:25 +0000 (13:52 -0400)]
ring buffer context: cpu number becomes an output of reserve
In order to facilitate eventual integration of a ring buffer scheme
based on Restartable Sequences (sys_rseq), change the ownership of the
ring buffer context "cpu" field so it is now populated by the ring
buffer reserve operation. This means a rseq-based reserve could retry
on a new current cpu after a rseq-cmpxchg fails to reserve and then a
migration occurs.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: If0c0689446975085b5e22b14aef6a15f12f8ff9f
Mathieu Desnoyers [Thu, 25 Mar 2021 18:47:47 +0000 (14:47 -0400)]
Fix: truncation of text array and sequences by NULL terminator
The recent refactor does not take into account that text array and text
sequence types behave like Pascal Strings and not C strings, which means
the NULL terminator is optional, and the string size is delimited by the
array or sequence length.
Introduce a new lib_ring_buffer_pstrcpy() to handle copying into a ring
buffer Pascal String, and use it for array and sequence of text.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fixes: 2792781482a5 ("ABI refactoring: sequence and array of text: copy input as string")
Fixes: #1301
Change-Id: Idcc13f061d5229496476f42dce84c2f395b7f6e6
Mathieu Desnoyers [Thu, 25 Mar 2021 19:57:05 +0000 (15:57 -0400)]
Cleanup: use "char" type for padding
The ring buffer strcpy operation can take a "char" rather than "int" as
parameter, which is a closer match to its actual expected type.
Same goes for the do memset internal operation.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I3c043ecff46cfef48c8992d004154383f7cab59d
Mathieu Desnoyers [Thu, 25 Mar 2021 18:28:20 +0000 (14:28 -0400)]
compiler warning cleanup: is_signed_type: compare -1 to 1
Comparing -1 to 0 triggers compiler warnings (gcc -Wtype-limits and
-Wbool-compare) and Coverity warning "Macro compares unsigned to 0".
Comparing -1 to 1 instead takes care of silencing those warnings while
keeping the same behavior.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I5003ce1f80d34ca6713bab43e8114a23f2d8c1d4
Mathieu Desnoyers [Tue, 23 Mar 2021 19:53:39 +0000 (15:53 -0400)]
Rename struct lttng_ust_channel_ops to struct lttng_ust_channel_buffer_ops
Likewise for private structure. This namespacing will allow smoother
integration of upcoming counter feature in the public API.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Idc68f43febbb7e6ad2ed02615ddaee6a3e729b09
Michael Jeanson [Tue, 23 Mar 2021 18:20:21 +0000 (14:20 -0400)]
fix: Group Targets requires GNU Make >= 4.3
Group Targets requires GNU Make >= 4.3 released in 2020, with older Make
release the syntax only results in a warning and most of the time it
will work fine since the rule is called and generates both files.
However it breaks the dependencies across files and makes the man pages
generation racy.
Use a less elegant workaround that is compatible with all Make
implementations.
Change-Id: I46a0488c6ff61082f641d8ee55ad2802c0bfa046
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Tue, 23 Mar 2021 15:58:52 +0000 (11:58 -0400)]
clock override: introduce getter API for lttng tools
Currently, the lttng session daemon reimplements its own copy of
struct lttng_trace_clock, which is pretty bad as ABI go.
Implement getter functions for each of the clock callback instead. This
refactoring needs to be introduced with a matching commit to use the new
ABI in LTTng tools.
Move the implementation of the clock frequency, uuid, name and
description default callbacks (for monotonic clock) to lttng-ust.
This allow to hide the previously exposed "lttng_trace_clock" public
symbol. Rename this internal symbol to lttng_ust_trace_clock for prefix
consistency. Rename struct lttng_trace_clock to struct
lttng_ust_trace_clock for similar reasons.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I55825f0c0f5372a68aaaf06fb8dbd256cf248f2c
Mathieu Desnoyers [Tue, 23 Mar 2021 18:59:47 +0000 (14:59 -0400)]
ust-abi: add missing lttng_ust_abi prefixes
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ie2b2c28643203ba3a19b746241997776b8c58ed5
Michael Jeanson [Tue, 23 Mar 2021 16:54:41 +0000 (12:54 -0400)]
fix: java detection is optional
I misunderstood the dependencies between the different java macros, move
the binairies detection back to optionnal for the time being.
Change-Id: I917f8f5dc7c34f1ac360d405b3a2327e2ee518e7
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Tue, 23 Mar 2021 16:09:49 +0000 (12:09 -0400)]
fix: use configured python when building the examples
Prior to the refactoring of the autotools setup we used different python
detection mechanisms for the python agent feature and the example code.
The example code detection was flawed as it would only work with a
python binary named exactly 'python'. Wire the detected python binary in
the examples Makefile integration.
Change-Id: I07b9222a8869ff154073e5b72fb2ac0d70f14896
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Mon, 22 Mar 2021 20:59:38 +0000 (16:59 -0400)]
ABI refactoring: sequence and array of text: copy input as string
Within the lttng-modules writeback instrumentation, which exposes a
tracepoint probe API similar to LTTng-UST, we had a long standing issue
where a fixed-size array of text was used to copy a string input into
the trace.
This is fine as long as the input string is actually backed by a
fixed-size array, but if the input string is variable-size, and may be
smaller than the array size, this led to out-of-bound memory reads
beyond the input string NULL terminating character.
Change the behavior of the array/sequence of text to stop copying the
input as soon as the array/sequence size limit (-1) or the input's NULL
terminating character is found, and add zeroed padding for the rest of
the array/sequence within the ring buffer.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Icc3f31c12bdd8018e5e4b7ea146fe842371054d6
Michael Jeanson [Tue, 23 Mar 2021 14:20:09 +0000 (10:20 -0400)]
cleanup: don't copy lttng-gen-tp in OOT builds
No need to make a copy of lttng-gen-tp when doing an out of tree build,
just use the path to the source dir in the examples Makefile.
Change-Id: I485d0f9b25232d0ce46c2f7981a3ef781155c749
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Mon, 22 Mar 2021 19:09:55 +0000 (15:09 -0400)]
configure: convert the remaining tab indent to spaces
This is part of an effort to standardise our autotools setup across
project to simplify maintenance.
Change-Id: I452eb6ffad31ee0951f7eb2e44861dcfc49cae77
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Mon, 22 Mar 2021 18:59:31 +0000 (14:59 -0400)]
configure: regroup autoconf substituted variable
This is part of an effort to standardise our autotools setup across
project to simplify maintenance.
Change-Id: If2938c615477604693787ea69c956a37931cef13
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Mon, 22 Mar 2021 18:40:41 +0000 (14:40 -0400)]
configure: regroup automake conditionals
This is part of an effort to standardise our autotools setup across
project to simplify maintenance.
Change-Id: I3b7f8f15ac6f8752aa2d7eb9a62e45cf4ac354f9
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Mon, 22 Mar 2021 18:34:47 +0000 (14:34 -0400)]
configure: regroup C defines
This is part of an effort to standardise our autotools setup across
project to simplify maintenance.
Change-Id: I1aa80c098f0c36640eff3113db3544bd303a815c
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Mon, 22 Mar 2021 17:29:58 +0000 (13:29 -0400)]
Introduce AE_FEATURE to manage configure features
The new AE_FEATURE set of macros are wrappers over autoconf's
AC_ARG_ENABLE. The main objective is to make the m4sh code more readable
to the less seasoned autotools enthusiast among us and reduce the
duplication of code with its associated bugs.
The AE prefix was chosen to mean "Autotools EfficiOS" and is part of an
effort to standardize our custom macros across all our autotools based
projects.
Change-Id: I35268e36e70b2dd826876939e663d63d3123fa9f
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Mon, 22 Mar 2021 17:17:32 +0000 (13:17 -0400)]
configure: regroup os and arch specific defaults
This is part of an effort to standardise our autotools setup across
project to simplify maintenance.
Change-Id: Ib0f3319133ed7dfab8ee844f6bcf99dd9606d344
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Mon, 22 Mar 2021 17:12:42 +0000 (13:12 -0400)]
configure: regroup library checks
This is part of an effort to standardise our autotools setup across
project to simplify maintenance.
Change-Id: Ieec98a3ab09c2088408b0f0bbd9bc3b605077982
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Mon, 22 Mar 2021 17:06:28 +0000 (13:06 -0400)]
configure: regroup program checks
This is part of an effort to standardise our autotools setup across
project to simplify maintenance.
Change-Id: I32c54c43a82c4b3f532b702bd733a54683167082
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Mon, 22 Mar 2021 16:57:44 +0000 (12:57 -0400)]
configure: regroup C header checks
This is part of an effort to standardise our autotools setup across
project to simplify maintenance.
Change-Id: I659c98ce9eb328e78d1c075a1157f59848195650
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Mon, 22 Mar 2021 16:44:54 +0000 (12:44 -0400)]
configure: regroup and expand C compiler checks
This is part of an effort to standardise our autotools setup across
project to simplify maintenance.
Change-Id: I304f4bda39e60321248772ef9864cd205a049a6f
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Mon, 22 Mar 2021 18:44:35 +0000 (14:44 -0400)]
configure: Introduce macro ae_in_git_repo
This is part of an effort to standardise our autotools setup across
project to simplify maintenance.
Change-Id: Ifffade15ac4a15823be8ab1b6c8232624a89ab7c
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Mon, 22 Mar 2021 16:24:34 +0000 (12:24 -0400)]
configure: centralize version information
Centralise version information at the beginning of configure.ac to
improve readability.
This is part of an effort to standardise our autotools setup across
project to simplify maintenance.
Change-Id: Ia4de4737ac73e7dac55341e7b238780501289350
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Thu, 18 Mar 2021 20:37:40 +0000 (16:37 -0400)]
Use a single macro to configure CXX
This is part of an effort to standardise our autotools setup across
project to simplify maintenance.
Change-Id: I3667b0e61d44fd2e2ff36ac6935888e6a895ce73
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Thu, 18 Mar 2021 20:25:34 +0000 (16:25 -0400)]
fix: use the configured cmake binary
Use the configure cmake binary in the examples Makefile instead of a
direct call.
Change-Id: Idb66642345e551b427e359b9cd58f49aad2a8502
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Thu, 18 Mar 2021 20:08:48 +0000 (16:08 -0400)]
configure: standardize automake conditional names
This is part of an effort to standardise our autotools setup across
project to simplify maintenance.
Change-Id: I32fe475e04e77b2972ed9d963f1d2a5c6440a4ce
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Thu, 18 Mar 2021 18:16:40 +0000 (14:16 -0400)]
Centralize arch detection in a public header
Add a public header with centralized compiler arch detection and arch
specific parameters. Namespace everything under 'LTTNG_UST_ARCH_'.
Move "LTTNG_UST_HAVE_EFFICIENT_UNALIGNED_ACCESS" from a configure time
define to a static one base on compiler arch detection.
This will simplify the build system and remove the possibility of
accidently mixing aligned and unaligned access in a multiarch
environment with shared header files.
Change-Id: Ic977d13f031ad070bea4ff5d7b2b8079843e0c26
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Thu, 18 Mar 2021 18:00:34 +0000 (14:00 -0400)]
Set the default ust constructor timeout in the headers
This is not user-configurable, use the same strategy as all other
internal defaults.
Change-Id: I05d61999afee44687336bf70712ee99e2da19f71
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Thu, 18 Mar 2021 17:57:13 +0000 (13:57 -0400)]
fix: don't override the project wide AM_CPPFLAGS
Fix some makefiles imported after we switched to a global standardized
include path in AM_CPPFLAGS.
Change-Id: Ibb02293f86848b968c4fe190b137e562f94e83b4
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Thu, 18 Mar 2021 17:49:55 +0000 (13:49 -0400)]
Add basic shell tests script framework
Import a stripped down shell tests script framework from babeltrace2.
This is part of an effort to standardise our autotools setup across
project to simplify maintenance.
Change-Id: I41ea4b186fe744fd6841d866daa87a802c96b692
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Thu, 18 Mar 2021 17:45:06 +0000 (13:45 -0400)]
Simplify python agent build
Import the fixes and simplification to the python build integration with
autotools from babeltrace2.
This is part of an effort to standardise our autotools setup across
project to simplify maintenance.
Change-Id: I1da953c48acc2162f369893793e195803376a4f8
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Wed, 16 Dec 2020 17:39:46 +0000 (12:39 -0500)]
port: update pthread get/set name compat
Sync the pthread set/get name compat with tools, to add support for
recent FreeBSD and MacOS API.
Change-Id: I9c16fc32e2a75e3f484198279e1660f3e2c5e142
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Mon, 22 Mar 2021 16:52:54 +0000 (12:52 -0400)]
Fix: bytecode linker: validate event and field array/sequence encoding
The bytecode linker should only allow linking filter expressions loading
fields which are string-encoded arrays and sequence for comparison
against a string, and reject arrays and sequences without encoding, so
the filter interpreter does not attempt to load non-NULL terminated
arrays/sequences as if they were strings.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I7e0d42dc53738f36af372b4352c44bc1fff916d1
Mathieu Desnoyers [Mon, 22 Mar 2021 14:01:55 +0000 (10:01 -0400)]
Validate match of all session channel's UUID
Add a validation at channel creation to ensure that the uuid of all
channels created within a session match.
Note that we still need to keep a copy of the uuid field in the channel
private data at this stage, because the consumer daemon creates channels
with a NULL session pointer.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I3490bab8879ffa66bc1e19559b0a1a60d33d605b
Mathieu Desnoyers [Mon, 22 Mar 2021 13:50:19 +0000 (09:50 -0400)]
Cleanup: Remove whiteline
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I128bcc42913028f28035794519900d688373544f
Mathieu Desnoyers [Mon, 22 Mar 2021 13:47:30 +0000 (09:47 -0400)]
Cleanup: align private header comments
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I358a424e765a150c395fc3efa1b61e3f2020a2c5
Mathieu Desnoyers [Mon, 22 Mar 2021 13:45:21 +0000 (09:45 -0400)]
Cleanup: remove old comments
Those comments are not useful for internal structures.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I5341e686e20f164333166b008dd9d446c3e6dea3
Mathieu Desnoyers [Fri, 19 Mar 2021 04:03:17 +0000 (00:03 -0400)]
Refactoring and fix: bytecode ABI
Introduce an "event filter" callback to be called by the instrumentation
probe, and move the bytecode list into private data structures.
This will allow much more freedom in choosing how bytecodes are combined
both in terms of logic (OR vs AND) and implementation (jits).
Currently, we keep callbacks internally as well for each bytecode
evaluation, but nothing prevents to change how this works in the future
to improve performance now that this is all private.
For filters, we add the following fields to struct lttng_ust_event_common:
int eval_filter; /* Need to evaluate filters */
int (*run_filter)(struct lttng_ust_event_common *event,
const char *stack_data,
void *filter_ctx);
"eval_filter" is a state indicating whether the filter should be
evaluated at all. It combines internal knowledge of whether the filter
bytecode list is empty, and whether there are enablers without filter
bytecode attached to the event.
For captures, a new struct lttng_ust_notification_ctx is introduced,
which is to be used as additional "context" to the notification_send()
callback. This allows passing the "eval_capture" state from the probe
to the notification callback, and fixes a bug where a sequence of:
- create notification enabler,
- enable notification enabler,
- add capture to enabler,
where a tracepoint runs concurrently with add capture happens to do a
first capture list_empty check which skips the stack preparation,
whereas the second capture list_empty check within the notification
callback finds a capture entry, and thus attempts to use an
uninitialized stack. The notification callback is also modified to use
an RCU-aware list traversal.
For captures, the following field is added to struct lttng_ust_event_notifier:
int eval_capture; /* Need to evaluate capture */
which is to be read once by the probe and its state saved and used
thorough the entire probe execution.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Iae70c5e7924f14b38e14676368cf2516951218ee
Mathieu Desnoyers [Fri, 19 Mar 2021 03:22:18 +0000 (23:22 -0400)]
Bytecode: update documentation
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I687ad8f08c735704ce1084c21d9c782deadd2541
Mathieu Desnoyers [Thu, 18 Mar 2021 21:04:07 +0000 (17:04 -0400)]
Refactoring: bytecode interpreter ABI
Refactor the ABI of the bytecode interpreter, which is used by the probe
provider callbacks:
- Return a "int" rather than uint64_t,
- The return values are now:
LTTNG_UST_BYTECODE_INTERPRETER_ERROR = -1,
LTTNG_UST_BYTECODE_INTERPRETER_OK = 0,
- Introduce a bytecode "context". This context is specific for each
bytecode "class" (filter or capture). The filter class context
has a "result" (accept/reject) output, whereas the capture class
has an "output".
- The bytecode context is extensible with the struct_size scheme.
- Merge filter and capture interpreters into a single callback.
That callback uses a new "bytecode type" field within the bytecode
private data to figure out the specific bytecode class (filter or
capture).
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Id528e141d0c213e9bb41f68d6d7e632104daa1cf
Mathieu Desnoyers [Thu, 18 Mar 2021 20:08:10 +0000 (16:08 -0400)]
Fix: java agent: migrate to new channel structures
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ic20da8461a6d8fe741b701b7b9e68a3aeb2ad7a1
Mathieu Desnoyers [Thu, 18 Mar 2021 19:57:06 +0000 (15:57 -0400)]
Move event context to private structures
The list of contexts active for an event can be moved to a private
structure by keeping the temporary pointer to the RCU dereferenced
context in the ring buffer client's internal context rather than within
the context shared between the probe and the ring buffer client.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I3040edf42ea59786a4ee1b5b3f9a90e1834821ab
Mathieu Desnoyers [Thu, 18 Mar 2021 19:49:11 +0000 (15:49 -0400)]
Move channel context to private structures
The list of contexts active for a channel can be moved to a private
structure by keeping the temporary pointer to the RCU dereferenced
context in the ring buffer client's internal context rather than within
the context shared between the probe and the ring buffer client.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Iaf9491255d1a0940450dea613ac6e5bc0705506d
Mathieu Desnoyers [Thu, 18 Mar 2021 15:44:30 +0000 (11:44 -0400)]
Refactoring: Channel structures
Now that struct lttng_channel is separate from the consumer daemon
channel config message ABI layout, we can perform a significant amount
of refactoring:
- Namespace theses structures with lttng_ust_ prefix,
- Use struct_size extensibility scheme.
- Split fields into public/private structures,
- Split public and private structures into a child (ring buffer)
and parent (common). This will allow introducing other channel
children types in the future (e.g. counters).
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I6acec4e4ffff721e6ea5698e64a063045e1c1022
Mathieu Desnoyers [Thu, 18 Mar 2021 13:34:55 +0000 (09:34 -0400)]
struct lttng_channel: split protocol ABI from instrumentation ABI
Duplicate struct lttng_channel to introduce a new struct
lttng_ust_abi_channel_config meant to hold configuration data within the
memory area belonging to the ring buffer private data. Now the
application and consumer private pointer will be a separate pointer,
for which the memory will be owned by the caller.
This will allow us to modify the layout of struct lttng_channel without
breaking the UST communication protocol.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I96684aa6658f59dc3332da6034bdf9e3f921261f
This page took 0.04517 seconds and 4 git commands to generate.