Move alignment into event write callback
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 7 May 2021 18:33:58 +0000 (14:33 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 11 May 2021 19:14:55 +0000 (15:14 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I7563cdd07163fc22e2269627879a83e871c4eb01

48 files changed:
include/lttng/events.h
include/lttng/tracepoint-event-impl.h
src/lttng-context-callstack-legacy-impl.h
src/lttng-context-callstack-stackwalk-impl.h
src/lttng-context-cgroup-ns.c
src/lttng-context-cpu-id.c
src/lttng-context-egid.c
src/lttng-context-euid.c
src/lttng-context-gid.c
src/lttng-context-hostname.c
src/lttng-context-interruptible.c
src/lttng-context-ipc-ns.c
src/lttng-context-migratable.c
src/lttng-context-mnt-ns.c
src/lttng-context-need-reschedule.c
src/lttng-context-net-ns.c
src/lttng-context-nice.c
src/lttng-context-perf-counters.c
src/lttng-context-pid-ns.c
src/lttng-context-pid.c
src/lttng-context-ppid.c
src/lttng-context-preemptible.c
src/lttng-context-prio.c
src/lttng-context-procname.c
src/lttng-context-sgid.c
src/lttng-context-suid.c
src/lttng-context-tid.c
src/lttng-context-time-ns.c
src/lttng-context-uid.c
src/lttng-context-user-ns.c
src/lttng-context-uts-ns.c
src/lttng-context-vegid.c
src/lttng-context-veuid.c
src/lttng-context-vgid.c
src/lttng-context-vpid.c
src/lttng-context-vppid.c
src/lttng-context-vsgid.c
src/lttng-context-vsuid.c
src/lttng-context-vtid.c
src/lttng-context-vuid.c
src/lttng-event-notifier-notification.c
src/lttng-events.c
src/lttng-ring-buffer-client.h
src/lttng-ring-buffer-event-notifier-client.h
src/lttng-ring-buffer-metadata-client.h
src/probes/lttng-kprobes.c
src/probes/lttng-kretprobes.c
src/probes/lttng-uprobes.c

index 0f6b5ab9d4e2b09e8e2742dc3fab9d4ffe3b4b0b..9d07d7ed08f0c96cbe8546859f62aa231278cf92 100644 (file)
@@ -383,9 +383,9 @@ struct lttng_kernel_channel_buffer_ops {
        int (*event_reserve)(struct lttng_kernel_ring_buffer_ctx *ctx);
        void (*event_commit)(struct lttng_kernel_ring_buffer_ctx *ctx);
        void (*event_write)(struct lttng_kernel_ring_buffer_ctx *ctx, const void *src,
-                           size_t len);
+                           size_t len, size_t alignment);
        void (*event_write_from_user)(struct lttng_kernel_ring_buffer_ctx *ctx,
-                                     const void *src, size_t len);
+                                     const void *src, size_t len, size_t alignment);
        void (*event_memset)(struct lttng_kernel_ring_buffer_ctx *ctx,
                             int c, size_t len);
        void (*event_strcpy)(struct lttng_kernel_ring_buffer_ctx *ctx, const char *src,
index ce41fcb688d37102dc4e755f9c6aca9e530c264a..e3a858a397c5d49a8dfde63e97f5d61cf8e9b764 100644 (file)
@@ -813,8 +813,7 @@ static inline size_t __event_get_align__##_name(void *__tp_locvar)        \
 #define _ctf_integer_ext_fetched(_type, _item, _src, _byte_order, _base, _nowrite) \
        {                                                               \
                _type __tmp = _src;                                     \
-               lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(__tmp));\
-               __chan->ops->event_write(&__ctx, &__tmp, sizeof(__tmp));\
+               __chan->ops->event_write(&__ctx, &__tmp, sizeof(__tmp), lttng_alignof(__tmp)); \
        }
 
 #undef _ctf_integer_ext_isuser0
@@ -840,21 +839,19 @@ static inline size_t __event_get_align__##_name(void *__tp_locvar)              \
 
 #undef _ctf_array_encoded
 #define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _byte_order, _base, _user, _nowrite) \
-       lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type));        \
        if (_user) {                                                    \
-               __chan->ops->event_write_from_user(&__ctx, _src, sizeof(_type) * (_length)); \
+               __chan->ops->event_write_from_user(&__ctx, _src, sizeof(_type) * (_length), lttng_alignof(_type)); \
        } else {                                                        \
-               __chan->ops->event_write(&__ctx, _src, sizeof(_type) * (_length)); \
+               __chan->ops->event_write(&__ctx, _src, sizeof(_type) * (_length), lttng_alignof(_type)); \
        }
 
 #if (__BYTE_ORDER == __LITTLE_ENDIAN)
 #undef _ctf_array_bitfield
 #define _ctf_array_bitfield(_type, _item, _src, _length, _user, _nowrite) \
