lttng-ust.git
3 years agoust-events.h API const-ness
Mathieu Desnoyers [Mon, 19 Apr 2021 14:07:08 +0000 (10:07 -0400)] 
ust-events.h API const-ness

Ensure ust-events.h definitions, fields, and arguments referring to
const arrays of pointers are const.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I9b1173221c2cfd2d574c300233e15a3fc0e72bce

3 years agoHide lttng_ust_elf symbols
Michael Jeanson [Fri, 16 Apr 2021 20:56:14 +0000 (16:56 -0400)] 
Hide lttng_ust_elf symbols

Change-Id: I5747d0dd9c5fe3d2fdba4f5606e8aa1b7138016a
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoDisable strict-aliasing globally
Michael Jeanson [Tue, 6 Apr 2021 22:18:02 +0000 (18:18 -0400)] 
Disable strict-aliasing globally

Change-Id: Idaf3407c827eeff05f5e52afb446484ff959dbd0
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoconfigure: enable extended compiler warnings
Michael Jeanson [Mon, 22 Mar 2021 22:02:49 +0000 (18:02 -0400)] 
configure: enable extended compiler warnings

Import the compiler warning flag detection system from Babeltrace and
enable extended compiler warnings.

Change-Id: Id7d783a946a014b9b0811fbd934377cd9cde93c7
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoFix warnings on non-x86_64 systems
Michael Jeanson [Fri, 16 Apr 2021 21:09:27 +0000 (17:09 -0400)] 
Fix warnings on non-x86_64 systems

Change-Id: I1043786d066576c91ef5a62bf45e890e870c4454
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoRemove -Wsystem-headers from tests
Michael Jeanson [Fri, 16 Apr 2021 20:06:11 +0000 (16:06 -0400)] 
Remove -Wsystem-headers from tests

The objective of add -Wsystem-headers to the tests Makefiles was to
catch warnings in the tracepoint headers when they are installed in the
compiler system header path. However the tests are always built against
the headers inside the tree which are not in the system header path.

A side effect is that it causes problems on some system where the system
headers generate warnings and thus prevent us from building with
warnings treated as errors.

Change-Id: I65529c50cf48e49ba34692e6d501e3218be8d41c
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoInitialize liblttng-ust-common in dependent libraries
Michael Jeanson [Tue, 13 Apr 2021 20:39:18 +0000 (16:39 -0400)] 
Initialize liblttng-ust-common in dependent libraries

liblttng-ust-common is a new public library introduced in this
developement cycle to contain the shared state between liblttng-ust and
our other libs that can't link directly on liblttng-ust. The constructor
of each of these libraries should now call the liblttng-ust-common
constructor early in their own constructors to ensure proper execution
order.

  * Rename library constructors with the _ctor suffix to help
    distinguish them from other _init functions.
  * Hide the fd-tracker init fonction, the liblttng-ust-common ctor
    should be called instead.
  * All libraries linked on 'liblttng-ust-common' call its constructor
    early in theirs.

Change-Id: I8e083f392b4ef2427addd00120cffc61a6314697
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoInternal logging lazy-initialization
Michael Jeanson [Wed, 14 Apr 2021 17:39:03 +0000 (13:39 -0400)] 
Internal logging lazy-initialization

Replace the initialization function by a lazy-init scheme, this way we
don't loose logging messages when called from constructors across
libraries or ld preloaded wrappers.

Change-Id: Idb1593c025351af6aed152b31a2aab17b4d884b0
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agogetenv: make getenv helper init state mt-safe
Mathieu Desnoyers [Fri, 16 Apr 2021 16:02:01 +0000 (12:02 -0400)] 
getenv: make getenv helper init state mt-safe

Change-Id: Idebb709fe4dd5501dfe657ea23fc6a67a65ce1ff
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoRemove duplicated 'smp' code
Michael Jeanson [Thu, 8 Apr 2021 16:04:20 +0000 (12:04 -0400)] 
Remove duplicated 'smp' code

libcounter contains a namespaced copy of the smp code from libringbuffer,
remove it and move the original to libcommon.

Also add comments and hide some implementation details following the ABI
cleanup.

