#include "frontend.h"
#include <urcu-bp.h>
#include <urcu/compiler.h>
+#include "rseq.h"
static inline
int lib_ring_buffer_get_cpu(const struct lttng_ust_lib_ring_buffer_config *config)
unsigned long commit_count;
struct commit_counters_hot *cc_hot = shmp_index(handle,
buf->commit_hot, endidx);
+ struct lttng_rseq_state rseq_state;
+
+ if (caa_likely(ctx->ctx_len
+ >= sizeof(struct lttng_ust_lib_ring_buffer_ctx))) {
+ rseq_state = ctx->rseq_state;
+ } else {
+ rseq_state.cpu_id = -2;
+ }
if (caa_unlikely(!cc_hot))
return;
*/
cmm_smp_wmb();
+ if (caa_likely(rseq_state.cpu_id >= 0)) {
+ unsigned long newv;
+
+ newv = cc_hot->cc_rseq + ctx->slot_size;
+ if (caa_likely(__rseq_finish(NULL, 0, NULL, NULL, 0,
+ (intptr_t *)&cc_hot->cc_rseq,
+ (intptr_t) newv,
+ rseq_state, RSEQ_FINISH_SINGLE, false)))
+ goto add_done;
+ }
v_add(config, ctx->slot_size, &cc_hot->cc);
+add_done:
/*
* commit count read can race with concurrent OOO commit count updates.
* which is completely independent of the order.
*/
commit_count = v_read(config, &cc_hot->cc);
+ commit_count += cc_hot->cc_rseq;
lib_ring_buffer_check_deliver(config, buf, chan, offset_end - 1,
commit_count, endidx, handle, ctx->tsc);