-       lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type));        \
        if (_user) {                                                    \
-               __chan->ops->event_write_from_user(&__ctx, _src, sizeof(_type) * (_length)); \
+               __chan->ops->event_write_from_user(&__ctx, _src, sizeof(_type) * (_length), lttng_alignof(_type)); \
        } else {                                                        \
-               __chan->ops->event_write(&__ctx, _src, sizeof(_type) * (_length)); \
+               __chan->ops->event_write(&__ctx, _src, sizeof(_type) * (_length), lttng_alignof(_type)); \
        }
 #else /* #if (__BYTE_ORDER == __LITTLE_ENDIAN) */
 /*
@@ -890,7 +887,7 @@ static inline size_t __event_get_align__##_name(void *__tp_locvar)        \
                        default:                                        \
                                BUG_ON(1);                              \
                        }                                               \
-                       __chan->ops->event_write(&__ctx, &_tmp, sizeof(_type)); \
+                       __chan->ops->event_write(&__ctx, &_tmp, sizeof(_type), 1); \
                }                                                       \
        }
 #endif /* #else #if (__BYTE_ORDER == __LITTLE_ENDIAN) */
@@ -900,16 +897,14 @@ static inline size_t __event_get_align__##_name(void *__tp_locvar)              \
                        _src_length, _encoding, _byte_order, _base, _user, _nowrite) \
        {                                                               \
                _length_type __tmpl = this_cpu_ptr(&lttng_dynamic_len_stack)->stack[__dynamic_len_idx]; \
-               lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_length_type));\
-               __chan->ops->event_write(&__ctx, &__tmpl, sizeof(_length_type));\
+               __chan->ops->event_write(&__ctx, &__tmpl, sizeof(_length_type), lttng_alignof(_length_type));\
        }                                                               \
-       lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type));        \
        if (_user) {                                                    \
                __chan->ops->event_write_from_user(&__ctx, _src,        \
-                       sizeof(_type) * __get_dynamic_len(dest));       \
+                       sizeof(_type) * __get_dynamic_len(dest), lttng_alignof(_type)); \
        } else {                                                        \
                __chan->ops->event_write(&__ctx, _src,                  \
-                       sizeof(_type) * __get_dynamic_len(dest));       \
+                       sizeof(_type) * __get_dynamic_len(dest), lttng_alignof(_type)); \
        }
 
 #if (__BYTE_ORDER == __LITTLE_ENDIAN)
@@ -919,16 +914,14 @@ static inline size_t __event_get_align__##_name(void *__tp_locvar)              \
                        _user, _nowrite)                        \
        {                                                               \
                _length_type __tmpl = this_cpu_ptr(&lttng_dynamic_len_stack)->stack[__dynamic_len_idx] * sizeof(_type) * CHAR_BIT; \
-               lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_length_type));\
-               __chan->ops->event_write(&__ctx, &__tmpl, sizeof(_length_type));\
+               __chan->ops->event_write(&__ctx, &__tmpl, sizeof(_length_type), lttng_alignof(_length_type)); \
        }                                                               \
-       lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type));        \
        if (_user) {                                                    \
                __chan->ops->event_write_from_user(&__ctx, _src,        \
-                       sizeof(_type) * __get_dynamic_len(dest));       \
+                       sizeof(_type) * __get_dynamic_len(dest), lttng_alignof(_type)); \
        } else {                                                        \
                __chan->ops->event_write(&__ctx, _src,                  \
-                       sizeof(_type) * __get_dynamic_len(dest));       \
+                       sizeof(_type) * __get_dynamic_len(dest), lttng_alignof(_type)); \
        }
 #else /* #if (__BYTE_ORDER == __LITTLE_ENDIAN) */
 /*
@@ -940,8 +933,7 @@ static inline size_t __event_get_align__##_name(void *__tp_locvar)        \
                        _user, _nowrite)                        \
        {                                                       \
                _length_type __tmpl = this_cpu_ptr(&lttng_dynamic_len_stack)->stack[__dynamic_len_idx] * sizeof(_type) * CHAR_BIT; \
-               lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_length_type));\
-               __chan->ops->event_write(&__ctx, &__tmpl, sizeof(_length_type));\
+               __chan->ops->event_write(&__ctx, &__tmpl, sizeof(_length_type), lttng_alignof(_length_type)); \
        }                                                               \
        lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type));        \
        {                                                               \
@@ -972,7 +964,7 @@ static inline size_t __event_get_align__##_name(void *__tp_locvar)        \
                        default:                                        \
                                BUG_ON(1);                              \
                        }                                               \
-                       __chan->ops->event_write(&__ctx, &_tmp, sizeof(_type)); \
+                       __chan->ops->event_write(&__ctx, &_tmp, sizeof(_type), 1); \
                }                                                       \
        }
 #endif /* #else #if (__BYTE_ORDER == __LITTLE_ENDIAN) */