Change-Id: Ie7d78d4f34312c5c788abc07d1806de3ce6fc04c
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove liblttng-ust-pthread-wrapper to 'src/lib/'
Michael Jeanson [Wed, 14 Apr 2021 18:55:30 +0000 (14:55 -0400)] 
Move liblttng-ust-pthread-wrapper to 'src/lib/'

Change-Id: Id38841b2338de290f7dc9ec68c10411031fc3d58
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agotracepoint: validate provider/event name length with static assert
Mathieu Desnoyers [Thu, 15 Apr 2021 21:26:32 +0000 (17:26 -0400)] 
tracepoint: validate provider/event name length with static assert

Validate the provider/event name length with static assert in both
_DEFINE_TRACEPOINT() and within the tracepoint probe.

Validating the length in _DEFINE_TRACEPOINT() ensures that the
tracepoints don't try to register a callsite with a too long name by
mistake. This will enable handling of too long names with rejection of
the tracepoint rather than truncation of the name in a future patch.

The tracepoint probe was already validating the length, but using a
static assert makes the error message clearer.

Introduce LTTNG_UST_TRACEPOINT_NAME_LEN_MAX which is separate from the
communication protocol's LTTNG_UST_ABI_SYM_NAME_LEN to ensure both
communication protocol and instrumentation API can evolve independently.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ia2e9898ef2f7a5708c692476aff7df6113bccb90

3 years agoRename ringbuffer-context.h to ust-ringbuffer-context.h
Mathieu Desnoyers [Thu, 15 Apr 2021 20:28:08 +0000 (16:28 -0400)] 
Rename ringbuffer-context.h to ust-ringbuffer-context.h

For naming consistency of public headers.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: If01b2157c4e150b5bd7740348c9f7372ebf5ac97

3 years agoRename LTTNG_ALLOCATE_COMPOUND_LITERAL_ON_HEAP to add LTTNG_UST_ prefix
Mathieu Desnoyers [Thu, 15 Apr 2021 20:21:19 +0000 (16:21 -0400)] 
Rename LTTNG_ALLOCATE_COMPOUND_LITERAL_ON_HEAP to add LTTNG_UST_ prefix

Rename LTTNG_ALLOCATE_COMPOUND_LITERAL_ON_HEAP to
LTTNG_UST_ALLOCATE_COMPOUND_LITERAL_ON_HEAP to use the LTTNG_UST_
prefix. This is public API, but was never documented, recently
introduced, and does not appear to be actively used by any open source
project. Since we are doing an ABI bump, clean this up.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Id59c9a589568826008accb3a810678cdddf242e3

3 years agoRename lttng_ust_lib_ring_buffer to lttng_ust_ring_buffer
Mathieu Desnoyers [Thu, 15 Apr 2021 20:19:13 +0000 (16:19 -0400)] 
Rename lttng_ust_lib_ring_buffer to lttng_ust_ring_buffer

Rename type and identifiers across the entire lttng-ust project. The
"lib_" part does not add any information.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I861d9edc7c43689288c0765a8f66b20087aa3e88

3 years agoRemove unused ringbuffer-abi.h public header
Mathieu Desnoyers [Thu, 15 Apr 2021 20:09:47 +0000 (16:09 -0400)] 
Remove unused ringbuffer-abi.h public header

This header has always been unused. The consumer daemon interacts with
the ring buffer in lttng-ust is through liblttng-ust-ctl, and not
through an ioctl-style ABI.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I24239a40a30c56fb68917a132f4f58b219ea3e4a

3 years agotracepoint: namespace systemtap UST macros with LTTNG_UST_ prefix
Mathieu Desnoyers [Thu, 15 Apr 2021 19:56:48 +0000 (15:56 -0400)] 
tracepoint: namespace systemtap UST macros with LTTNG_UST_ prefix

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I7eba388a741917e790e0c270c3b898fc9ea8ebb2

3 years agoRename LTTNG_TP_EXTERN_C to LTTNG_UST_TP_EXTERN_C
Mathieu Desnoyers [Thu, 15 Apr 2021 19:54:16 +0000 (15:54 -0400)] 
Rename LTTNG_TP_EXTERN_C to LTTNG_UST_TP_EXTERN_C

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ia99792a6857f2e3b5d421bace875ab34b3d29901

