Fix: sample discarded events count before reserve
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 10 Mar 2022 19:20:47 +0000 (14:20 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 11 Mar 2022 16:41:39 +0000 (11:41 -0500)
commitc0733f3f7f5bbc385da24f6f9f5a4bcc7c38b093
treef6088322a458f6dc93a68655b7e7f66397ad5910
parentd2d1509095063944a7354e25ecbe0fd6a11c1ee4
Fix: sample discarded events count before reserve

Sampling the discarded events count in the buffer_end callback is done
out of order, and may therefore include increments performed by following
events (in following packets) if the thread doing the end-of-packet
event write is interrupted for a long time.

Sampling the event discarded counts before reserving space for the last
event in a packet, and keeping this as part of the private ring buffer
context, should fix this race.

In lttng-modules, this scenario would only happen if an interrupt
handler produces many events, when nested over an event between its
reserve and commit. Note that if lttng-modules supports faultable
tracepoints in the future, this may become more easy to trigger due to
preemption.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I696a206b3926fc1abbee35caa9af65461ff56c68
include/ringbuffer/config.h
include/ringbuffer/frontend.h
include/ringbuffer/frontend_api.h
include/ringbuffer/frontend_internal.h
src/lib/ringbuffer/ring_buffer_frontend.c
src/lttng-ring-buffer-client.h
src/lttng-ring-buffer-event-notifier-client.h
src/lttng-ring-buffer-metadata-client.h
This page took 0.02781 seconds and 4 git commands to generate.