index 03409291b9084fe8ae53a069254ddda03bfea052..833443d612c73efe38389a32a24ee3d52e79bb43 100644 (file)
@@ -197,7 +197,6 @@ void lttng_callstack_length_record(void *priv, struct lttng_kernel_probe_ctx *pr
        struct stack_trace *trace = stack_trace_context(fdata, cpu);
        unsigned int nr_seq_entries;
 
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(unsigned int));
        if (unlikely(!trace)) {
                nr_seq_entries = 0;
        } else {
@@ -205,7 +204,7 @@ void lttng_callstack_length_record(void *priv, struct lttng_kernel_probe_ctx *pr
                if (trace->nr_entries == trace->max_entries)
                        nr_seq_entries++;
        }
-       chan->ops->event_write(ctx, &nr_seq_entries, sizeof(unsigned int));
+       chan->ops->event_write(ctx, &nr_seq_entries, sizeof(unsigned int), lttng_alignof(unsigned int));
 }
 static
 void lttng_callstack_sequence_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
@@ -217,19 +216,19 @@ void lttng_callstack_sequence_record(void *priv, struct lttng_kernel_probe_ctx *
        struct stack_trace *trace = stack_trace_context(fdata, cpu);
        unsigned int nr_seq_entries;
 
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(unsigned long));
        if (unlikely(!trace)) {
+               lib_ring_buffer_align_ctx(ctx, lttng_alignof(unsigned long));
                return;
        }
        nr_seq_entries = trace->nr_entries;
        if (trace->nr_entries == trace->max_entries)
                nr_seq_entries++;
        chan->ops->event_write(ctx, trace->entries,
-                       sizeof(unsigned long) * trace->nr_entries);
+                       sizeof(unsigned long) * trace->nr_entries, lttng_alignof(unsigned long));
        /* Add our own ULONG_MAX delimiter to show incomplete stack. */
        if (trace->nr_entries == trace->max_entries) {
                unsigned long delim = ULONG_MAX;
 
-               chan->ops->event_write(ctx, &delim, sizeof(unsigned long));
+               chan->ops->event_write(ctx, &delim, sizeof(unsigned long), 1);
        }
 }
index 2452804dfe019d274d9a6c140f9070cf870ce32d..e73d1156ae7c0731e7918c194982e2446688f278 100644 (file)
@@ -202,7 +202,6 @@ void lttng_callstack_length_record(void *priv, struct lttng_kernel_probe_ctx *pr
        struct lttng_stack_trace *trace = stack_trace_context(fdata, cpu);
        unsigned int nr_seq_entries;
 
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(unsigned int));
        if (unlikely(!trace)) {
                nr_seq_entries = 0;
        } else {
@@ -210,7 +209,7 @@ void lttng_callstack_length_record(void *priv, struct lttng_kernel_probe_ctx *pr
                if (trace->nr_entries == MAX_ENTRIES)
                        nr_seq_entries++;
        }
-       chan->ops->event_write(ctx, &nr_seq_entries, sizeof(unsigned int));
+       chan->ops->event_write(ctx, &nr_seq_entries, sizeof(unsigned int), lttng_alignof(unsigned int));
 }
 
 static
@@ -223,19 +222,20 @@ void lttng_callstack_sequence_record(void *priv, struct lttng_kernel_probe_ctx *
        struct lttng_stack_trace *trace = stack_trace_context(fdata, cpu);
        unsigned int nr_seq_entries;
 
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(unsigned long));
        if (unlikely(!trace)) {
+               /* We need to align even if there are 0 elements. */
+               lib_ring_buffer_align_ctx(ctx, lttng_alignof(unsigned long));
                return;
        }
        nr_seq_entries = trace->nr_entries;
        if (trace->nr_entries == MAX_ENTRIES)
                nr_seq_entries++;
        chan->ops->event_write(ctx, trace->entries,
-                       sizeof(unsigned long) * trace->nr_entries);
+                       sizeof(unsigned long) * trace->nr_entries, lttng_alignof(unsigned long));
        /* Add our own ULONG_MAX delimiter to show incomplete stack. */
        if (trace->nr_entries == MAX_ENTRIES) {
                unsigned long delim = ULONG_MAX;
 
-               chan->ops->event_write(ctx, &delim, sizeof(unsigned long));
+               chan->ops->event_write(ctx, &delim, sizeof(unsigned long), 1);
        }
 }
index 6cab3153630cd4b613b629e4f9e4374adf8cf7af..3a7f574ccd29ad8c2ad2c3ddcfb82007b5d1d186 100644 (file)
@@ -51,8 +51,7 @@ void cgroup_ns_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
        if (current->nsproxy)
                cgroup_ns_inum = current->nsproxy->cgroup_ns->lttng_ns_inum;
 
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(cgroup_ns_inum));
-       chan->ops->event_write(ctx, &cgroup_ns_inum, sizeof(cgroup_ns_inum));
+       chan->ops->event_write(ctx, &cgroup_ns_inum, sizeof(cgroup_ns_inum), lttng_alignof(cgroup_ns_inum));
 }
 
 static
index 24241dee7f511b5ecdd47f4b7682f4daf7e20d08..30247c31d198fa26baada26a492e2badfd82ca32 100644 (file)
@@ -34,8 +34,7 @@ void cpu_id_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
        int cpu;
 
        cpu = ctx->priv.reserve_cpu;
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(cpu));
-       chan->ops->event_write(ctx, &cpu, sizeof(cpu));
+       chan->ops->event_write(ctx, &cpu, sizeof(cpu), lttng_alignof(cpu));
 }
 
 static