3 years agoRename __LTTNG_COMPOUND_LITERAL to LTTNG_UST_COMPOUND_LITERAL
Mathieu Desnoyers [Thu, 15 Apr 2021 19:53:03 +0000 (15:53 -0400)] 
Rename __LTTNG_COMPOUND_LITERAL to LTTNG_UST_COMPOUND_LITERAL

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Id92634444681f187ce6d4b15a64c739e93d243f2

3 years agolttng_ust_static_assert: remove extra semicolons
Mathieu Desnoyers [Thu, 15 Apr 2021 19:47:22 +0000 (15:47 -0400)] 
lttng_ust_static_assert: remove extra semicolons

Also ensure none of recent nor compatibility lttng_ust_static_assert
implementations end with a semicolon.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ie43dbd3d0068ddc63c5317c73f9f831390662535

3 years agoFix: statedump init/exit namespacing
Mathieu Desnoyers [Thu, 15 Apr 2021 19:41:47 +0000 (15:41 -0400)] 
Fix: statedump init/exit namespacing

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I8da1d28cdde39ebef34c5999cf571eb5ff3b3d31

3 years agoNamespace tracepoint probes init/exit under lttng_ust_
Mathieu Desnoyers [Thu, 15 Apr 2021 19:39:59 +0000 (15:39 -0400)] 
Namespace tracepoint probes init/exit under lttng_ust_

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: If487b517c5691cde3ae773b0902d8f08050fc6c1

3 years agoNamespace lttng_static_assert to lttng_ust_static_assert
Mathieu Desnoyers [Thu, 15 Apr 2021 19:38:43 +0000 (15:38 -0400)] 
Namespace lttng_static_assert to lttng_ust_static_assert

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I89c2d874ec72a82f1bc84b04abd34af2aa4b8505

3 years agonotification_send callback takes const event_notifier parameter
Mathieu Desnoyers [Thu, 15 Apr 2021 17:31:13 +0000 (13:31 -0400)] 
notification_send callback takes const event_notifier parameter

The event parameter of the notification_send callback should be const,
because it should not be modified, only read.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Iff6b7454bb4a87ed4a75d842f67e18e5a11be4dd

3 years agorun_filter callback takes const event parameter
Mathieu Desnoyers [Thu, 15 Apr 2021 17:25:51 +0000 (13:25 -0400)] 
run_filter callback takes const event parameter

The event parameter of the run_filter callback should be const, because
it should not be modified, only read.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ie25a3e228d4e0971b447ab4b25d4b2b5e03efa2e

3 years agoFix: perform lazy initialization of getenv common lib
Mathieu Desnoyers [Tue, 13 Apr 2021 21:24:50 +0000 (17:24 -0400)] 
Fix: perform lazy initialization of getenv common lib

The ust-dl wrapper ends up calling into the getenv common lib very early
from library constructors through use of dlopen by the tracepoint
instrumentation code.

This happens before the getenv common lib is explicitly initialized by
liblttng-ust's contructor.

Perform lazy initialization for those early use by constructor
scenarios.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I9f84bb776a62e03b11db0386e267df00eb165ddd

3 years agofix: remove unused include wait.h
Michael Jeanson [Tue, 13 Apr 2021 19:49:20 +0000 (15:49 -0400)] 
fix: remove unused include wait.h

We moved our internal 'wait.h' to 'common/wait.h' but forgot the include
in 'lttng-events.c'. This was a stale include as we don't use anything
from wait.h here. On Linux this went unnoticed as there is a system
'wait.h' which is an alias for 'sys/wait.h'. However, there is no such
system header on FreeBSD and it results in a build failure.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I10034b65e4cacae0ef729ce07d505a37f0b2f1cc

3 years agoCleanup: use desc variable rather than deeply nested desc pointer
Mathieu Desnoyers [Tue, 13 Apr 2021 19:34:40 +0000 (15:34 -0400)] 
Cleanup: use desc variable rather than deeply nested desc pointer

Those point to the same descriptor.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ia69ee46e9f59970faebb0826e9b22146d80510af

3 years agocleanup: LTTNG_METADATA_TIMEOUT_MSEC defined twice
Michael Jeanson [Thu, 8 Apr 2021 21:41:56 +0000 (17:41 -0400)] 
cleanup: LTTNG_METADATA_TIMEOUT_MSEC defined twice

