lttng-ust:master

Last commit made on 2024-04-23
Get this branch:
git clone -b master https://git.launchpad.net/lttng-ust

Branch merges

Branch information

Name:
master
Repository:
lp:lttng-ust

Recent commits

97572c0... by Mathieu Desnoyers

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 <email address hidden>
Change-Id: I6743b08cd1fe0d956caaf6aad63005555bb9640e

4b01076... by Mathieu Desnoyers

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 <email address hidden>
Change-Id: Ic4e0046499e1f010395aec71a48316b9d1e9bf3f

9c3f3d0... by Kienan Stewart <email address hidden>

docs: Add supported versions and fix-backport policy

Change-Id: I9ec43912652fc713484959e9315765f7e9d29a3e
Signed-off-by: Kienan Stewart <email address hidden>
Signed-off-by: Mathieu Desnoyers <email address hidden>

4ce8959... by Kienan Stewart <email address hidden>

docs: Add cases in which tracepoints in ctors/dtors may not work

Change-Id: I52666810322e26b3841ea1bca6f588b6c3e6f3f8
Signed-off-by: Kienan Stewart <email address hidden>
Signed-off-by: Mathieu Desnoyers <email address hidden>

2e8e974... by Olivier Dion <email address hidden>

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 <email address hidden>
Signed-off-by: Mathieu Desnoyers <email address hidden>

7aa0de3... by Olivier Dion <email address hidden>

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 <email address hidden>
Signed-off-by: Mathieu Desnoyers <email address hidden>

26639d0... by Kienan Stewart <email address hidden>

python: log exception details when agent thread cannot start

Change-Id: If9d58f066d513f63428bbc07190a956571532655
Signed-off-by: Kienan Stewart <email address hidden>
Signed-off-by: Mathieu Desnoyers <email address hidden>

2dbe84f... by Kienan Stewart <email address hidden>

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 <email address hidden>
Signed-off-by: Mathieu Desnoyers <email address hidden>

3287f48... by Kienan Stewart <email address hidden>

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 <email address hidden>
Signed-off-by: Mathieu Desnoyers <email address hidden>

47fa3e4... by Kienan Stewart <email address hidden>

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 <email address hidden>
Signed-off-by: Mathieu Desnoyers <email address hidden>