index 6eaa758e5fe43f0eff9636253c2eba0ab332b50d..1473688b812adf0b0b7fe84a89d3487dc8ad729c 100644 (file)
@@ -36,8 +36,7 @@ void egid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
        gid_t egid;
 
        egid = lttng_current_egid();
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(egid));
-       chan->ops->event_write(ctx, &egid, sizeof(egid));
+       chan->ops->event_write(ctx, &egid, sizeof(egid), lttng_alignof(egid));
 }
 
 static
index 90a6dd3c9271c6dbb0cfdd1d7a5bafd52ad39e33..7d344b1fea69799aa03fc6e23e92f24560203548 100644 (file)
@@ -36,8 +36,7 @@ void euid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
        uid_t euid;
 
        euid = lttng_current_euid();
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(euid));
-       chan->ops->event_write(ctx, &euid, sizeof(euid));
+       chan->ops->event_write(ctx, &euid, sizeof(euid), lttng_alignof(euid));
 }
 
 static
index f00840794a6b590cd1c52ac4ace39c2b9c4ae65f..17f637d757d85d73c44078340c752b0d5c8a9160 100644 (file)
@@ -36,8 +36,7 @@ void gid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
        gid_t gid;
 
        gid = lttng_current_gid();
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(gid));
-       chan->ops->event_write(ctx, &gid, sizeof(gid));
+       chan->ops->event_write(ctx, &gid, sizeof(gid), lttng_alignof(gid));
 }
 
 static
index 8956e540e1c8a0a01255c61d88203b9727ed9092..96320ad342d56480b232969c3a31786e7f41de9d 100644 (file)
@@ -46,7 +46,7 @@ void hostname_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
                ns = nsproxy->uts_ns;
                hostname = ns->name.nodename;
                chan->ops->event_write(ctx, hostname,
-                               LTTNG_HOSTNAME_CTX_LEN);
+                               LTTNG_HOSTNAME_CTX_LEN, 1);
        } else {
                chan->ops->event_memset(ctx, 0,
                                LTTNG_HOSTNAME_CTX_LEN);
index bf2589da197f10cdafd1426417ec0f3374dbb7cf..48ff7efe2cde3b3c400e529e105ddfafdd3d58df 100644 (file)
@@ -39,8 +39,7 @@ void interruptible_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
        struct lttng_kernel_probe_ctx *lttng_probe_ctx = ctx->probe_ctx;
        int8_t interruptible = lttng_probe_ctx->interruptible;
 
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(interruptible));
-       chan->ops->event_write(ctx, &interruptible, sizeof(interruptible));
+       chan->ops->event_write(ctx, &interruptible, sizeof(interruptible), lttng_alignof(interruptible));
 }
 
 static
index c578fea8b5b6d00322c65271d36260501d8956ef..d5d0608f0bde307dcf21b96d68cc080e57d79ce5 100644 (file)
@@ -50,8 +50,7 @@ void ipc_ns_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
        if (current->nsproxy)
                ipc_ns_inum = current->nsproxy->ipc_ns->lttng_ns_inum;
 
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(ipc_ns_inum));
-       chan->ops->event_write(ctx, &ipc_ns_inum, sizeof(ipc_ns_inum));
+       chan->ops->event_write(ctx, &ipc_ns_inum, sizeof(ipc_ns_inum), lttng_alignof(ipc_ns_inum));
 }
 
 static
index e2f6bfd97b0816ccc196e4ff07f9b51004ad7190..82d3dba072759b99428cfbf4a40ce8cd6de0afa4 100644 (file)
@@ -34,8 +34,7 @@ void migratable_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
 {
        uint8_t migratable = !current->migrate_disable;
 
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(migratable));
-       chan->ops->event_write(ctx, &migratable, sizeof(migratable));
+       chan->ops->event_write(ctx, &migratable, sizeof(migratable), lttng_alignof(migratable));
 }
 
 static
index 030a7f25419760af692aef8fd5805f3c0d925b57..7853c94b448c8215489a4ebf50d3e86aa64a3dd5 100644 (file)
@@ -52,8 +52,7 @@ void mnt_ns_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
        if (current->nsproxy)
                mnt_ns_inum = current->nsproxy->mnt_ns->lttng_ns_inum;
 
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(mnt_ns_inum));
-       chan->ops->event_write(ctx, &mnt_ns_inum, sizeof(mnt_ns_inum));
+       chan->ops->event_write(ctx, &mnt_ns_inum, sizeof(mnt_ns_inum), lttng_alignof(mnt_ns_inum));
 }
 
 static
index 42cf11db03992db5694c6c038fcb81464a152004..0ccbfc78793a2bdaee154430d6c38b3b30bf54a8 100644 (file)
@@ -34,8 +34,7 @@ void need_reschedule_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx
 {
        uint8_t need_reschedule = test_tsk_need_resched(current);
 
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(need_reschedule));
-       chan->ops->event_write(ctx, &need_reschedule, sizeof(need_reschedule));
+       chan->ops->event_write(ctx, &need_reschedule, sizeof(need_reschedule), lttng_alignof(need_reschedule));
 }
 
 static