Change-Id: Ibc83ac95905a10cc3ec53c2eebb2092d82b852b7
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove liblttng-ust-tracepoint to 'src/lib/'
Michael Jeanson [Thu, 8 Apr 2021 21:08:47 +0000 (17:08 -0400)] 
Move liblttng-ust-tracepoint to 'src/lib/'

Change-Id: I589e48d787e4a72c0511746bde5d5f43d9d2633e
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove liblttng-ust-common to 'src/lib/'
Michael Jeanson [Thu, 8 Apr 2021 20:16:47 +0000 (16:16 -0400)] 
Move liblttng-ust-common to 'src/lib/'

Change-Id: I263784a5dcc1a594eb9f51a40cadcbae1ae24860
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove string-utils.h to 'src/common/'
Michael Jeanson [Wed, 7 Apr 2021 00:17:04 +0000 (20:17 -0400)] 
Move string-utils.h to 'src/common/'

Change-Id: I2c56997580f40728d60701b7e899af8bc8f4bd57
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove ns.h to 'src/common/'
Michael Jeanson [Tue, 6 Apr 2021 23:57:21 +0000 (19:57 -0400)] 
Move ns.h to 'src/common/'

Change-Id: Ibddbf741bdc7a4b1bcc1602cf636b71ac12683df
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove lttng-hash-helper.h to 'src/common/'
Michael Jeanson [Tue, 6 Apr 2021 23:53:59 +0000 (19:53 -0400)] 
Move lttng-hash-helper.h to 'src/common/'

Change-Id: I35cbbba23d610c28087e43d27b04aa3d0755dbaa
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove error.h to 'src/common/'
Michael Jeanson [Tue, 6 Apr 2021 23:36:31 +0000 (19:36 -0400)] 
Move error.h to 'src/common/'

Also rename it to 'err-ptr.h' to mitigate the risk of confusion with the
system header <error.h>.

Change-Id: Id86c8fda833c6358326708ccf54d5c35a69d5890
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove jhash.h to 'src/common/'
Michael Jeanson [Tue, 6 Apr 2021 23:22:08 +0000 (19:22 -0400)] 
Move jhash.h to 'src/common/'

Change-Id: I17031c461b8376e92900239aceac45258e8e3c1b
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove creds.h to 'src/common/'
Michael Jeanson [Tue, 6 Apr 2021 23:17:41 +0000 (19:17 -0400)] 
Move creds.h to 'src/common/'

Change-Id: Ifbb7f9a1af76f1f2ae2bcaa9d7d625ffc2299bfa
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove futex wrapper to 'common/compat/'
Michael Jeanson [Tue, 6 Apr 2021 22:32:51 +0000 (18:32 -0400)] 
Move futex wrapper to 'common/compat/'

Change-Id: I9f1a31162f789bde101e08c5effa65449d631946
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoSplit ust-events-internal.h between common and liblttng-ust
Michael Jeanson [Sat, 3 Apr 2021 00:22:42 +0000 (20:22 -0400)] 
Split ust-events-internal.h between common and liblttng-ust

Split ust-events-internal.h into a common private header containing the
types and ABI functions and a header internal to liblttng-ust containing
the declaration of the private symbols.

Change-Id: I8ec2a5c8aad9ba85557b5a727ffc3615172e375d
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove getenv to libcommon
Michael Jeanson [Tue, 6 Apr 2021 20:32:14 +0000 (16:32 -0400)] 
Move getenv to libcommon

Move it to libcommon since it can be used by any library.

Change-Id: Ic09b643e3a91b2844fe9dc13eac55fe90f8e15c2
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove getcpu.h to 'lib/lttng-ust/'
Michael Jeanson [Tue, 6 Apr 2021 16:29:36 +0000 (12:29 -0400)] 
Move getcpu.h to 'lib/lttng-ust/'

Move getcpu.h from 'common/ringbuffer' to 'lib/lttng-ust', the
implementation is there and it provides some liblttng-ust symbols to
other components unrelated to the ringbuffer.

* Namespace internal symbols for clarity
* Add comments to the code.

Change-Id: I93da098dc9f90aa6324ad1ac36eaba1c660f0f64
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoSplit the common part of clock.h
Michael Jeanson [Tue, 6 Apr 2021 20:58:57 +0000 (16:58 -0400)] 
Split the common part of clock.h

