Skip to content

Commit

Permalink
Added support for master branches of lttng
Browse files Browse the repository at this point in the history
  • Loading branch information
Kerilk committed Oct 18, 2023
1 parent 5b0c91d commit 480a66a
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 0 deletions.
88 changes: 88 additions & 0 deletions packages/lttng-tools/71540e4.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
From 71540e46aef1da5595b817563ee231c6a3aae3df Mon Sep 17 00:00:00 2001
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Date: Sat, 14 Oct 2023 09:36:58 -0400
Subject: [PATCH] consumer: Fix discarded events aggregation

- Print error message if overflow is detected on 64-bit,
- Do not update the channel counter if overflow is detected on 64-bit,
so the situation can be recovered on the next aggregation if it was
caused by a spurious race condition,
- Change (1ULL << (CAA_BITS_PER_LONG - 1)) for (1ULL << 32), thus fixing
an off-by-one in the shift on 32-bit.
- Use an explicit shift of 32 rather than CAA_BITS_PER_LONG to eliminate
too-large shift warnings on 64-bit.

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

diff --git a/src/common/consumer/consumer-stream.cpp b/src/common/consumer/consumer-stream.cpp
index 0742c86..2801f1d 100644
--- a/src/common/consumer/consumer-stream.cpp
+++ b/src/common/consumer/consumer-stream.cpp
@@ -77,13 +77,42 @@
consumer_stream_data_assert_locked_all(stream);
}

+static void aggregate_discarded_events(uint64_t *_chan_discarded_events,
+ uint64_t *_stream_last_discarded_events,
+ uint64_t stream_discarded_events)
+{
+ uint64_t stream_last_discarded_events = *_stream_last_discarded_events;
+ uint64_t stream_delta = 0;
+
+ if (stream_discarded_events < stream_last_discarded_events) {
+ if (CAA_BITS_PER_LONG >= 64) {
+ ERR("Unexpected events discarded counter 64-bit overflow: prev = %" PRIu64 " current = %" PRIu64,
+ stream_last_discarded_events, stream_discarded_events);
+ /*
+ * Unexpected counter overflow: don't update the counter,
+ * so if this is caused by a race condition, we can
+ * recover on the next aggregation.
+ */
+ return;
+ } else {
+ /*
+ * A 32-bit overflow is detected. We assume only one
+ * wrap-around has occurred.
+ */
+ stream_delta += 1ULL << 32;
+ }
+ }
+ stream_delta += stream_discarded_events - stream_last_discarded_events;
+ *_chan_discarded_events += stream_delta;
+ *_stream_last_discarded_events = stream_discarded_events;
+}
+
/* Only used for data streams. */
static int consumer_stream_update_stats(struct lttng_consumer_stream *stream,
const struct stream_subbuffer *subbuf)
{
int ret = 0;
uint64_t sequence_number;
- const uint64_t discarded_events = subbuf->info.data.events_discarded;

if (!subbuf->info.data.sequence_number.is_set) {
/* Command not supported by the tracer. */
@@ -111,18 +140,9 @@
goto end;
}
stream->last_sequence_number = sequence_number;
-
- if (discarded_events < stream->last_discarded_events) {
- /*
- * Overflow has occurred. We assume only one wrap-around
- * has occurred.
- */
- stream->chan->discarded_events += (1ULL << (CAA_BITS_PER_LONG - 1)) -
- stream->last_discarded_events + discarded_events;
- } else {
- stream->chan->discarded_events += discarded_events - stream->last_discarded_events;
- }
- stream->last_discarded_events = discarded_events;
+ aggregate_discarded_events(&stream->chan->discarded_events,
+ &stream->last_discarded_events,
+ subbuf->info.data.events_discarded);
ret = 0;

end:
11 changes: 11 additions & 0 deletions packages/lttng-tools/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,34 @@ class LttngTools(AutotoolsPackage):

homepage = "https://lttng.org"
url = "https://lttng.org/files/lttng-tools/lttng-tools-2.12.0.tar.bz2"
git = "https://github.com/lttng/lttng-tools.git"

maintainers = ['Kerilk']

version('master', branch='master')
version('2.13.9', sha256='8d94dc95b608cf70216b01203a3f8242b97a232db2e23421a2f43708da08f337')
version('2.12.11', sha256='40a394400aa751231116602a0a53f6943237c56f25c53f422b5b4b38361b96b8')
version('2.12.0', sha256='405661d27617dc79a42712174a051a45c7ca12d167576c0d93f2de708ed29445')
version('2.11.3', sha256='d7e50f5fe3782e4d2d95ed7021c11a703ab8a3272d8473e0bdb4e37c1990a2c2')
version('2.10.11', sha256='3cb7341d2802ba154f6863c5c20368f8273173ab7080c3ae1ae7180ac7a6f8c5')

depends_on('lttng-ust@master', when='@master')
depends_on('lttng-ust@2.13.0:2.13.999', when='@2.13')
depends_on('lttng-ust@2.12.0:2.12.999', when='@2.12')
depends_on('lttng-ust@2.11.0:2.11.999', when='@2.11')
depends_on('lttng-ust@2.10.0:2.10.999', when='@2.10')

depends_on('asciidoc@8.6.8:', type='build')
depends_on('xmlto@0.0.25:', type='build')
depends_on('autoconf', type='build')
depends_on('automake', type='build')
depends_on('libtool', type='build')
depends_on('libuuid')
depends_on('popt@1.13:')
depends_on('userspace-rcu@0.14.0:', when='@2.14:')
depends_on('userspace-rcu@0.11.0:', when='@2.11:')
depends_on('userspace-rcu@0.9.0:', when='@:2.10.999')
depends_on('libxml2@2.7.6:')
depends_on('pkg-config')

patch('71540e4.diff', when='@2.14:')
8 changes: 8 additions & 0 deletions packages/lttng-ust/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ class LttngUst(AutotoolsPackage):

homepage = "https://lttng.org"
url = "https://lttng.org/files/lttng-ust/lttng-ust-2.12.0.tar.bz2"
git = "https://github.com/lttng/lttng-ust.git"

maintainers = ['Kerilk']

version('master', branch='master')
version('2.13.6', sha256='e7e04596dd73ac7aa99e27cd000f949dbb0fed51bd29099f9b08a25c1df0ced5')
version('2.12.4', sha256='2124da2003a921f5da86c9aec00b897b5bbc006b0110a3ab29f1c1bc1c073f86')
version('2.12.0', sha256='1983edb525f3f27e3494088d8d5389b4c71af66bbfe63c6f1df2ad95aa44a528')
Expand All @@ -23,6 +25,12 @@ class LttngUst(AutotoolsPackage):
patch('1f41dc0.diff', when='@2.13.4:2.13.6')
patch('55cca69.diff', when='@2.13.4:')

depends_on('asciidoc@8.6.8:', type='build')
depends_on('xmlto@0.0.25:', type='build')
depends_on('autoconf', type='build')
depends_on('automake', type='build')
depends_on('libtool', type='build')
depends_on('userspace-rcu@0.14.0:', when='@2.14:')
depends_on('userspace-rcu@0.12:', when='@2.13:')
depends_on('userspace-rcu@0.11:', when='@:2.12.999')
depends_on('numactl')
Expand Down

0 comments on commit 480a66a

Please sign in to comment.