index 1262178b096d1e394304c36fa0cae85b5c4e8eea..2d8994afd614fa26457064cd3739cf7a964743a7 100644 (file)
@@ -51,8 +51,7 @@ void net_ns_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
        if (current->nsproxy)
                net_ns_inum = current->nsproxy->net_ns->lttng_ns_inum;
 
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(net_ns_inum));
-       chan->ops->event_write(ctx, &net_ns_inum, sizeof(net_ns_inum));
+       chan->ops->event_write(ctx, &net_ns_inum, sizeof(net_ns_inum), lttng_alignof(net_ns_inum));
 }
 
 static
index a6847705adca8ca47074174200d2908ff6951bba..91feb8d1258816c6551d1060c01a6094065cc11e 100644 (file)
@@ -34,8 +34,7 @@ void nice_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
        int nice;
 
        nice = task_nice(current);
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(nice));
-       chan->ops->event_write(ctx, &nice, sizeof(nice));
+       chan->ops->event_write(ctx, &nice, sizeof(nice), lttng_alignof(nice));
 }
 
 static
index 0b466363235b2a91e307645dbd1b2cef107e9419..b0227d474e4d5388138bf3e6ae36bc33eaf75fec 100644 (file)
@@ -57,8 +57,7 @@ void perf_counter_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
                 */
                value = 0;
        }
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(value));
-       chan->ops->event_write(ctx, &value, sizeof(value));
+       chan->ops->event_write(ctx, &value, sizeof(value), lttng_alignof(value));
 }
 
 #if defined(CONFIG_PERF_EVENTS) && (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,1,0))
index f99fec9afe5e8a3f8b49e2b8aa82cc9ac16599a8..fdf91bb889113092552c8988f8426bd922edf796 100644 (file)
@@ -51,8 +51,7 @@ void pid_ns_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
        if (ns)
                pid_ns_inum = ns->lttng_ns_inum;
 
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(pid_ns_inum));
-       chan->ops->event_write(ctx, &pid_ns_inum, sizeof(pid_ns_inum));
+       chan->ops->event_write(ctx, &pid_ns_inum, sizeof(pid_ns_inum), lttng_alignof(pid_ns_inum));
 }
 
 static
index 5bf9dfd147f4f643cf429bb37bc64560747971d4..5bcbe00c57e6dbc4ae15cb3681070955823551af 100644 (file)
@@ -34,8 +34,7 @@ void pid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
        pid_t pid;
 
        pid = task_tgid_nr(current);
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(pid));
-       chan->ops->event_write(ctx, &pid, sizeof(pid));
+       chan->ops->event_write(ctx, &pid, sizeof(pid), lttng_alignof(pid));
 }
 
 static
index 8d359390a6d2736f1b51481dff41d1cb935567ea..1286c376aaa5ae3d885f50f87c47bdd31e21fd58 100644 (file)
@@ -44,8 +44,7 @@ void ppid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
        rcu_read_lock();
        ppid = task_tgid_nr(current->real_parent);
        rcu_read_unlock();
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(ppid));
-       chan->ops->event_write(ctx, &ppid, sizeof(ppid));
+       chan->ops->event_write(ctx, &ppid, sizeof(ppid), lttng_alignof(ppid));
 }
 
 static
index 548e79f43cf7a9a36d6cb25de6eb154c5c5acba3..11c15792933d612ed40e1bbf6dd68d9ae6469ac9 100644 (file)
@@ -46,8 +46,7 @@ void preemptible_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
        WARN_ON_ONCE(pc < LTTNG_PREEMPT_DISABLE_NESTING);
        if (pc == LTTNG_PREEMPT_DISABLE_NESTING)
                preemptible = 1;
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(preemptible));
-       chan->ops->event_write(ctx, &preemptible, sizeof(preemptible));
+       chan->ops->event_write(ctx, &preemptible, sizeof(preemptible), lttng_alignof(preemptible));
 }
 
 static
index 27a0ab8a5e8267a73af664b394c22acb4cff7505..ea1a5ea6ca655d87894eba9d8d9a7016269c06cc 100644 (file)
@@ -61,8 +61,7 @@ void prio_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
        int prio;
 
        prio = wrapper_task_prio_sym(current);
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(prio));
-       chan->ops->event_write(ctx, &prio, sizeof(prio));
+       chan->ops->event_write(ctx, &prio, sizeof(prio), lttng_alignof(prio));
 }
 
 static
index aaefef845f41ec82454f27eaadea51971b609ad9..a2e07453a48c1f00cf09f342a4ad375745916bec 100644 (file)
@@ -37,7 +37,7 @@ void procname_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
                 struct lttng_kernel_ring_buffer_ctx *ctx,
                 struct lttng_kernel_channel_buffer *chan)
 {
-       chan->ops->event_write(ctx, current->comm, sizeof(current->comm));
+       chan->ops->event_write(ctx, current->comm, sizeof(current->comm), 1);
 }
 
 static