Split clock.h into an internal liblttng-ust header and a common header
to allow access to 'lttng_ust_clock_init' which is part of the private
ABI of liblttng-ust.

Change-Id: Ic23ed01201edaebecb61ff071dd1d38281ff6de8
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove wait.h to 'src/common/'
Michael Jeanson [Tue, 6 Apr 2021 20:45:50 +0000 (16:45 -0400)] 
Move wait.h to 'src/common/'

It defines a generic macro that is only currently used in
liblttng-ust-ctl.

Change-Id: I9ed217176cf261f4fc410ba1655d0e9c0bf9ff07
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoRename internal ust_err to lttng_ust_logging
Michael Jeanson [Tue, 6 Apr 2021 19:56:58 +0000 (15:56 -0400)] 
Rename internal ust_err to lttng_ust_logging

This is an internal rename to reduce confusion with the public
ust-error.h API and better describe the functionality.

Change-Id: Ifc692c724ebd7b7bd4ad234fa92b95f50d724f5a
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove liblttng-ust to 'src/lib/'
Michael Jeanson [Mon, 12 Apr 2021 19:19:23 +0000 (15:19 -0400)] 
Move liblttng-ust to 'src/lib/'

This is part of an effort to standardize our autotools setup across
projects to simplify maintenance.

Change-Id: I5df7b12202e4ba06bfb9532e8098ac80bd2073a2
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agocleanup: convenience libs at root of 'src/common/'
Michael Jeanson [Mon, 12 Apr 2021 17:40:08 +0000 (13:40 -0400)] 
cleanup: convenience libs at root of 'src/common/'

Change-Id: I6e1b4790eaceef9a1f203e82e756bbe6b85cce77
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoSplit and move compat.h to 'common/compat/'
Michael Jeanson [Sat, 3 Apr 2021 00:52:58 +0000 (20:52 -0400)] 
Split and move compat.h to 'common/compat/'

Move compat.h to 'src/common/compat/' and split it in specific compat
headers.

This is part of an effort to standardize our autotools setup across
projects to simplify maintenance.

Change-Id: Ic34ddc11acf81d0463d69e23986d83c29be9023b
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove the mmap wrapper to 'common/compat/'
Michael Jeanson [Fri, 2 Apr 2021 22:45:31 +0000 (18:45 -0400)] 
Move the mmap wrapper to 'common/compat/'

This is part of an effort to standardize our autotools setup across
projects to simplify maintenance.

Change-Id: I6fd5517793459c89fe22249ae08e844874a3a7fe
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove libustcomm to 'src/common/'
Michael Jeanson [Fri, 2 Apr 2021 23:35:53 +0000 (19:35 -0400)] 
Move libustcomm to 'src/common/'

libustcomm is an internal convience library used by both liblttng-ust
and liblttng-ust-ctl, move it to the common directory.

This is part of an effort to standardize our autotools setup across
projects to simplify maintenance.

Change-Id: I6ec03e5d4fb0f49dee4dc57ba16ee025dd1151a2
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove fd-tracker to liblttng-ust-common
Michael Jeanson [Mon, 12 Apr 2021 21:12:55 +0000 (17:12 -0400)] 
Move fd-tracker to liblttng-ust-common

The fd-tracker provides ABI symbols to liblttng-ust-ctl which shouldn't
link directy on liblttng-ust, move it to liblttng-ust-common to
accomodate this. This is in line with the goal to move the shared state
across our different libraries to ust-common.

Change-Id: I69de6a9e6eaec9599f22e47cb0292ef793f6115d
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove libringbuffer to 'src/common/'
Michael Jeanson [Fri, 2 Apr 2021 22:45:31 +0000 (18:45 -0400)] 
Move libringbuffer to 'src/common/'

This is part of an effort to standardize our autotools setup across
projects to simplify maintenance.

Change-Id: I8f19a59bd0a72970199ede1b81c5d5971d613f31
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove libcounter to 'src/common/'
Michael Jeanson [Fri, 2 Apr 2021 19:38:41 +0000 (15:38 -0400)] 
Move libcounter to 'src/common/'

This is part of an effort to standardize our autotools setup across
projects to simplify maintenance.

