Mathieu Desnoyers [Mon, 29 Jul 2024 18:24:13 +0000 (14:24 -0400)]
ust-abi: Clarify "size" field comment
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ib0c14a1014d19348a98636a9c84d45d7f306fbb5
Mathieu Desnoyers [Mon, 15 Jul 2024 21:41:32 +0000 (17:41 -0400)]
Introduce extension points for trace hit counters
Introduce two extension points for trace hit counters:
1) Future "actions" to perform other than "increment",
2) Future dimension indexing schemes (keys) other than tokens.
Ensure the LTTng-UST protocol with session daemon has those extension
points so we don't need to break ABI when we need to extend trace hit
counters with those features.
Also ensure the ABI between the tracepoint probe provider and the
tracer passes all the relevant context for future features, e.g.
tracepoint arguments and contexts.
Change the layout of struct lttng_ust_abi_counter_key_dimension
by adding a "key_type" field. A new struct lttng_ust_abi_counter_key_dimension_tokens
inherits from struct lttng_ust_abi_counter_key_dimension, and contains
the uint32_t nr_key_tokens field. The only currently supported key_type
is LTTNG_UST_ABI_KEY_TYPE_TOKENS = 0.
Change the layout of struct lttng_ust_abi_counter_event by adding an
"action" field. The only currently supported action is
LTTNG_UST_ABI_COUNTER_ACTION_INCREMENT = 0.
Change the struct lttng_ust_abi_key_token_string so it inherits from
struct lttng_ust_abi_key_token. The "len" field of
struct lttng_ust_abi_key_token now includes the length of the entire
child structure.
Change the newly introduced ABI between probe providers to change the
"event_counter_add" callback into a "counter_hit" callback, which takes
one less argument (no integer value), but takes additional stack_data,
probe_ctx, and event_counter_ctx arguments for future use.
Introduce a new LTTNG_UST_CTL_NOTIFY_CMD_KEY notification command to
separate key notifications from event notifications, given that they
require different arguments.
Revert back the register event notification to return a 32-bit event ID:
there is no point in changing the pre-existing protocol for event
registration now that key registration gets its own protocol commands.
Note that the protocol major is left at 10 even though we revert the
event ID change, because the protocol was bumped to 10 due to a
different change:
commit
f63969cc383c ("dynamic-type: remove underscore prefix from mapping names")
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I0ed00dacfdaf333ffad406f8d017ee21bcbc212b
Mathieu Desnoyers [Fri, 6 Oct 2023 15:48:01 +0000 (11:48 -0400)]
Re-introduce sync vs unsync enablers
Eliminate iteration over unmodified enablers when synchronizing the
enablers vs event state.
The intent is to turn a O(m*n) algorithm (m = number of enablers, n =
number of event probes) into a O(n) when enabling many additional events
when tracing is active.
This change is done both for event enablers and for event notifier
enablers.
[ Re-introduce commit after integration of Trace Hit Counters. ]
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I6a6ce09b10a98f281e03fab3a69b851a44bd8657
Mathieu Desnoyers [Thu, 27 Jan 2022 21:24:32 +0000 (16:24 -0500)]
Remove ctx from struct lttng_event_enabler_common
Unused (dead code).
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I6ed8453cd974738ea5c47789eb4fce196ab0b04a
Mathieu Desnoyers [Thu, 27 Jan 2022 20:36:45 +0000 (15:36 -0500)]
Remove event context dead code
The event context is never wired up by the lttng ust abi, so it is never
actually used. Remove this dead code which adds complexity for no
reason.
This code is all internal to lttng-ust (not exposed to probe providers),
which makes it easy to add this back if needed in the future.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I52e93835ffe6d3040ead7fb8d3113ab20a555019
Mathieu Desnoyers [Thu, 11 Nov 2021 19:43:56 +0000 (14:43 -0500)]
Refactoring: combine common code in lttng_event_enabler_match_event
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ifb3b81c39208b91930d07978042aaecb22556f73
Mathieu Desnoyers [Thu, 11 Nov 2021 19:36:21 +0000 (14:36 -0500)]
Refactoring: combine common code in lttng_event_enabler_event_desc_key_match_event
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Idf8594e13f6fcc25029843b0713a6393885b541e
Mathieu Desnoyers [Thu, 11 Nov 2021 19:18:06 +0000 (14:18 -0500)]
Refactoring: combine common code in lttng_event_register_to_sessiond
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I7caf97ef6acf1022632bc1258f60185562ac744f
Mathieu Desnoyers [Thu, 11 Nov 2021 19:14:06 +0000 (14:14 -0500)]
Refactoring: move event id field to lttng_ust_event_session_common_private
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ideb8da3c1003872eeba6ed3c0d5ee6cf183934e3
Mathieu Desnoyers [Thu, 11 Nov 2021 19:06:08 +0000 (14:06 -0500)]
Protocol bump from 9 to 10
Bump LTTNG_UST_ABI_MAJOR_VERSION from 9 to 10, but keep backward
compatibility unchanged (oldest compatible 8) for applications linked
against older liblttng-ust.
With this protocol bump, we can send a 64-bit "id" in the event
registration reply. We keep the 32-bit event id field for now, until we
can proceed to bump the oldest compatible major number.
The 64-bit id field is useful for events within "counter" channels, but
there is no point in keeping a 32-bit value solely for the ring buffer
channel.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ibd3da4c8156886a6d2f6555462526bb717c451dd
Mathieu Desnoyers [Tue, 9 Nov 2021 20:51:08 +0000 (15:51 -0500)]
Refactoring: combine common code into lttng_ust_event_create
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I61c52ee1bb95ac909365463f1ffd14579a45bc4b
Mathieu Desnoyers [Tue, 9 Nov 2021 20:46:24 +0000 (15:46 -0500)]
Refactoring: introduce lttng_event_enabler_event_desc_key_match_event
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ib956f6a37f967fe100b6978e36512a01a5d3ae2a
Mathieu Desnoyers [Tue, 9 Nov 2021 20:27:28 +0000 (15:27 -0500)]
Refactoring: use lttng_get_event_list_head_from_enabler in event create
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I267b9b906d5ebcb1838d792c2ef2002da7db7191
Mathieu Desnoyers [Tue, 9 Nov 2021 20:25:40 +0000 (15:25 -0500)]
Refactoring: lttng_create_all_event_enums common code
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I7ec1bb140c03f44b5e5a6171ed7c4e8ecd40655e
Mathieu Desnoyers [Tue, 9 Nov 2021 20:18:53 +0000 (15:18 -0500)]
Refactoring: event create use lttng_get_event_ht_from_enabler
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Id603e5aea5084415fe0039f5e1a116f753dcd9c8
Mathieu Desnoyers [Tue, 9 Nov 2021 20:15:47 +0000 (15:15 -0500)]
Refactoring: event create common code
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: If2c65bac6ef0f0eff478a991d92ab4b5df5f2127
Mathieu Desnoyers [Tue, 9 Nov 2021 20:02:41 +0000 (15:02 -0500)]
Refactoring: introduce lttng_event_register_to_sessiond
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I6d7e875f93119b46f18f93851922bc34db858508
Mathieu Desnoyers [Tue, 9 Nov 2021 19:40:17 +0000 (14:40 -0500)]
Refactoring: move notify socket get lower in create functions
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I7eaeab61a9ae3dbfcf64521bff90e0c40a1b2203
Mathieu Desnoyers [Tue, 9 Nov 2021 19:08:34 +0000 (14:08 -0500)]
Refactoring: cleanup event create functions
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I1523346d4dda653f0328b4f77594dca59930daa6
Mathieu Desnoyers [Tue, 9 Nov 2021 19:04:15 +0000 (14:04 -0500)]
Refactoring: common code in _lttng_event_destroy
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ia615af8efccd9dcce174d6d6c60d769c8f831c8a
Mathieu Desnoyers [Tue, 9 Nov 2021 19:00:24 +0000 (14:00 -0500)]
Refactoring: introduce lttng_ust_event_alloc and lttng_ust_event_free
Combine common event create code.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I928545cb8601ee98854772f1134340eda442c55e
Mathieu Desnoyers [Mon, 8 Nov 2021 20:48:01 +0000 (15:48 -0500)]
Refactoring: combine common code into lttng_sync_event_list
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ifd4c36c171e5dc39852cf03a47b3310faf590c49
Mathieu Desnoyers [Mon, 8 Nov 2021 20:40:21 +0000 (15:40 -0500)]
Refactoring: introduce lttng_get_event_enabled_state
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I2846d7ea3bb34bb4f256e146a17fcb96ebaa300e
Mathieu Desnoyers [Mon, 8 Nov 2021 19:44:37 +0000 (14:44 -0500)]
Refactoring: introduce lttng_event_sync_capture_state
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Iebf760863b5205b60b77cf6f3eedea17ce87faa2
Mathieu Desnoyers [Mon, 8 Nov 2021 19:41:39 +0000 (14:41 -0500)]
Refactoring: introduce lttng_event_sync_filter_state
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ia2ec1f84472358a33e7dea20709ae8b1a951c421
Mathieu Desnoyers [Mon, 8 Nov 2021 19:35:26 +0000 (14:35 -0500)]
Refactoring: combine common code into lttng_event_enabler_ref_events
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ie10c727d6cb7aa4b1def9b8e7c8f9c72f43568a4
Mathieu Desnoyers [Mon, 8 Nov 2021 19:28:28 +0000 (14:28 -0500)]
Refactoring: introduce lttng_get_event_ht_from_enabler and lttng_get_event_list_head_from_enabler
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I67c14a4345c48ef96de39e4bbb9e04a3ea07c868
Mathieu Desnoyers [Mon, 8 Nov 2021 19:28:05 +0000 (14:28 -0500)]
Refactoring: combine notifier and session-common hash table types
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Id6b25e25d58c36bf6b5675210c383106c7599d9f
Mathieu Desnoyers [Mon, 8 Nov 2021 19:14:22 +0000 (14:14 -0500)]
Refactoring: move list node to common event structure
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I3682bdcb06c6e59405595b3f2386af4eda817373
Mathieu Desnoyers [Mon, 8 Nov 2021 19:03:45 +0000 (14:03 -0500)]
Refactoring: move name_hlist_node field to common event structure
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I7f2fd11b1023215b59d8e0fdd90307fa0d92d371
Mathieu Desnoyers [Mon, 8 Nov 2021 18:47:20 +0000 (13:47 -0500)]
Refactoring: move list node to common enabler structure
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I50def09b0e70ff580df30107af6376257ae916c0
Mathieu Desnoyers [Mon, 8 Nov 2021 17:16:27 +0000 (12:16 -0500)]
Refactoring: introduce lttng_event_enabler_init_event_capture
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I777d917a7458fcacb2e6eb1e96544694d17a8045
Mathieu Desnoyers [Mon, 8 Nov 2021 17:10:22 +0000 (12:10 -0500)]
Refactoring: introduce lttng_event_enabler_init_event_filter
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I8bf69f0cfdde37bbb144c601716ac44818408f6a
Mathieu Desnoyers [Mon, 8 Nov 2021 17:01:29 +0000 (12:01 -0500)]
Refactoring: Use lttng_event_enabler_match_event for event notifier
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Iab6e75e81dbf1f6b2277b5aa05bb04418ca07b39
Mathieu Desnoyers [Mon, 8 Nov 2021 16:59:31 +0000 (11:59 -0500)]
Refactoring: combine common code into lttng_create_event_if_missing
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ica9d21e10741bb729b6e61d3284855a6480cf82e
Mathieu Desnoyers [Mon, 8 Nov 2021 16:56:13 +0000 (11:56 -0500)]
Refactoring: move duplicate check into lttng_event_notifier_create
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I4af04b27d8d548b1128b2c47f7e5d39a3c86cfb1
Mathieu Desnoyers [Mon, 8 Nov 2021 16:51:09 +0000 (11:51 -0500)]
Refactoring: combine recorder/counter common code in lttng_create_event_if_missing
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I171685dc9a7508e0c506e271bdb314e2822a2c90
Mathieu Desnoyers [Mon, 8 Nov 2021 16:48:22 +0000 (11:48 -0500)]
Refactoring: introduce lttng_ust_event_create
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I389d0fa42a129454d86a97a17c40eb759040fb51
Mathieu Desnoyers [Mon, 8 Nov 2021 16:34:30 +0000 (11:34 -0500)]
Refactoring: combine common code into lttng_event_enabler_attach_exclusion
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I2a04f627b114f0220eed2369441fc22891604d1a
Mathieu Desnoyers [Mon, 8 Nov 2021 16:32:04 +0000 (11:32 -0500)]
Refactoring: combine common code into lttng_event_enabler_attach_filter_bytecode
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I130317af55aaef3273079450b56d4218e878324e
Mathieu Desnoyers [Mon, 8 Nov 2021 16:27:22 +0000 (11:27 -0500)]
Refactoring: combine event enabler enabler/disable common code
Introduce lttng_event_enabler_sync().
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Id7c65f517dec9611f9e3b85355b47441fb082479
Mathieu Desnoyers [Thu, 21 Apr 2022 20:28:45 +0000 (16:28 -0400)]
Introduce backward compatibility protocol for error counters
Introduce the "old" counter commands at the ust and ust-ctl sides of the
communication protocol for compatibility with 2.13 lttng-ust.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I99f4a80f1e80561060cc6092c260e60128d49f3f
Mathieu Desnoyers [Thu, 14 Apr 2022 17:34:57 +0000 (13:34 -0400)]
Remove LTTNG_UST_ABI_KEY_TOKEN_STRING_LEN_MAX from ust ABI
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I4290633f4f72b1420986ab7f0dcd2eb8bb5df3c0
Mathieu Desnoyers [Thu, 14 Apr 2022 19:56:14 +0000 (15:56 -0400)]
Cleanup: combine duplicated communication error handling
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I225fe8581e0552d097d740b1272502903302002c
Mathieu Desnoyers [Thu, 14 Apr 2022 19:20:18 +0000 (15:20 -0400)]
Fix communication protocol: ensure extensibility of counter commands
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ia9f6d4f550d999a3dade435612565941ebb86d25
Mathieu Desnoyers [Wed, 13 Apr 2022 20:24:52 +0000 (16:24 -0400)]
Implement extensible LTTNG_UST_ABI_COUNTER_EVENT protocol command
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ib0414f90ab74d21e6847e79062bd7b5236e2097b
Mathieu Desnoyers [Tue, 12 Apr 2022 20:39:09 +0000 (16:39 -0400)]
Cleanup: reorganize ust-abi.h declarations
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ifaab194b0cd11bf16270ef8809d87faa7894dfba
Mathieu Desnoyers [Mon, 17 May 2021 14:27:53 +0000 (10:27 -0400)]
Implement Trace Hit Counters
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: If1f29dd64538bc5979d3e89aa5cca3be4e41046f
Mathieu Desnoyers [Wed, 28 Jul 2021 20:19:56 +0000 (16:19 -0400)]
Truncate aggregation sum to fit map bitness
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I89a77d9df897f2b1cc7bfc62dcc9e12f31e4a12b
Mathieu Desnoyers [Fri, 2 Sep 2022 20:18:43 +0000 (16:18 -0400)]
__lttng_counter_add: skip effect-less code when global_sum_step=0
Skip effect-less code in the common case where global_sum_step=0.
This saves about 1.5ns on x86-64.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I0dacb9f189c0d47dd608dbef6f4aba969a6b0a4a
Mathieu Desnoyers [Fri, 2 Sep 2022 20:13:08 +0000 (16:13 -0400)]
Fix: libcounter: __lttng_counter_add global sum step alloc vs sync mixup
The global sum step needs to be handled on per-cpu allocated counters,
not per-cpu sync.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ibd1e345713792cd224eac99128c782196b904cf6
Mathieu Desnoyers [Fri, 12 Jul 2024 15:35:41 +0000 (11:35 -0400)]
Temporarily Revert "Introduce sync vs unsync enablers"
This reverts commit
8a5c7efa50f9dce0360611b16323462c77f07321 in
preparation for merging the Trace Hit Counters feature.
This commit will be reintroduced later on top.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: If335556a1a6b285edcf0b3ff8a61ddb2831f018c
Mathieu Desnoyers [Tue, 11 Jun 2024 20:56:07 +0000 (16:56 -0400)]
Fix: test_benchmark: do not match "CPU(s) scaling MHz:"
Do not match "CPU(s) scaling MHz:" line, it breaks the script.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ifa392d018590e098dae75acef2b8265c8714c4cb
Mathieu Desnoyers [Thu, 9 May 2024 19:09:17 +0000 (15:09 -0400)]
ust-fd: Add close_range declaration
Old libc headers do not contain a declaration of close_range(). Emit our
own declaration to prevent compiler warnings.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: If6ca8193895efbb6ce1ba46e092939b8099bcff6
Mathieu Desnoyers [Thu, 2 May 2024 21:22:14 +0000 (17:22 -0400)]
Rename "tsc" to "timestamp"
Naming timestamps "TSC" or "tsc" is an historical artefact dating from
the implementation of libringbuffer, where the initial intent was to use
the x86 "rdtsc" instruction directly, which ended up not being what was
done in reality.
Rename uses of "TSC" and "tsc" to "timestamp" to clarify things and
don't require reviewers to be fluent in x86 instruction set.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I8e7e2ad9cd2d2427485fc6adbc340fccde14ca2f
Kienan Stewart [Thu, 2 May 2024 20:51:45 +0000 (16:51 -0400)]
docs: Correct GitHub URLs in lttng-ust.3
The branches follow the format `stable-X.YZ` rather than `vX.YZ`.
Furthermore, when rendering the man pages from source, the URLs were
omitted completely as the subsitution `{lttng_version}` was not
defined. This hasn't been an issue for the published HTML versions as
those are produced via a different script in the `lttng-www` project
which presumably sets the substitution properly.
Change-Id: Ib96c99df13ddf724e128f95e7ce7c74b2c10c766
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 2 May 2024 14:41:49 +0000 (10:41 -0400)]
fix: handle EINTR correctly in get_cpu_mask_from_sysfs
If the read() in get_cpu_mask_from_sysfs() fails with EINTR, the code is
supposed to retry, but the while loop condition has (bytes_read > 0),
which is false when read() fails with EINTR. The result is that the code
exits the loop, having only read part of the string.
Use (bytes_read != 0) in the while loop condition instead, since the
(bytes_read < 0) case is already handled in the loop.
Original fix in liburcu from Benjamin Marzinski <bmarzins@redhat.com>:
commit
9922f33e2986 ("fix: handle EINTR correctly in get_cpu_mask_from_sysfs")
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I885a0fb98e5a7cfb9a8bd180c8e64b20926ff58c
Mathieu Desnoyers [Wed, 20 Mar 2024 20:47:39 +0000 (16:47 -0400)]
Introduce LTTNG_UST_MAP_POPULATE_POLICY environment variable
Problem Statement
-----------------
commit
4d4838bad480 ("Use MAP_POPULATE to reduce pagefault when available")
was first introduced in tag v2.11.0 and never backported to stable
branches. Its purpose was to reduce the tracer fast-path latency caused
by handling minor page faults the first time a given application writes
to each page of the ring buffer after mapping them. The discussion
thread leading to this commit can be found here [1]. When using
LTTng-UST for diagnosing real-time applications with very strict
constraints, this added latency is unwanted.
That commit introduced the MAP_POPULATE flag when mapping the ring
buffer pages, which causes the kernel to pre-populate the page table
entries (PTE).
This has, however, unintended consequences for the following scenarios:
* Short-lived applications which write very little to the ring buffer end
up taking more time to start, because of the time it takes to
pre-populate all the ring buffer pages, even though they typically won't
be used by the application.
* Containerized workloads using cpusets will also end up having longer
application startup time than strictly required, and will populate
PTE for ring buffers of CPUs which are not present in the cpuset.
There are, therefore, two sets of irreconcilable requirements:
short-lived and containerized workloads benefit from lazily populating
the PTE, whereas real-time workloads benefit from pre-populating them.
This will therefore require a tunable environment variable that will let
the end-user choose the behavior for each application.
Solution
--------
Allow users to specify whether they want to pre-populate
shared memory pages within the application with an environment
variable.
LTTNG_UST_MAP_POPULATE_POLICY
If set, override the policy used to populate shared memory pages within the
application. The expected values are:
none
Do not pre-populate any pages, take minor faults on first access while
tracing.
cpu_possible
Pre-populate pages for all possible CPUs in the system, as listed by
/sys/devices/system/cpu/possible.
Default: none. If the policy is unknown, use the default.
Choice of the default
---------------------
Given that users with strict real-time constraints already have to setup
their tracing with specific options (see the "--read-timer"
lttng-enable-channel(3) option [2]), it makes sense that the default
is to lazily populate the ring buffer PTE, and require users with
real-time constraints to explicitly enable the pre-populate through an
environment variable.
Effect on default behavior
--------------------------
The default behavior for ring buffer PTE mapping will be changing across
LTTng-UST versions in the following way:
- 2.10 and earlier: lazily populate PTE,
- 2.11-2.13: pre-populate PTE,
- 2.14: lazily populate PTE.
LTTng-UST 2.14 will revert back to the 2.10 lazy populate scheme by
default.
[1] https://lists.lttng.org/pipermail/lttng-dev/2019-July/thread.html#29094
[2] https://lttng.org/docs/v2.13/#doc-channel-timers
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I6743b08cd1fe0d956caaf6aad63005555bb9640e
Mathieu Desnoyers [Thu, 18 Apr 2024 15:25:55 +0000 (11:25 -0400)]
Add close_range wrapper to liblttng-ust-fd.so
glibc 2.34 implements close_range(2), which is used by the ssh client
(amongst others). This needs to be overridden to make sure ssh does not
close lttng-ust file descriptors.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ic4e0046499e1f010395aec71a48316b9d1e9bf3f
Kienan Stewart [Thu, 14 Mar 2024 15:39:12 +0000 (11:39 -0400)]
docs: Add supported versions and fix-backport policy
Change-Id: I9ec43912652fc713484959e9315765f7e9d29a3e
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Kienan Stewart [Fri, 9 Feb 2024 19:48:29 +0000 (14:48 -0500)]
docs: Add cases in which tracepoints in ctors/dtors may not work
Change-Id: I52666810322e26b3841ea1bca6f588b6c3e6f3f8
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Olivier Dion [Thu, 21 Mar 2024 18:51:07 +0000 (14:51 -0400)]
ust-tracepoint-event: Add static check of sequences length type
Enforce required unsigned type for length of sequence at compile time.
Change-Id: Ia8668a80eb0c0b81e8c03b208d7581e34af313fd
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Olivier Dion [Thu, 21 Mar 2024 18:42:13 +0000 (14:42 -0400)]
lttng-ust(3): Fix wrong len_type for sequence
`len_type' of a sequence field must be of type unsigned integer. Some
provided examples in the man page were incorrectly using a type signed
integer, resulting in correct compilation, but error while decoding.
Change-Id: Icc685b330d0704660b36f703075f453d71c5e4cb
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Kienan Stewart [Fri, 9 Feb 2024 19:30:48 +0000 (14:30 -0500)]
python: log exception details when agent thread cannot start
Change-Id: If9d58f066d513f63428bbc07190a956571532655
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Kienan Stewart [Fri, 9 Feb 2024 19:18:59 +0000 (14:18 -0500)]
Fix: python lttngust agent fails when LTTNG_UST_APP_PATH is not set
Observed issue
==============
lttng-tools `tests/regression/ust/python-logging/test_python_logging`
had the following failures:
```
not ok 14 - Found 0 / 5 events matching 'python-ev-test1' amongst 0 events
not ok 27 - Found 0 / 5 events matching 'python-ev-test1' amongst 0 events
not ok 40 - Found 0 / 5 events matching 'python-ev-test1' amongst 0 events
not ok 53 - Found 0 / 5 events matching 'python-ev-test1' out of 0 events
not ok 66 - Found 0 / 1 events matching 'python-ev-test2' amongst 0 events
not ok 74 - Found 0 / 1 events matching 'python-ev-test2' amongst 0 events
not ok 82 - Found 0 / 5 events matching 'python-ev-test1' amongst 0 events
not ok 98 - Found 0 / 1 events matching 'python-ev-test2' amongst 0 events
not ok 109 - Found 0 / 5 events matching 'python-ev-test1' out of 0 events
not ok 115 - Found 0 events matching 'python-ev-test1'
not ok 121 - Found 0 / 1 events matching 'python-ev-test2' amongst 0 events
not ok 127 - Found 0 / 5 events matching 'python-ev-test1' amongst 0 events
not ok 134 - Found 0 / 10 events matching 'python-ev-test1' amongst 0 events
not ok 140 - Found 0 / 5 events matching 'python-ev-test1' amongst 0 events
not ok 146 - Found 0 / 5 events matching 'python-ev-test1' amongst 0 events
not ok 157 - Found 0 / 5 events matching 'python-ev-test1' amongst 0 events
```
Cause
=====
When the use of `LTTNG_UST_APP_PATH` was introduced[1], no default
value for `ust_app_port` was set. In the case where
`LTTNG_UST_APP_PATH` is not set in the environment the condition for
starting with the `ust_app_port` is still checked, causing the
following exception:
```
[
2559145.907503] LTTng-UST warning: _init_threads(): cannot create client threads: cannot access local variable 'ust_app_port' where it is not associated with a value
```
Solution
========
Provide a known default value for `ust_app_port`.
Known drawbacks
===============
None.
References
==========
[1]: https://github.com/lttng/lttng-ust/commit/
c0f6fb054d2f16518d047a6adf7e8aa81eff5403
Change-Id: I92242ccd056dd91505156e4e8df812639eaef570
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Kienan Stewart [Mon, 27 Nov 2023 17:02:40 +0000 (12:02 -0500)]
Add initial support for the multiple LTTNG_UST_APP_PATHs
The `$LTTNG_UST_APP_PATH` is split using ':' as a separator. There is
no provision for escaping the ':' separator.
Paths after the first path will be ignored for the moment and a
warning emitted.
Change-Id: I619a3578e00fd3c758d616b99b443fc15a1477df
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Kienan Stewart [Tue, 28 Nov 2023 19:39:23 +0000 (14:39 -0500)]
Fix java client connection path when LTTNG_UST_APP_PATH is set
When LTTNG_UST_CTL_PATH is set for `lttng-sessiond`, the agent port is
at `$LTTNG_UST_CTL_PATH/agent.port`, not
`$LTTNG_UST_CTL_PATH/.lttng/agent.port`.
Change-Id: I79419f36cbd802da06acd68f58e437b0d4eb3856
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Fri, 20 Oct 2023 19:20:45 +0000 (15:20 -0400)]
Introduce LTTNG_UST_APP_PATH environment variable
Introduce an environment to specify a path under which unix sockets
used for the communication between the application (tracee) instrumented
with `liblttng-ust` and the LTTng session and consumer daemons (part of
the LTTng-tools project) are located. When `$LTTNG_UST_APP_PATH` is
specified, only this path is considered for connecting to a session
daemon. Setting this environment variable disables connection to root
and per-user session daemons.
The `$LTTNG_UST_APP_PATH` target directory must exist and be accessible
by the user before the application is executed for tracing to work.
This environment variable affects the Java and Python agents in the same
way.
This environment variable on the LTTng-UST application side is meant to
be used with a new LTTNG_UST_CTL_PATH on the lttng sessiond side.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I4784f4565514a9771827603bd0bebabbeb37a7ad
Mathieu Desnoyers [Fri, 20 Oct 2023 18:52:05 +0000 (14:52 -0400)]
Rename "global" sock_info field to "multi_user"
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ife23f632db641e476e2e059031a2f956af4da72d
Mathieu Desnoyers [Mon, 15 Jan 2024 18:36:29 +0000 (13:36 -0500)]
Fix: libc wrapper: use initial-exec for malloc_nesting TLS
Use the initial-exec TLS model for the malloc_nesting nesting guard
variable to ensure that the glibc implementation of the TLS access don't
trigger infinite recursion by calling the memory allocator wrapper
functions, which can happen with global-dynamic.
Considering that the libc wrapper is meant to be loaded with LD_PRELOAD
anyway (never with dlopen(3)), we always expect the libc to have enough
space to hold the malloc_nesting variable.
In addition to change the malloc_nesting from global-dynamic to
initial-exec, this removes the URCU TLS compatibility layer from the
libc wrapper, which is a good thing: this compatibility layer relies
on pthread key and calloc internally, which makes it a bad fit for TLS
accesses guarding access to malloc wrappers, due to possible infinite
recursion.
Link: https://lists.lttng.org/pipermail/lttng-dev/2024-January/030697.html
Reported-by: Florian Weimer <fweimer@redhat.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I72c42bc09c1a06e2922b184b85abeb9c94200ee2
Michael Jeanson [Thu, 6 Jul 2023 18:40:01 +0000 (14:40 -0400)]
Tests: implement REUSE with SPDX identifiers
The SPDX identifiers [1] are a legally binding shorthand, which can be
used instead of the full boiler plate text. This is the first step
towards implementing the full REUSE spec [2] to help with copyright and
licensing audits and compliance.
This will reduce a lot a manual work required for the licensing audit
required in Debian on each update.
For files that lacked copyright and licensing information, I used the
following guidelines. If a clear author could be determined from the git
history use it, otherwise use 'EfficiOS Inc.'. For build system files,
use 'MIT', for documentation 'CC-BY-4.0' and for data files 'CC0-1.0'.
Freeform text files were converted to Markdown to allow licensing
comments.
[1] https://spdx.org/ids-how
[2] https://reuse.software/tutorial/
Change-Id: I3c391f15d97b5958bdfacc17eb4ab2abafd9d99d
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Thu, 6 Jul 2023 18:40:15 +0000 (14:40 -0400)]
doc: implement REUSE with SPDX identifiers
The SPDX identifiers [1] are a legally binding shorthand, which can be
used instead of the full boiler plate text. This is the first step
towards implementing the full REUSE spec [2] to help with copyright and
licensing audits and compliance.
This will reduce a lot a manual work required for the licensing audit
required in Debian on each update.
For files that lacked copyright and licensing information, I used the
following guidelines. If a clear author could be determined from the git
history use it, otherwise use 'EfficiOS Inc.'. For build system files,
use 'MIT', for documentation 'CC-BY-4.0' and for data files 'CC0-1.0'.
Freeform text files were converted to Markdown to allow licensing
comments.
[1] https://spdx.org/ids-how
[2] https://reuse.software/tutorial/
Change-Id: Idc57357d401c4efac4d0c641108607236fa8ecd4
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Thu, 6 Jul 2023 18:40:39 +0000 (14:40 -0400)]
include: implement REUSE with SPDX identifiers
The SPDX identifiers [1] are a legally binding shorthand, which can be
used instead of the full boiler plate text. This is the first step
towards implementing the full REUSE spec [2] to help with copyright and
licensing audits and compliance.
This will reduce a lot a manual work required for the licensing audit
required in Debian on each update.
For files that lacked copyright and licensing information, I used the
following guidelines. If a clear author could be determined from the git
history use it, otherwise use 'EfficiOS Inc.'. For build system files,
use 'MIT', for documentation 'CC-BY-4.0' and for data files 'CC0-1.0'.
Freeform text files were converted to Markdown to allow licensing
comments.
[1] https://spdx.org/ids-how
[2] https://reuse.software/tutorial/
Change-Id: Ie6e7d801e879f78ee34361c2327338ac8b60c92b
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Thu, 6 Jul 2023 18:40:50 +0000 (14:40 -0400)]
src: implement REUSE with SPDX identifiers
The SPDX identifiers [1] are a legally binding shorthand, which can be
used instead of the full boiler plate text. This is the first step
towards implementing the full REUSE spec [2] to help with copyright and
licensing audits and compliance.
This will reduce a lot a manual work required for the licensing audit
required in Debian on each update.
For files that lacked copyright and licensing information, I used the
following guidelines. If a clear author could be determined from the git
history use it, otherwise use 'EfficiOS Inc.'. For build system files,
use 'MIT', for documentation 'CC-BY-4.0' and for data files 'CC0-1.0'.
Freeform text files were converted to Markdown to allow licensing
comments.
[1] https://spdx.org/ids-how
[2] https://reuse.software/tutorial/
Change-Id: I5bebf12931a64f29fa84ee3947b165d0624db13a
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Kienan Stewart [Wed, 6 Dec 2023 18:37:47 +0000 (13:37 -0500)]
fix: invoke MKDIR_P before changing directories
In autoconf < 2.72d `AC_PROG_MKDIR_P` may fall back to using
`install-sh` and that may be referenced as a relative path.
To avoid issues with relative paths causing the command to not be
found, the build directories are created before changing the working
directory.
One way to to test the behaviour prior to this commit is to configure
the build similar to the following:
./configure MKDIR_P="$(realpath --relative-to="$(pwd)" \
$(command -v mkdir))" BUILD_EXAMPLES_FROM_TREE=1
Fixes https://bugs.lttng.org/issues/1404
Change-Id: I2d66254cd8c208f9236d55c6ef1b83c580560c7c
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Kienan Stewart [Fri, 24 Nov 2023 14:12:37 +0000 (09:12 -0500)]
docs: Update contributing guide
Indicate that Gerrit (https://review.lttng.org) is the principal place
where patches are submitted and reviewed, rather than the mailing list.
Based on feedback received on the mailing list:
https://lists.lttng.org/pipermail/lttng-dev/2023-November/030670.html
Change-Id: I3543659b0d02ecd672f2c8a45d23975c271628f9
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Thu, 6 Jul 2023 16:03:04 +0000 (12:03 -0400)]
Build system: implement REUSE with SPDX identifiers
The SPDX identifiers [1] are a legally binding shorthand, which can be
used instead of the full boiler plate text. This is the first step
towards implementing the full REUSE spec [2] to help with copyright and
licensing audits and compliance.
This will reduce a lot a manual work required for the licensing audit
required in Debian on each update.
For files that lacked copyright and licensing information, I used the
following guidelines. If a clear author could be determined from the git
history use it, otherwise use 'EfficiOS Inc.'. For build system files,
use 'MIT', for documentation 'CC-BY-4.0' and for data files 'CC0-1.0'.
Freeform text files were converted to Markdown to allow licensing
comments.
[1] https://spdx.org/ids-how
[2] https://reuse.software/tutorial/
Change-Id: I75f6120ff1241e1f6ea5aac44cd87c89d7fd21e3
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Tue, 25 Apr 2023 13:22:14 +0000 (09:22 -0400)]
Disallow building static librairies
We don't officialy support static linking the LTTng-UST tracer, however
the autotools build system still allows building static libraries.
Make it impossible to build static libraries without modifying the
configure.ac script to make it explicit.
Adding support for static linking would require a lot of additional
testing an also for applications to explicitly call the library
constructor.
Change-Id: I55d7d9db9fa9c8623305901d085aef1a33286f28
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Thu, 14 Dec 2023 15:46:56 +0000 (10:46 -0500)]
fix: -Wsingle-bit-bitfield-constant-conversion with clang16
We get the following warning with Clang 16:
lttng-ust-abi.c:558:38: warning: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
lttng_chan_buf->priv->parent.tstate = 1;
My understanding is that there is no bug because we only check if the
values are zero or not, so we can silence the warning by making the
variables unsigned.
Change-Id: Ic4e02164d5adf4271fa24e5b13e5d320ae19de2e
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Fri, 20 Oct 2023 15:57:20 +0000 (11:57 -0400)]
Revert "Add support for LTTNG_UST_HOME"
This reverts commit
90d125c709f566f3663bf84677f100134cc618e0.
After discussion with Jeremie, we want to introduce two (not one)
environment variables:
- LTTNG_UST_APP_PATH,
- LTTNG_UST_CTL_PATH.
to accomodate use-cases where a sessiond within a container is traced by
a sessiond in the parent container. In that situation, we want the
sessiond in the parent container to access the tracee through the
LTTNG_UST_CTL_PATH, without making the unix sockets for tracing control
visible to the child container.
Therefore, remove the LTTNG_UST_HOME environment variable before it is
added into an official release.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Fri, 20 Oct 2023 15:56:58 +0000 (11:56 -0400)]
Revert "Cleanup: remove leftover comment"
This reverts commit
5c0cb615bd9744f061ea318f829e0aa147b05958.
Will also revert "Add support for LTTNG_UST_HOME" in a follow up revert.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 19 Oct 2023 17:56:44 +0000 (13:56 -0400)]
Cleanup: remove leftover comment
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ifd2ead39c7d7ebe9d50ec20b834c81cd4caa5e1d
Michael Jeanson [Tue, 17 Oct 2023 19:02:44 +0000 (15:02 -0400)]
fix: clean java inner class files in examples
Java classes that contain inner classes will result in additional class
files being created when compiled in the form of
'Class$InnerClass.class'. Expand the clean target to delete those
additional files.
Change-Id: I0ed7939dcaefa5ca26db9438f7a9b34e57d78f21
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 19 Oct 2023 17:34:06 +0000 (13:34 -0400)]
Cleanup: remove whitespaces at EOL in lttng-ust.pc.in
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I1da0f8291929c6638bea44748e6e223ba32b36dc
Jonathan Rajotte [Tue, 28 Sep 2021 21:47:31 +0000 (17:47 -0400)]
Add support for LTTNG_UST_HOME
Namespacing the LTTNG_HOME env variable facilitates the work carried to
have a way to trace the tracer (lttng-sessiond). This also fits with
the work done lately to namespace lttng-ust.
The LTTNG_HOME environment variable is used by lttng-sessiond to setup
the whole tracing environment for the application to be traced. When
lttng-ust is loaded by the lttng-sessiond to be traced, the fact that it
reuse the `LTTNG_HOME` set for the lttng-sessiond prevent us from
specifying an external lttng-sessiond home.
Albeit it could be possible for the lttng-sessiond to "trace" itself
(self tracing), it make more sense, in our testing environment, to have
a supplementary lttng-sessiond handling the tracing of the
lttng-sessiond under testing.
Note that some work will be carried to limit the use of LTTNG_HOME to
setup the tracing environment by lttng-sessiond and liblttng-ctl APIs
but it will be a long effort. Providing `LTTNG_UST_HOME` allows us to
start dogfooding today.
`LTTNG_HOME` is still used as a fallback to `LTTNG_UST_HOME` to preserve
backward compatibility.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I6aed21fd70d1b79b6768d237f59cc80612938d65
Kienan Stewart [Wed, 11 Oct 2023 14:28:40 +0000 (10:28 -0400)]
Log path used in connection attempts
Motivated by feedback on the lttng-dev mailing list that a user couldn't
find the socket path used when debugging connection issues of their
UST application.
Refs https://bugs.lttng.org/issues/1393
Change-Id: I42c8bb9ae372683a16f176caf87ac394f816955e
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Fri, 6 Oct 2023 15:48:01 +0000 (11:48 -0400)]
Introduce sync vs unsync enablers
Eliminate iteration over unmodified enablers when synchronizing the
enablers vs event state.
The intent is to turn a O(m*n) algorithm (m = number of enablers, n =
number of event probes) into a O(n) when enabling many additional events
when tracing is active.
This change is done both for event enablers and for event notifier
enablers.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ifdadbafbf899ce5f3c5f8eb22409ac0c4af3139c
Jérémie Galarneau [Wed, 27 Sep 2023 13:41:04 +0000 (09:41 -0400)]
Fix: misaligned urcu reader accesses
Running the LTTng-tools tests (test_valid_filter, for example) under
address sanitizer results in the following warning:
/usr/include/lttng/urcu/static/urcu-ust.h:155:6: runtime error: member access within misaligned address 0x7fc45db3a020 for type 'struct lttng_ust_urcu_reader', which requires 128 byte alignment
0x7fc45db3a020: note: pointer points here
c4 7f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
While the node member of lttng_ust_urcu_reader has an "aligned"
attribute of CAA_CACHE_LINE_SIZE, the compiler can't ensure the
alignment of members for dynamically allocated instances.
The `data` pointer is changed from char* to struct
lttng_ust_urcu_reader*, allowing the compiler to enforce the expected
alignment constraints.
Since `data` was addressed in bytes, the code using this field is
adapted to use element counts. As the chunks are only used to allocate
reader instances (and not other types), it makes the code a bit easier
to read.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ic826cf94444681bea3a192d3a9f4262a0961e948
Olivier Dion [Tue, 22 Aug 2023 15:28:36 +0000 (11:28 -0400)]
ustfork: Initialize libc pointers in constructor
Instead of resolving individual libc functions lazily at their call
site, resolve every libc functions in a global constructor. This improve
error reporting for the user, by only emiting a single warning for each
failed symbol lookup.
Change-Id: I47504846e44a68366870b983ff556158e634cf83
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Olivier Dion [Tue, 15 Aug 2023 14:47:06 +0000 (10:47 -0400)]
ustfork: Fix warning about volatile qualifier
Clang is strict about the volatile qualifier on function pointers. It
also wants pointers to be passed to atomic builtins, even for
functions. Therefore, use the addresses of function pointers even if
unnecessary according to C standard.
Change-Id: I5d553a46671cc4bfbe8de5cec2425201459f60d2
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Olivier Dion [Wed, 9 Aug 2023 21:35:40 +0000 (17:35 -0400)]
ustfork: Fix possible race conditions
Assuming that `dlsym(RTLD_NEXT, "symbol")' is invariant for "symbol",
then we could think that memory operations on the `plibc_func' pointers can
be safely done without atomics.
However, consider what would happen if a load to a`plibc_func' pointer
is torn apart by the compiler. Then a thread could see:
1) NULL
2) The stored value as returned by a dlsym() call
3) A mix of 1) and 2)
The same goes for other optimizations that a compiler is authorized to
do (e.g. store tearing, load fusing).
One could question whether such race condition is even possible for the
clone(2) wrapper. Indeed, a thread must be cloned to get into
existence. Therefore, the main thread would always store the value of
`plibc_func' at least once before creating the first sibling thread,
preventing any possible race condition for this wrapper. However, this
assume that the main thread will not call the clone system call directly
before calling the libc wrapper! Thus, to be on the safe side, we do the
same for the clone wrapper.
Fix the race conditions by using the uatomic_read/uatomic_set functions,
on access to `plibc_func' pointers.
Change-Id: Ic4be25983b8836d2b333f367af9c18d2f6b75879
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Wed, 21 Jun 2023 19:36:49 +0000 (15:36 -0400)]
Fix: tracepoint: Remove trailing \ at the end of macro
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ia6dba969704d64d0e31f7d6b3667996101c50f70
Michael Jeanson [Wed, 14 Jun 2023 20:27:39 +0000 (16:27 -0400)]
Show python agent install output in verbose builds
When running 'make V=1' print the output of the python agent install
command to help with debugging.
Change-Id: I1c34f1c4302b914fa4c75fbdfbe8527886652565
Signed-off-by: Michael Jeanson <mjeanson@debian.org>
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Wed, 14 Jun 2023 20:55:28 +0000 (16:55 -0400)]
fix: python agent: use stdlib distutils when setuptools is installed
When the setuptools package is installed, it monkey patches the standard
library distutils even if the user code doesn't import setuptools.
This results in a failure to install the python agent in a directory
which ins't in the current PYTHONPATH. To allow this setuptools requires
the '--single-version-externally-managed' options which is not
implemented in distutils.
To resolve this, force the use of distutils for python < 3.12 even when
setuptools is installed with the 'SETUPTOOLS_USE_DISTUTILS' environment
variable and use the proper setuptools option with python >= 3.12 which
doesn't include distutils anymore.
Change-Id: Idf477ca61bed460c9f6be7f481fe3b84624f328c
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Wed, 14 Jun 2023 19:58:32 +0000 (15:58 -0400)]
fix: python agent: install on Debian python >= 3.10
Starting with Debian's Python 3.10, the default install scheme is
'posix_local' which is a Debian specific scheme based on 'posix_prefix'
but with an added 'local' prefix. This is the default so users doing
system wide manual installations of python modules end up in
'/usr/local'. This interferes with our autotools based install which
already defaults to '/usr/local' and expect a provided prefix to be used
verbatim.
Monkeypatch sysconfig to override this scheme and use 'posix_prefix' instead.
Change-Id: I08fe77b6c8807515765e3ad0344aa6849e573b90
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Wed, 14 Jun 2023 20:21:32 +0000 (16:21 -0400)]
fix: python agent: Add a dependency on generated files
This allows files to be regenerated at build time if the template was
modified since the last build.
Change-Id: I2f98d6b726552efd91719ada9637d2fc2909fbb3
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Michael Jeanson [Tue, 13 Jun 2023 15:40:20 +0000 (11:40 -0400)]
python: use setuptools with python >= 3.12
Since 'distutils' will be removed in Python 3.12, use setuptools instead
to build the python agent.
See https://peps.python.org/pep-0632/
Change-Id: I101f0ce0ecd9bd8c198eb2a8d4dd535a46c7a0a0
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Jérémie Galarneau [Thu, 30 Mar 2023 18:56:15 +0000 (14:56 -0400)]
Fix: segmentation fault on filter interpretation in "switch" mode
When building the interpreter with `INTERPRETER_USE_SWITCH`, I get the
following crash when interpreting a bytecode:
Program terminated with signal SIGSEGV, Segmentation fault.
(gdb) bt
#0 0x00007f5789aee443 in lttng_bytecode_interpret (ust_bytecode=0x555dfe90a650, interpreter_stack_data=0x7ffd12615500 "", probe_ctx=0x7ffd12615620,
caller_ctx=0x7ffd126154bc) at lttng-bytecode-interpreter.c:885
#1 0x00007f5789af4da2 in lttng_ust_interpret_event_filter (event=0x555dfe90a580, interpreter_stack_data=0x7ffd12615500 "", probe_ctx=0x7ffd12615620,
event_filter_ctx=0x0) at lttng-bytecode-interpreter.c:2548
#2 0x0000555dfe02d2d4 in lttng_ust__event_probe__tp___the_string (__tp_data=0x555dfe90a580, i=0, arg_i=2, str=0x7ffd12617cfa "hypothec") at ././tp.h:16
#3 0x0000555dfe02cac0 in lttng_ust_tracepoint_cb_tp___the_string (str=0x7ffd12617cfa "hypothec", arg_i=2, i=0)
at /tmp/lttng-master/src/lttng-tools/tests/utils/testapp/gen-ust-nevents-str/tp.h:16
#4 main (argc=39, argv=0x7ffd12615818) at gen-ust-nevents-str.cpp:38
This appears to be caused by `bytecode->data` being used to determine
the `start_pc` address. In my case, `data` is NULL. A quick look around
the code seems to show that this member is not used except during the
transmission of the bytecode.
I am basing the fix on the implementation of START_OP in the default
case which uses `code` in lieu of `data` and can confirm that it fixes
the crash on my end.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I0773df385b8e90728b60503016dec4b46d902234
Jérémie Galarneau [Thu, 16 Mar 2023 16:17:23 +0000 (12:17 -0400)]
Fix: `ip` context is expressed as a base-10 field
The base for UST context field `ip` was changed from 16 (hexadecimal) to
10 (decimal), most likely an unintentional copy&paste error in
4e48b5d.
Base 16 is more common for addresses, hence this change should probably
be reverted.
Reported-by: Thomas Gatterweh <thomas.gatterweh@siemens.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ibb28a4768e99e1089577babf2fd74476ae367a89
Mathieu Desnoyers [Wed, 8 Mar 2023 21:18:21 +0000 (16:18 -0500)]
Fix: c99: use __asm__ __volatile__
Allow building with -std=c99 by using __asm__ __volatile__ rather than
asm volatile.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I7d81d34e62c37f417b7d6deeec432e8794abf345
This page took 0.047505 seconds and 4 git commands to generate.