index bffe9308226d8453da92b8d21bad91230335d5b2..dde6f71326fb88d18d07c77487000fa11e665365 100644 (file)
@@ -36,8 +36,7 @@ void sgid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
        gid_t sgid;
 
        sgid = lttng_current_sgid();
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(sgid));
-       chan->ops->event_write(ctx, &sgid, sizeof(sgid));
+       chan->ops->event_write(ctx, &sgid, sizeof(sgid), lttng_alignof(sgid));
 }
 
 static
index 37ef7c3b2bff8e8aa1ca49add0b66909a7dc7e29..214de9ac9bf16d8a04568e24381154a6db8bb6a0 100644 (file)
@@ -36,8 +36,7 @@ void suid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
        uid_t suid;
 
        suid = lttng_current_suid();
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(suid));
-       chan->ops->event_write(ctx, &suid, sizeof(suid));
+       chan->ops->event_write(ctx, &suid, sizeof(suid), lttng_alignof(suid));
 }
 
 static
index 538a2a58f6a8f3bffdef9de6861d8ab259e033d5..5ca7346c9d0a21729954d37b66496310f5cdedd5 100644 (file)
@@ -34,8 +34,7 @@ void tid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
        pid_t tid;
 
        tid = task_pid_nr(current);
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(tid));
-       chan->ops->event_write(ctx, &tid, sizeof(tid));
+       chan->ops->event_write(ctx, &tid, sizeof(tid), lttng_alignof(tid));
 }
 
 static
index 72f0f1c46b182b3e2fc2d1f2c15762dbdd7a869c..fe29e20645a59f093a678da17797e9224ab836e9 100644 (file)
@@ -50,8 +50,7 @@ void time_ns_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
        if (current->nsproxy)
                time_ns_inum = current->nsproxy->time_ns->lttng_ns_inum;
 
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(time_ns_inum));
-       chan->ops->event_write(ctx, &time_ns_inum, sizeof(time_ns_inum));
+       chan->ops->event_write(ctx, &time_ns_inum, sizeof(time_ns_inum), lttng_alignof(time_ns_inum));
 }
 
 static
index 0bdc2ece41df3622f79dca3ee56be9227232af12..b4b5b6ce4acf2c5c3ed3c152c937273f1de8b400 100644 (file)
@@ -36,8 +36,7 @@ void uid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
        uid_t uid;
 
        uid = lttng_current_uid();
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(uid));
-       chan->ops->event_write(ctx, &uid, sizeof(uid));
+       chan->ops->event_write(ctx, &uid, sizeof(uid), lttng_alignof(uid));
 }
 
 static
index b497754b9ef13ac10cf8637b36d1ae3aef258259..b921f2aa80e0728d4bdeb6eea9da31ffe13fff71 100644 (file)
@@ -43,8 +43,7 @@ void user_ns_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
        if (current_user_ns())
                user_ns_inum = current_user_ns()->lttng_ns_inum;
 
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(user_ns_inum));
-       chan->ops->event_write(ctx, &user_ns_inum, sizeof(user_ns_inum));
+       chan->ops->event_write(ctx, &user_ns_inum, sizeof(user_ns_inum), lttng_alignof(user_ns_inum));
 }
 
 static
index afa61ab9ed5a268235fc553120b3a200572b2ca7..1c34ae212b24bb001cb817e375585b3f5b2afc68 100644 (file)
@@ -50,8 +50,7 @@ void uts_ns_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
        if (current->nsproxy)
                uts_ns_inum = current->nsproxy->uts_ns->lttng_ns_inum;
 
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(uts_ns_inum));
-       chan->ops->event_write(ctx, &uts_ns_inum, sizeof(uts_ns_inum));
+       chan->ops->event_write(ctx, &uts_ns_inum, sizeof(uts_ns_inum), lttng_alignof(uts_ns_inum));
 }
 
 static
index 9abd29b8e85ecf4c70d48c7b139ad028cace7d75..6aee7cbcd00f048b3939111b6453dbd0d7e46024 100644 (file)
@@ -36,8 +36,7 @@ void vegid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
        gid_t vegid;
 
        vegid = lttng_current_vegid();
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(vegid));
-       chan->ops->event_write(ctx, &vegid, sizeof(vegid));
+       chan->ops->event_write(ctx, &vegid, sizeof(vegid), lttng_alignof(vegid));
 }
 
 static
index 9113578e2bd76f855d59925f8a5af0e030972491..30ace857ca4424a0e207ead541250a23e5bd230b 100644 (file)
@@ -36,8 +36,7 @@ void veuid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
        uid_t veuid;
 
        veuid = lttng_current_veuid();
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(veuid));
-       chan->ops->event_write(ctx, &veuid, sizeof(veuid));
+       chan->ops->event_write(ctx, &veuid, sizeof(veuid), lttng_alignof(veuid));
 }
 
 static
index 0b7516e233b2a214196442ab56a07940bba41f23..eb05d30a5d9063ef2d3afd3e584cb92d2dd95da7 100644 (file)
@@ -36,8 +36,7 @@ void vgid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
        gid_t vgid;
 
        vgid = lttng_current_vgid();
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(vgid));
-       chan->ops->event_write(ctx, &vgid, sizeof(vgid));
+       chan->ops->event_write(ctx, &vgid, sizeof(vgid), lttng_alignof(vgid));
 }
 
 static