Change-Id: I0c42a8b6bcd99a75d24114c1a4f610982ba16057
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove liblttng-ust-ctl to 'src/lib/'
Michael Jeanson [Fri, 9 Apr 2021 19:02:15 +0000 (15:02 -0400)] 
Move liblttng-ust-ctl to 'src/lib/'

Move all public libraries under 'src/lib/'.

This is part of an effort to standardize our autotools setup across
projects to simplify maintenance.

Change-Id: I6a93f24016c38bf37e73d922a5a8a6ca2f4fa789
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove liblttng-ust-java* to 'src/lib/'
Michael Jeanson [Fri, 9 Apr 2021 18:30:00 +0000 (14:30 -0400)] 
Move liblttng-ust-java* to 'src/lib/'

Move all public libraries under 'src/lib/'.

This is part of an effort to standardize our autotools setup across
projects to simplify maintenance.

Change-Id: I98ed0e9da28c111e62b189f26b0a225b5aa500e1
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove liblttng-ust-dl to 'src/lib/'
Michael Jeanson [Fri, 9 Apr 2021 18:25:52 +0000 (14:25 -0400)] 
Move liblttng-ust-dl to 'src/lib/'

Move all public libraries under 'src/lib/'.

This is part of an effort to standardize our autotools setup across
projects to simplify maintenance.

Change-Id: I1e6a0597ed9ea79f661393a48f149a982f360d1d
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove liblttng-ust-fd to 'src/lib/'
Michael Jeanson [Fri, 9 Apr 2021 18:22:45 +0000 (14:22 -0400)] 
Move liblttng-ust-fd to 'src/lib/'

Move all public libraries under 'src/lib/'.

This is part of an effort to standardize our autotools setup across
projects to simplify maintenance.

Change-Id: I11fffd79c7f74ab602b115be94dfa28937e6ff2d
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove liblttng-ust-cyg-profile to 'src/lib/'
Michael Jeanson [Fri, 9 Apr 2021 18:17:48 +0000 (14:17 -0400)] 
Move liblttng-ust-cyg-profile to 'src/lib/'

Move all public libraries under 'src/lib/'.

This is part of an effort to standardize our autotools setup across
projects to simplify maintenance.

Change-Id: Ia06cfce8b57db814dc17ba01829e1498c4cb7aea
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove liblttng-ust-libc-wrapper to 'src/lib/'
Michael Jeanson [Fri, 9 Apr 2021 18:13:14 +0000 (14:13 -0400)] 
Move liblttng-ust-libc-wrapper to 'src/lib/'

Move all public libraries under 'src/lib/'.

This is part of an effort to standardize our autotools setup across
projects to simplify maintenance.

Change-Id: I81b23df257bbfe3490f6ee7836b93732fcfb9fb2
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove liblttng-ust-python-agent to 'src/lib/'
Michael Jeanson [Fri, 9 Apr 2021 18:04:28 +0000 (14:04 -0400)] 
Move liblttng-ust-python-agent to 'src/lib/'

Move all public libraries under 'src/lib/'.

This is part of an effort to standardize our autotools setup across
projects to simplify maintenance.

Change-Id: If0eb731cc8f7faa860153f163b57f14292b7f522
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoFix: event notifier group context leak
Mathieu Desnoyers [Tue, 13 Apr 2021 15:41:46 +0000 (11:41 -0400)] 
Fix: event notifier group context leak

The event notifier group should destroy its context when it is itself
destroyed.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I4643abac0985b5a3e1798122008f7a27c2d5c383

3 years agoFix: perf counter context: leak event field structure
Mathieu Desnoyers [Tue, 13 Apr 2021 15:14:37 +0000 (11:14 -0400)] 
Fix: perf counter context: leak event field structure

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Icbe10b546de0561fcbcb2446db68f8f7b2d66923

3 years agoDocument nested type alignment field
Mathieu Desnoyers [Mon, 12 Apr 2021 13:30:05 +0000 (09:30 -0400)] 
Document nested type alignment field

Clarify that the alignment field for structure, sequence, and array
types is a minimum alignment.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: If0f7d24742741957085742c3a68db0b964e22a67

3 years agoMove msgpack to libcommon
Michael Jeanson [Fri, 2 Apr 2021 19:29:21 +0000 (15:29 -0400)] 
Move msgpack to libcommon

