Use rseq for commit counter
[lttng-ust.git] / include / lttng / ringbuffer-config.h
index 87344c94c8285f94b296f318ae58880dedcc7a39..2d9f73c697647341c478d32981d8b1ad27336161 100644 (file)
@@ -216,6 +216,13 @@ struct lttng_ust_lib_ring_buffer_config {
        char padding[LTTNG_UST_RING_BUFFER_CONFIG_PADDING];
 };
 
+/* State returned by rseq_start, passed as argument to rseq_finish. */
+struct lttng_rseq_state {
+       volatile struct rseq *rseqp;
+       int32_t cpu_id;         /* cpu_id at start. */
+       uint32_t event_counter; /* event_counter at start. */
+};
+
 /*
  * ring buffer context
  *
@@ -228,7 +235,7 @@ struct lttng_ust_lib_ring_buffer_config {
  * removed.
  */
 #define LTTNG_UST_RING_BUFFER_CTX_PADDING      \
-               (24 - sizeof(int) - sizeof(void *))
+               (24 - sizeof(int) - sizeof(void *) - sizeof(void *))
 struct lttng_ust_lib_ring_buffer_ctx {
        /* input received by lib_ring_buffer_reserve(), saved here. */
        struct channel *chan;           /* channel */
@@ -256,9 +263,23 @@ struct lttng_ust_lib_ring_buffer_ctx {
                                         */
        uint64_t tsc;                   /* time-stamp counter value */
        unsigned int rflags;            /* reservation flags */
-       unsigned int padding1;          /* padding to realign on pointer */
+       /*
+        * The field ctx_len is the length of struct
+        * lttng_ust_lib_ring_buffer_ctx as known by the user of
+        * lib_ring_buffer_ctx_init.
+        */
+       unsigned int ctx_len;
        void *ip;                       /* caller ip address */
+       void *priv2;                    /* 2nd priv data */
        char padding2[LTTNG_UST_RING_BUFFER_CTX_PADDING];
+       /*
+        * This is the end of the initial fields expected by the original ABI
+        * between probes and UST. Only the fields above can be used if
+        * ctx_len is 0. Use the value of ctx_len to find out which of the
+        * following fields may be used.
+        */
+       struct lttng_ust_lib_ring_buffer_backend_pages *backend_pages;
+       struct lttng_rseq_state rseq_state;
 };
 
 /**
@@ -274,12 +295,14 @@ static inline lttng_ust_notrace
 void lib_ring_buffer_ctx_init(struct lttng_ust_lib_ring_buffer_ctx *ctx,
                              struct channel *chan, void *priv,
                              size_t data_size, int largest_align,
-                             int cpu, struct lttng_ust_shm_handle *handle);
+                             int cpu, struct lttng_ust_shm_handle *handle,
+                             void *priv2);
 static inline
 void lib_ring_buffer_ctx_init(struct lttng_ust_lib_ring_buffer_ctx *ctx,
                              struct channel *chan, void *priv,
                              size_t data_size, int largest_align,
-                             int cpu, struct lttng_ust_shm_handle *handle)
+                             int cpu, struct lttng_ust_shm_handle *handle,
+                             void *priv2)
 {
        ctx->chan = chan;
        ctx->priv = priv;
@@ -288,9 +311,13 @@ void lib_ring_buffer_ctx_init(struct lttng_ust_lib_ring_buffer_ctx *ctx,
        ctx->cpu = cpu;
        ctx->rflags = 0;
        ctx->handle = handle;
-       ctx->padding1 = 0;
+       ctx->ctx_len = sizeof(struct lttng_ust_lib_ring_buffer_ctx);
        ctx->ip = 0;
+       ctx->priv2 = priv2;
        memset(ctx->padding2, 0, LTTNG_UST_RING_BUFFER_CTX_PADDING);
+       ctx->rseq_state.rseqp = NULL;
+       ctx->rseq_state.cpu_id = -1;
+       ctx->rseq_state.event_counter = 0;
 }
 
 /*
This page took 0.02777 seconds and 5 git commands to generate.