index f631f6e00e28bc96eb7af4b9bafca6ff957b63c2..3aff90f44ab2cbae409afb18b49920034e89b5f1 100644 (file)
@@ -40,8 +40,7 @@ void vpid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
                vpid = 0;
        else
                vpid = task_tgid_vnr(current);
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(vpid));
-       chan->ops->event_write(ctx, &vpid, sizeof(vpid));
+       chan->ops->event_write(ctx, &vpid, sizeof(vpid), lttng_alignof(vpid));
 }
 
 static
index d682364314e8b6f7b60e3acb20df2d9eed941147..55a84c2e7f3bdf6423df1cf696f09b571f59822c 100644 (file)
@@ -55,8 +55,7 @@ void vppid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
        else
                vppid = task_tgid_vnr(parent);
        rcu_read_unlock();
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(vppid));
-       chan->ops->event_write(ctx, &vppid, sizeof(vppid));
+       chan->ops->event_write(ctx, &vppid, sizeof(vppid), lttng_alignof(vppid));
 }
 
 static
index 09c5c139af1756c569148ca16ea12d29b2aac20c..08ee829bc1b5e16e60f41fd75420c79eca18cdff 100644 (file)
@@ -36,8 +36,7 @@ void vsgid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
        gid_t vsgid;
 
        vsgid = lttng_current_vsgid();
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(vsgid));
-       chan->ops->event_write(ctx, &vsgid, sizeof(vsgid));
+       chan->ops->event_write(ctx, &vsgid, sizeof(vsgid), lttng_alignof(vsgid));
 }
 
 static
index 0f7489837b8cfa2990cbaf7e509017339864cefc..36d562d1554c41a50253a0b5ba87742acd86f2bb 100644 (file)
@@ -36,8 +36,7 @@ void vsuid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
        uid_t vsuid;
 
        vsuid = lttng_current_vsuid();
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(vsuid));
-       chan->ops->event_write(ctx, &vsuid, sizeof(vsuid));
+       chan->ops->event_write(ctx, &vsuid, sizeof(vsuid), lttng_alignof(vsuid));
 }
 
 static
index f42734630ac9182b173740f71b7a6ccfb96c230d..9f1a399a43504d602fd935e40e39a6abf70e5f28 100644 (file)
@@ -40,8 +40,7 @@ void vtid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
                vtid = 0;
        else
                vtid = task_pid_vnr(current);
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(vtid));
-       chan->ops->event_write(ctx, &vtid, sizeof(vtid));
+       chan->ops->event_write(ctx, &vtid, sizeof(vtid), lttng_alignof(vtid));
 }
 
 static
index 817800e4dbd83d959b7799358518cce678474f62..9ffc2cdf21b3594f3adc7ccadc209e4d68cd7634 100644 (file)
@@ -36,8 +36,7 @@ void vuid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
        uid_t vuid;
 
        vuid = lttng_current_vuid();
-       lib_ring_buffer_align_ctx(ctx, lttng_alignof(vuid));
-       chan->ops->event_write(ctx, &vuid, sizeof(vuid));
+       chan->ops->event_write(ctx, &vuid, sizeof(vuid), lttng_alignof(vuid));
 }
 
 static
index 1e4aa7772520afaf911870e5671669328620d85a..811dc50ad8dc93ea7230a71a8c106d9fb6316da4 100644 (file)
@@ -408,18 +408,16 @@ void notification_send(struct lttng_event_notifier_notification *notif,
                return;
        }
 
-       lib_ring_buffer_align_ctx(&ctx, lttng_alignof(kernel_notif));
-
        /* Write the notif structure. */
        event_notifier_group->ops->event_write(&ctx, &kernel_notif,
-                       sizeof(kernel_notif));
+                       sizeof(kernel_notif), lttng_alignof(kernel_notif));
 
        /*
         * Write the capture buffer. No need to realigned as the below is a raw
         * char* buffer.
         */
        event_notifier_group->ops->event_write(&ctx, &notif->capture_buf,
-                       capture_buffer_content_len);
+                       capture_buffer_content_len, 1);
 
        event_notifier_group->ops->event_commit(&ctx);
        irq_work_queue(&event_notifier_group->wakeup_pending);
index 8d2bf46991d78703a2bbeed96333282211319600..89257bd688ea72b6265e3984535fa6a6dc6fe478 100644 (file)
@@ -2924,7 +2924,7 @@ int lttng_metadata_output_channel(struct lttng_metadata_stream *stream,
        }
        stream->transport->ops.event_write(&ctx,
                        stream->metadata_cache->data + stream->metadata_in,
-                       reserve_len);
+                       reserve_len, 1);
        stream->transport->ops.event_commit(&ctx);
        stream->metadata_in += reserve_len;
        if (reserve_len < len)