msgpack provides common utils used across libraries, move it to
libcommon.

This is part of an effort to standardize our autotools setup across
projects to simplify maintenance.

Change-Id: Iaf8bb9e4504891f6072e68ac0ea24b8a13503e71
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoAdd an internal 'libcommon' for utils
Michael Jeanson [Fri, 2 Apr 2021 19:19:51 +0000 (15:19 -0400)] 
Add an internal 'libcommon' for utils

Replicate the setup in tools and create a convenience library
for internal utils. Move the 'snprintf' component to this internal lib.

This is part of an effort to standardize our autotools setup across
projects to simplify maintenance.

Change-Id: I4e8ad48eda64a093b7e169474ad454b74a237e09
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove internal headers to 'src/' dir
Michael Jeanson [Fri, 2 Apr 2021 18:45:42 +0000 (14:45 -0400)] 
Move internal headers to 'src/' dir

Move internal headers from the global 'include' directory to their
respective private directories under 'src/'. Remove the 'ust-' prefix
when appropriate as they are now included with the 'common/' path which
makes it easier to distinguish public and internal headers.

This is part of an effort to standardize our autotools setup across
projects to simplify maintenance.

Change-Id: If5510bbe9294ba1f0dcd4b101b363e7ef64e255d
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoAdd 'src' dir to global include path
Michael Jeanson [Fri, 2 Apr 2021 15:47:52 +0000 (11:47 -0400)] 
Add 'src' dir to global include path

The objective is to move internal headers from the global 'include'
directory to their respective private directories under 'src'.

Move the private generated 'config.h' to 'src/common/config.h', this way
it can be include with 'common/config.h' and reduce the risk of clashing
with a similarly named file.

This is part of an effort to standardize our autotools setup across
projects to simplify maintenance.

Change-Id: Ie62a81e46458bffb6d31af66411865f23cf1cb4f
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoMove all sources to 'src/'
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>
3 years agoFix: pass private data to context callbacks
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

3 years agoFix: app contexts: do not leak app context name, event field, context field
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

3 years agoRemove TRACEPOINT_INCLUDE_FILE undef
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

3 years agoRemove TRACEPOINT_INCLUDE_FILE macro
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

3 years agoRemove app context backward compatibility dead code
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

3 years agoCleanup: Unaligned vs aligned ring buffer access comment
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

3 years agoUpdate unaligned vs aligned ring buffer access comment
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

3 years agoRefactoring: add back constness of public API structures
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

3 years agoAdd 'ctf_unused' tracepoint field type
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>
3 years agocleanup: explicitly mark unused parameters (-Wunused-parameter)
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>
3 years agocleanup: rename template headers
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>
3 years agofix: string constants (-Wwrite-strings)
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>
3 years agofix: all functions have declarations (-Wmissing-prototypes -Wold-style-definition)
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>
3 years agocleanup: function attribute 'always_inline'
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>
3 years agocleanup: function attribute 'hidden'
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>
3 years agocleanup: function attribute 'no_instrument_function'
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>
3 years agocleanup: function attribute 'destructor'
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>
3 years agocleanup: function attribute 'constructor'
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>
3 years agocleanup: function attribute 'unused'
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>
3 years agotests: benchmark: improve benchmark scalability accuracy
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

3 years agotests: benchmark: use cpu-bound workload, calculate average and std.dev.
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

3 years agotests: improve benchmark script
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

3 years agocleanup: function attribute 'format'
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>
3 years agoFix: liblttng-ust-ctl: missing ring buffer and counter clients init/exit symbols
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

3 years agoNew API: lttng_ust_init_thread() for async-signal tracing
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

3 years agofix: redundant decl of channel_destroy (-Wredundant-decls)
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>
3 years agoFix: tls-compat with hidden ring buffer context
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

3 years agoFix: tls-compat with hidden ring buffer context
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

3 years agoRefactoring: hide internal fields of ring buffer context
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

3 years agoMove private ABI counter client symbols to dedicated header
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>
3 years agofix: add fallthrough annotations (-Wimplicit-fallthrough)
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>
3 years agofix: add format attribute to relevant functions (-Wsuggest-attribute=format)
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>
3 years agofix: use proper format specifiers in tests (-Wformat)
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>
This page took 0.044975 seconds and 4 git commands to generate.