index 2eee81a1fad57f37d1f1e305af1a4d282cedacc0..f3c1935805a2b300caeee5da35b05cdfb2e73087 100644 (file)
@@ -657,15 +657,17 @@ void lttng_event_commit(struct lttng_kernel_ring_buffer_ctx *ctx)
 
 static
 void lttng_event_write(struct lttng_kernel_ring_buffer_ctx *ctx, const void *src,
-                    size_t len)
+                    size_t len, size_t alignment)
 {
+       lib_ring_buffer_align_ctx(ctx, alignment);
        lib_ring_buffer_write(&client_config, ctx, src, len);
 }
 
 static
 void lttng_event_write_from_user(struct lttng_kernel_ring_buffer_ctx *ctx,
-                              const void __user *src, size_t len)
+                              const void __user *src, size_t len, size_t alignment)
 {
+       lib_ring_buffer_align_ctx(ctx, alignment);
        lib_ring_buffer_copy_from_user_inatomic(&client_config, ctx, src, len);
 }
 
index 17f9791a9421df02f5a507f7cebb20a4d4c650d5..ccd3a0206f12d1a6c56437302b21de17f350bc2b 100644 (file)
@@ -328,15 +328,17 @@ void lttng_event_commit(struct lttng_kernel_ring_buffer_ctx *ctx)
 
 static
 void lttng_event_write(struct lttng_kernel_ring_buffer_ctx *ctx, const void *src,
-                    size_t len)
+                    size_t len, size_t alignment)
 {
+       lib_ring_buffer_align_ctx(ctx, alignment);
        lib_ring_buffer_write(&client_config, ctx, src, len);
 }
 
 static
 void lttng_event_write_from_user(struct lttng_kernel_ring_buffer_ctx *ctx,
-                              const void __user *src, size_t len)
+                              const void __user *src, size_t len, size_t alignment)
 {
+       lib_ring_buffer_align_ctx(ctx, alignment);
        lib_ring_buffer_copy_from_user_inatomic(&client_config, ctx, src, len);
 }
 
index 6c7f64c244cd6a241cdf9611a37eb8ae0b3923de..bd2ca4753b2e4c5b9f4f6a2d46bf375f500af536 100644 (file)
@@ -326,15 +326,17 @@ void lttng_event_commit(struct lttng_kernel_ring_buffer_ctx *ctx)
 
 static
 void lttng_event_write(struct lttng_kernel_ring_buffer_ctx *ctx, const void *src,
-                    size_t len)
+                    size_t len, size_t alignment)
 {
+       lib_ring_buffer_align_ctx(ctx, alignment);
        lib_ring_buffer_write(&client_config, ctx, src, len);
 }
 
 static
 void lttng_event_write_from_user(struct lttng_kernel_ring_buffer_ctx *ctx,
-                              const void __user *src, size_t len)
+                              const void __user *src, size_t len, size_t alignment)
 {
+       lib_ring_buffer_align_ctx(ctx, alignment);
        lib_ring_buffer_copy_from_user_inatomic(&client_config, ctx, src, len);
 }
 
index a279b19d58c01588382cdcc2ff1c6b713bff480d..12de611a8004e968c58724273992313ed9977f2c 100644 (file)
@@ -68,8 +68,7 @@ int lttng_kprobes_event_handler_pre(struct kprobe *p, struct pt_regs *regs)
                ret = chan->ops->event_reserve(&ctx);
                if (ret < 0)
                        return 0;
-               lib_ring_buffer_align_ctx(&ctx, lttng_alignof(data));
-               chan->ops->event_write(&ctx, &data, sizeof(data));
+               chan->ops->event_write(&ctx, &data, sizeof(data), lttng_alignof(data));
                chan->ops->event_commit(&ctx);
                break;
        }
index e939a0ae56bb2af3f75dcb0b938d8d8766d993f4..0fa6a1bfc29a62ee1e93461aaace18fa11bc34f2 100644 (file)
@@ -86,8 +86,7 @@ int _lttng_kretprobes_handler(struct kretprobe_instance *krpi,
                ret = chan->ops->event_reserve(&ctx);
                if (ret < 0)
                        return 0;
-               lib_ring_buffer_align_ctx(&ctx, lttng_alignof(payload));
-               chan->ops->event_write(&ctx, &payload, sizeof(payload));
+               chan->ops->event_write(&ctx, &payload, sizeof(payload), lttng_alignof(payload));
                chan->ops->event_commit(&ctx);
                break;
        }
index efb879be7c56e42e8eaa37ad486af5907d608ad3..fed3a1d5a2b4c9beefe4f787370398a38d44474f 100644 (file)
@@ -78,8 +78,7 @@ int lttng_uprobes_event_handler_pre(struct uprobe_consumer *uc, struct pt_regs *
                /* Event payload. */
                payload.ip = (unsigned long)instruction_pointer(regs);
 
-               lib_ring_buffer_align_ctx(&ctx, lttng_alignof(payload));
-               chan->ops->event_write(&ctx, &payload, sizeof(payload));
+               chan->ops->event_write(&ctx, &payload, sizeof(payload), lttng_alignof(payload));
                chan->ops->event_commit(&ctx);
                break;
        }
This page took 0.047017 seconds and 4 git commands to generate.