Refactoring: event structures
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 15 Apr 2021 12:23:17 +0000 (08:23 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 23 Apr 2021 14:58:56 +0000 (10:58 -0400)
Combine event recorder and event notifier structures common parts into a
"common" parent structure. Move "internal" fields not meant to be
touched by the probes into private structures.

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

13 files changed:
include/lttng/event-notifier-notification.h
include/lttng/events-internal.h
include/lttng/events.h
include/lttng/tracepoint-event-impl.h
src/lttng-abi.c
src/lttng-bytecode.c
src/lttng-event-notifier-notification.c
src/lttng-events.c
src/lttng-ring-buffer-client.h
src/lttng-syscalls.c
src/probes/lttng-kprobes.c
src/probes/lttng-kretprobes.c
src/probes/lttng-uprobes.c

index 160b25429e7830625a910719d917a2c4349dc432..a0eb7d70b23e805d7ac8a1a0b30908652d9f5d1c 100644 (file)
@@ -10,9 +10,9 @@
 
 #include <lttng/events.h>
 
-void lttng_event_notifier_notification_send(struct lttng_event_notifier *event_notifier,
-               struct lttng_probe_ctx *lttng_probe_ctx,
+void lttng_event_notifier_notification_send(struct lttng_kernel_event_notifier *event_notifier,
+               struct lttng_probe_ctx *probe_ctx,
                const char *stack_data,
-               struct lttng_kernel_notifier_ctx *notif_ctx);
+               struct lttng_kernel_notification_ctx *notif_ctx);
 
 #endif /* _LTTNG_EVENT_NOTIFIER_NOTIFICATION_H */
index 0c7628483271c06c0b012444371bbaced4e100a8..30cf4adc8bab62723421c77cdb2c0c872c8de2ec 100644 (file)
 
 #include <lttng/events.h>
 
+struct lttng_kernel_event_common_private {
+       struct lttng_kernel_event_common *pub;          /* Public event interface */
+
+       const struct lttng_kernel_event_desc *desc;
+       /* Backward references: list of lttng_enabler_ref (ref to enablers) */
+       struct list_head enablers_ref_head;
+       int registered;                                 /* has reg'd tracepoint probe */
+       uint64_t user_token;
+
+       int has_enablers_without_filter_bytecode;
+       /* list of struct lttng_kernel_bytecode_runtime, sorted by seqnum */
+       struct list_head filter_bytecode_runtime_head;
+       enum lttng_kernel_abi_instrumentation instrumentation;
+       /* Selected by instrumentation */
+       union {
+               struct lttng_kprobe kprobe;
+               struct lttng_uprobe uprobe;
+               struct {
+                       struct lttng_krp *lttng_krp;
+                       char *symbol_name;
+               } kretprobe;
+               struct {
+                       enum lttng_syscall_entryexit entryexit;
+                       enum lttng_syscall_abi abi;
+                       struct hlist_node node;                 /* chain registered syscall event_notifier */
+                       unsigned int syscall_id;
+               } syscall;
+       } u;
+};
+
+struct lttng_kernel_event_recorder_private {
+       struct lttng_kernel_event_common_private parent;
+
+       struct lttng_kernel_event_recorder *pub;        /* Public event interface */
+       struct list_head node;                          /* Event recorder list */
+       struct hlist_node hlist;                        /* Hash table of event recorders */
+       struct lttng_kernel_ctx *ctx;
+       unsigned int id;
+       unsigned int metadata_dumped:1;
+};
+
+struct lttng_kernel_event_notifier_private {
+       struct lttng_kernel_event_common_private parent;
+
+       struct lttng_kernel_event_notifier *pub;        /* Public event notifier interface */
+       struct lttng_event_notifier_group *group;       /* weak ref */
+       size_t num_captures;                            /* Needed to allocate the msgpack array. */
+       uint64_t error_counter_index;
+       struct list_head node;                          /* Event notifier list */
+       struct hlist_node hlist;                        /* Hash table of event notifiers */
+       struct list_head capture_bytecode_runtime_head;
+
+};
+
 static inline
 const struct lttng_kernel_type_integer *lttng_kernel_get_type_integer(const struct lttng_kernel_type_common *type)
 {
index a681e04c1a985c6a0ce41fe1ae9c89ac9f304b20..b9586a0a43bcc0bd9031bd175ed51c907c9c7fd8 100644 (file)
@@ -328,8 +328,8 @@ struct lttng_perf_counter_field {
 };
 
 struct lttng_probe_ctx {
-       struct lttng_event *event;
-       struct lttng_event_notifier *event_notifier; // Not sure if we will ever need it.
+       struct lttng_kernel_event_recorder *event;
+       struct lttng_kernel_event_notifier *event_notifier; // Not sure if we will ever need it.
        uint8_t interruptible;
 };
 
@@ -433,8 +433,8 @@ struct lttng_enabler_ref {
 
 struct lttng_uprobe_handler {
        union {
-               struct lttng_event *event;
-               struct lttng_event_notifier *event_notifier;
+               struct lttng_kernel_event_recorder *event;
+               struct lttng_kernel_event_notifier *event_notifier;
        } u;
        loff_t offset;
        struct uprobe_consumer up_consumer;
@@ -461,85 +461,50 @@ enum lttng_syscall_abi {
        LTTNG_SYSCALL_ABI_COMPAT,
 };
 
-/*
- * lttng_event structure is referred to by the tracing fast path. It must be
- * kept small.
- */
-struct lttng_event {
-       unsigned int id;
-       struct lttng_channel *chan;
+struct lttng_kernel_event_common_private;
+
+enum lttng_kernel_event_type {
+       LTTNG_KERNEL_EVENT_TYPE_RECORDER = 0,
+       LTTNG_KERNEL_EVENT_TYPE_NOTIFIER = 1,
+};
+
+struct lttng_kernel_event_common {
+       struct lttng_kernel_event_common_private *priv; /* Private event interface */
+
+       enum lttng_kernel_event_type type;
+       /* Get child with container_of(). */
+
        int enabled;
-       const struct lttng_kernel_event_desc *desc;
-       void *filter;
-       struct lttng_kernel_ctx *ctx;
-       enum lttng_kernel_abi_instrumentation instrumentation;
-       union {
-               struct lttng_kprobe kprobe;
-               struct {
-                       struct lttng_krp *lttng_krp;
-                       char *symbol_name;
-               } kretprobe;
-               struct lttng_uprobe uprobe;
-               struct {
-                       enum lttng_syscall_entryexit entryexit;
-                       enum lttng_syscall_abi abi;
-                       struct hlist_node node;                 /* chain registered syscall event */
-               } syscall;
-       } u;
-       struct list_head list;          /* Event list in session */
-       unsigned int metadata_dumped:1;
-
-       /* Backward references: list of lttng_enabler_ref (ref to enablers) */
-       struct list_head enablers_ref_head;
-       struct hlist_node hlist;        /* session ht of events */
-       int registered;                 /* has reg'd tracepoint probe */
-       /* list of struct lttng_bytecode_runtime, sorted by seqnum */
-       struct list_head filter_bytecode_runtime_head;
-       int has_enablers_without_bytecode;
+       int eval_filter;                                /* Need to evaluate filters */
+       int (*run_filter)(struct lttng_kernel_event_common *event,
+               const char *stack_data,
+               void *filter_ctx);
 };
 
-struct lttng_kernel_notifier_ctx {
-       int eval_capture;
+struct lttng_kernel_event_recorder_private;
+
+struct lttng_kernel_event_recorder {
+       struct lttng_kernel_event_common parent;
+       struct lttng_kernel_event_recorder_private *priv;       /* Private event record interface */
+
+       struct lttng_channel *chan;
 };
 
-// FIXME: Really similar to lttng_event above. Could those be merged ?
-struct lttng_event_notifier {
-       uint64_t user_token;
-       uint64_t error_counter_index;
-       int enabled;
-       int registered;                 /* has reg'd tracepoint probe */
-       const struct lttng_kernel_event_desc *desc;
-       void *filter;
-       struct list_head list;          /* event_notifier list in event_notifier group */
+struct lttng_kernel_notification_ctx {
+       int eval_capture;                                       /* Capture evaluation available. */
+};
 
-       enum lttng_kernel_abi_instrumentation instrumentation;
-       union {
-               struct lttng_kprobe kprobe;
-               struct lttng_uprobe uprobe;
-               struct {
-                       enum lttng_syscall_entryexit entryexit;
-                       enum lttng_syscall_abi abi;
-                       struct hlist_node node;                 /* chain registered syscall event_notifier */
-                       unsigned int syscall_id;
-               } syscall;
+struct lttng_kernel_event_notifier_private;
 
-       } u;
+struct lttng_kernel_event_notifier {
+       struct lttng_kernel_event_common parent;
+       struct lttng_kernel_event_notifier_private *priv;       /* Private event notifier interface */
 
-       /* Backward references: list of lttng_enabler_ref (ref to enablers) */
-       struct list_head enablers_ref_head;
-       struct hlist_node hlist;        /* session ht of event_notifiers */
-       /* list of struct lttng_bytecode_runtime, sorted by seqnum */
-       struct list_head filter_bytecode_runtime_head;
-       size_t num_captures;
-       struct list_head capture_bytecode_runtime_head;
-       int has_enablers_without_bytecode;
-       int eval_capture;               /* Should evaluate capture */
-
-       void (*send_notification)(struct lttng_event_notifier *event_notifier,
-                       struct lttng_probe_ctx *lttng_probe_ctx,
-                       const char *interpreter_stack_data,
-                       struct lttng_kernel_notifier_ctx *notif_ctx);
-       struct lttng_event_notifier_group *group; /* Weak ref */
+       int eval_capture;                               /* Need to evaluate capture */
+       void (*notification_send)(struct lttng_kernel_event_notifier *event_notifier,
+               struct lttng_probe_ctx *probe_ctx,
+               const char *stack_data,
+               struct lttng_kernel_notification_ctx *notif_ctx);
 };
 
 enum lttng_enabler_format_type {
@@ -567,11 +532,6 @@ struct lttng_event_enabler {
        struct lttng_enabler base;
        struct list_head node;  /* per-session list of enablers */
        struct lttng_channel *chan;
-       /*
-        * Unused, but kept around to make it explicit that the tracer can do
-        * it.
-        */
-       struct lttng_kernel_ctx *ctx;
 };
 
 struct lttng_event_notifier_enabler {
@@ -848,8 +808,8 @@ struct lttng_event_notifier_group {
        struct lib_ring_buffer *buf;    /* Ring buffer for event notifier group. */
        wait_queue_head_t read_wait;
        struct irq_work wakeup_pending; /* Pending wakeup irq work. */
-       struct lttng_event_notifier *sc_unknown;        /* for unknown syscalls */
-       struct lttng_event_notifier *sc_compat_unknown;
+       struct lttng_kernel_event_notifier *sc_unknown; /* for unknown syscalls */
+       struct lttng_kernel_event_notifier *sc_compat_unknown;
 
        struct lttng_syscall_filter *sc_filter;
 
@@ -952,45 +912,40 @@ struct lttng_channel *lttng_global_channel_create(struct lttng_session *session,
                                       unsigned int read_timer_interval);
 
 void lttng_metadata_channel_destroy(struct lttng_channel *chan);
-struct lttng_event *lttng_event_create(struct lttng_channel *chan,
+struct lttng_kernel_event_recorder *lttng_kernel_event_recorder_create(struct lttng_channel *chan,
                                struct lttng_kernel_abi_event *event_param,
-                               void *filter,
                                const struct lttng_kernel_event_desc *event_desc,
                                enum lttng_kernel_abi_instrumentation itype);
-struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
+struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct lttng_channel *chan,
                                struct lttng_kernel_abi_event *event_param,
-                               void *filter,
                                const struct lttng_kernel_event_desc *event_desc,
                                enum lttng_kernel_abi_instrumentation itype);
-struct lttng_event *lttng_event_compat_old_create(struct lttng_channel *chan,
+struct lttng_kernel_event_recorder *lttng_event_compat_old_create(struct lttng_channel *chan,
                struct lttng_kernel_abi_old_event *old_event_param,
-               void *filter,
                const struct lttng_kernel_event_desc *internal_desc);
 
-struct lttng_event_notifier *lttng_event_notifier_create(
+struct lttng_kernel_event_notifier *lttng_event_notifier_create(
                                const struct lttng_kernel_event_desc *event_notifier_desc,
                                uint64_t id,
                                uint64_t error_counter_idx,
                                struct lttng_event_notifier_group *event_notifier_group,
                                struct lttng_kernel_abi_event_notifier *event_notifier_param,
-                               void *filter,
                                enum lttng_kernel_abi_instrumentation itype);
-struct lttng_event_notifier *_lttng_event_notifier_create(
+struct lttng_kernel_event_notifier *_lttng_event_notifier_create(
                                const struct lttng_kernel_event_desc *event_notifier_desc,
                                uint64_t id,
                                uint64_t error_counter_idx,
                                struct lttng_event_notifier_group *event_notifier_group,
                                struct lttng_kernel_abi_event_notifier *event_notifier_param,
-                               void *filter,
                                enum lttng_kernel_abi_instrumentation itype);
 
 int lttng_channel_enable(struct lttng_channel *channel);
 int lttng_channel_disable(struct lttng_channel *channel);
-int lttng_event_enable(struct lttng_event *event);
-int lttng_event_disable(struct lttng_event *event);
+int lttng_event_enable(struct lttng_kernel_event_recorder *event);
+int lttng_event_disable(struct lttng_kernel_event_recorder *event);
 
-int lttng_event_notifier_enable(struct lttng_event_notifier *event_notifier);
-int lttng_event_notifier_disable(struct lttng_event_notifier *event_notifier);
+int lttng_event_notifier_enable(struct lttng_kernel_event_notifier *event_notifier);
+int lttng_event_notifier_disable(struct lttng_kernel_event_notifier *event_notifier);
 
 void lttng_transport_register(struct lttng_transport *transport);
 void lttng_transport_unregister(struct lttng_transport *transport);
@@ -1036,30 +991,29 @@ int lttng_desc_match_enabler(const struct lttng_kernel_event_desc *desc,
                struct lttng_enabler *enabler);
 
 #if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
-int lttng_syscalls_register_event(struct lttng_event_enabler *event_enabler, void *filter);
+int lttng_syscalls_register_event(struct lttng_event_enabler *event_enabler);
 int lttng_syscalls_unregister_channel(struct lttng_channel *chan);
 int lttng_syscalls_destroy_event(struct lttng_channel *chan);
 int lttng_syscall_filter_enable_event(
                struct lttng_channel *chan,
-               struct lttng_event *event);
+               struct lttng_kernel_event_recorder *event);
 int lttng_syscall_filter_disable_event(
                struct lttng_channel *chan,
-               struct lttng_event *event);
+               struct lttng_kernel_event_recorder *event);
 
 long lttng_channel_syscall_mask(struct lttng_channel *channel,
                struct lttng_kernel_abi_syscall_mask __user *usyscall_mask);
 
 int lttng_syscalls_register_event_notifier(
-               struct lttng_event_notifier_enabler *event_notifier_enabler,
-               void *filter);
-int lttng_syscals_create_matching_event_notifiers(
-               struct lttng_event_notifier_enabler *event_notifier_enabler, void *filter);
+               struct lttng_event_notifier_enabler *event_notifier_enabler);
+int lttng_syscalls_create_matching_event_notifiers(
+               struct lttng_event_notifier_enabler *event_notifier_enabler);
 int lttng_syscalls_unregister_event_notifier_group(struct lttng_event_notifier_group *group);
-int lttng_syscall_filter_enable_event_notifier(struct lttng_event_notifier *event_notifier);
-int lttng_syscall_filter_disable_event_notifier(struct lttng_event_notifier *event_notifier);
+int lttng_syscall_filter_enable_event_notifier(struct lttng_kernel_event_notifier *event_notifier);
+int lttng_syscall_filter_disable_event_notifier(struct lttng_kernel_event_notifier *event_notifier);
 #else
 static inline int lttng_syscalls_register_event(
-               struct lttng_event_enabler *event_enabler, void *filter)
+               struct lttng_event_enabler *event_enabler)
 {
        return -ENOSYS;
 }
@@ -1075,13 +1029,13 @@ static inline int lttng_syscalls_destroy(struct lttng_channel *chan)
 }
 
 static inline int lttng_syscall_filter_enable_event(struct lttng_channel *chan,
-               struct lttng_event *event);
+               struct lttng_kernel_event_recorder *event);
 {
        return -ENOSYS;
 }
 
 static inline int lttng_syscall_filter_disable_event(struct lttng_channel *chan,
-               struct lttng_event *event);
+               struct lttng_kernel_event_recorder *event);
 {
        return -ENOSYS;
 }
@@ -1093,7 +1047,7 @@ static inline long lttng_channel_syscall_mask(struct lttng_channel *channel,
 }
 
 static inline int lttng_syscalls_register_event_notifier(
-               struct lttng_event_notifier_group *group, void *filter)
+               struct lttng_event_notifier_group *group)
 {
        return -ENOSYS;
 }
@@ -1133,8 +1087,8 @@ void lttng_enabler_link_bytecode(const struct lttng_kernel_event_desc *event_des
                struct lttng_kernel_ctx *ctx,
                struct list_head *instance_bytecode_runtime_head,
                struct list_head *enabler_bytecode_runtime_head);
-void lttng_free_event_filter_runtime(struct lttng_event *event);
-void lttng_free_event_notifier_filter_runtime(struct lttng_event_notifier *event_notifier);
+void lttng_free_event_filter_runtime(struct lttng_kernel_event_recorder *event);
+void lttng_free_event_notifier_filter_runtime(struct lttng_kernel_event_notifier *event_notifier);
 
 int lttng_probes_init(void);
 
@@ -1328,33 +1282,33 @@ int lttng_kprobes_register_event(const char *name,
                const char *symbol_name,
                uint64_t offset,
                uint64_t addr,
-               struct lttng_event *event);
-void lttng_kprobes_unregister_event(struct lttng_event *event);
-void lttng_kprobes_destroy_event_private(struct lttng_event *event);
+               struct lttng_kernel_event_recorder *event);
+void lttng_kprobes_unregister_event(struct lttng_kernel_event_recorder *event);
+void lttng_kprobes_destroy_event_private(struct lttng_kernel_event_recorder *event);
 int lttng_kprobes_register_event_notifier(const char *symbol_name,
                uint64_t offset,
                uint64_t addr,
-               struct lttng_event_notifier *event_notifier);
-void lttng_kprobes_unregister_event_notifier(struct lttng_event_notifier *event_notifier);
-void lttng_kprobes_destroy_event_notifier_private(struct lttng_event_notifier *event_notifier);
+               struct lttng_kernel_event_notifier *event_notifier);
+void lttng_kprobes_unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier);
+void lttng_kprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier);
 #else
 static inline
 int lttng_kprobes_register_event(const char *name,
                const char *symbol_name,
                uint64_t offset,
                uint64_t addr,
-               struct lttng_event *event)
+               struct lttng_kernel_event_recorder *event)
 {
        return -ENOSYS;
 }
 
 static inline
-void lttng_kprobes_unregister_event(struct lttng_event *event)
+void lttng_kprobes_unregister_event(struct lttng_kernel_event_recorder *event)
 {
 }
 
 static inline
-void lttng_kprobes_destroy_event_private(struct lttng_event *event)
+void lttng_kprobes_destroy_event_private(struct lttng_kernel_event_recorder *event)
 {
 }
 
@@ -1362,87 +1316,87 @@ static inline
 int lttng_kprobes_register_event_notifier(const char *symbol_name,
                uint64_t offset,
                uint64_t addr,
-               struct lttng_event_notifier *event_notifier)
+               struct lttng_kernel_event_notifier *event_notifier)
 {
        return -ENOSYS;
 }
 
 static inline
-void lttng_kprobes_unregister_event_notifier(struct lttng_event_notifier *event_notifier)
+void lttng_kprobes_unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier)
 {
 }
 
 static inline
-void lttng_kprobes_destroy_event_notifier_private(struct lttng_event_notifier *event_notifier)
+void lttng_kprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier)
 {
 }
 #endif
 
-int lttng_event_add_callsite(struct lttng_event *event,
+int lttng_event_add_callsite(struct lttng_kernel_event_recorder *event,
        struct lttng_kernel_abi_event_callsite __user *callsite);
 
-int lttng_event_notifier_add_callsite(struct lttng_event_notifier *event_notifier,
+int lttng_event_notifier_add_callsite(struct lttng_kernel_event_notifier *event_notifier,
        struct lttng_kernel_abi_event_callsite __user *callsite);
 
 #ifdef CONFIG_UPROBES
 int lttng_uprobes_register_event(const char *name,
-       int fd, struct lttng_event *event);
-int lttng_uprobes_event_add_callsite(struct lttng_event *event,
+       int fd, struct lttng_kernel_event_recorder *event);
+int lttng_uprobes_event_add_callsite(struct lttng_kernel_event_recorder *event,
        struct lttng_kernel_abi_event_callsite __user *callsite);
-void lttng_uprobes_unregister_event(struct lttng_event *event);
-void lttng_uprobes_destroy_event_private(struct lttng_event *event);
+void lttng_uprobes_unregister_event(struct lttng_kernel_event_recorder *event);
+void lttng_uprobes_destroy_event_private(struct lttng_kernel_event_recorder *event);
 int lttng_uprobes_register_event_notifier(const char *name,
-       int fd, struct lttng_event_notifier *event_notifier);
-int lttng_uprobes_event_notifier_add_callsite(struct lttng_event_notifier *event_notifier,
+       int fd, struct lttng_kernel_event_notifier *event_notifier);
+int lttng_uprobes_event_notifier_add_callsite(struct lttng_kernel_event_notifier *event_notifier,
        struct lttng_kernel_abi_event_callsite __user *callsite);
-void lttng_uprobes_unregister_event_notifier(struct lttng_event_notifier *event_notifier);
-void lttng_uprobes_destroy_event_notifier_private(struct lttng_event_notifier *event_notifier);
+void lttng_uprobes_unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier);
+void lttng_uprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier);
 #else
 static inline
 int lttng_uprobes_register_event(const char *name,
-       int fd, struct lttng_event *event)
+       int fd, struct lttng_kernel_event_recorder *event)
 {
        return -ENOSYS;
 }
 
 static inline
-int lttng_uprobes_event_add_callsite(struct lttng_event *event,
+int lttng_uprobes_event_add_callsite(struct lttng_kernel_event_recorder *event,
        struct lttng_kernel_abi_event_callsite __user *callsite)
 {
        return -ENOSYS;
 }
 
 static inline
-void lttng_uprobes_unregister_event(struct lttng_event *event)
+void lttng_uprobes_unregister_event(struct lttng_kernel_event_recorder *event)
 {
 }
 
 static inline
-void lttng_uprobes_destroy_event_private(struct lttng_event *event)
+void lttng_uprobes_destroy_event_private(struct lttng_kernel_event_recorder *event)
 {
 }
 
 static inline
 int lttng_uprobes_register_event_notifier(const char *name,
-       int fd, struct lttng_event_notifier *event_notifier)
+       int fd, struct lttng_kernel_event_notifier *event_notifier)
 {
        return -ENOSYS;
 }
 
 static inline
-int lttng_uprobes_event_notifier_add_callsite(struct lttng_event_notifier *event_notifier,
+int lttng_uprobes_event_notifier_add_callsite(struct lttng_kernel_event_notifier *event_notifier,
        struct lttng_kernel_abi_event_callsite __user *callsite)
 {
        return -ENOSYS;
 }
 
 static inline
-void lttng_uprobes_unregister_event_notifier(struct lttng_event_notifier *event_notifier)
+void lttng_uprobes_unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier)
 {
 }
 
 static inline
-void lttng_uprobes_destroy_event_notifier_private(struct lttng_event_notifier *event_notifier)
+void lttng_uprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier)
 {
 }
 #endif
@@ -1452,11 +1406,11 @@ int lttng_kretprobes_register(const char *name,
                const char *symbol_name,
                uint64_t offset,
                uint64_t addr,
-               struct lttng_event *event_entry,
-               struct lttng_event *event_exit);
-void lttng_kretprobes_unregister(struct lttng_event *event);
-void lttng_kretprobes_destroy_private(struct lttng_event *event);
-int lttng_kretprobes_event_enable_state(struct lttng_event *event,
+               struct lttng_kernel_event_recorder *event_entry,
+               struct lttng_kernel_event_recorder *event_exit);
+void lttng_kretprobes_unregister(struct lttng_kernel_event_recorder *event);
+void lttng_kretprobes_destroy_private(struct lttng_kernel_event_recorder *event);
+int lttng_kretprobes_event_enable_state(struct lttng_kernel_event_recorder *event,
        int enable);
 #else
 static inline
@@ -1464,24 +1418,24 @@ int lttng_kretprobes_register(const char *name,
                const char *symbol_name,
                uint64_t offset,
                uint64_t addr,
-               struct lttng_event *event_entry,
-               struct lttng_event *event_exit)
+               struct lttng_kernel_event_recorder *event_entry,
+               struct lttng_kernel_event_recorder *event_exit)
 {
        return -ENOSYS;
 }
 
 static inline
-void lttng_kretprobes_unregister(struct lttng_event *event)
+void lttng_kretprobes_unregister(struct lttng_kernel_event_recorder *event)
 {
 }
 
 static inline
-void lttng_kretprobes_destroy_private(struct lttng_event *event)
+void lttng_kretprobes_destroy_private(struct lttng_kernel_event_recorder *event)
 {
 }
 
 static inline
-int lttng_kretprobes_event_enable_state(struct lttng_event *event,
+int lttng_kretprobes_event_enable_state(struct lttng_kernel_event_recorder *event,
        int enable)
 {
        return -ENOSYS;
index fd16f64179197b08027bb902b7b689f1c8c3f5f7..c9674a35404c5b550564237014c603bc94f166e4 100644 (file)
@@ -20,6 +20,7 @@
 #include <lttng/types.h>
 #include <lttng/probe-user.h>
 #include <lttng/events.h>
+#include <lttng/events-internal.h>     /* TODO: remove this include after refactoring is done. */
 #include <lttng/tracer-core.h>
 #include <lttng/tp-mempool.h>
 
@@ -1059,13 +1060,13 @@ static inline size_t __event_get_align__##_name(void *__tp_locvar)            \
 static void __event_probe__##_name(void *__data, _proto)                     \
 {                                                                            \
        struct probe_local_vars { _locvar };                                  \
-       struct lttng_event *__event = __data;                                 \
+       struct lttng_kernel_event_recorder *__event_recorder = __data;        \
        struct lttng_probe_ctx __lttng_probe_ctx = {                          \
-               .event = __event,                                             \
+               .event = __event_recorder,                                    \
                .event_notifier = NULL,                                       \
                .interruptible = !irqs_disabled(),                            \
        };                                                                    \
-       struct lttng_channel *__chan = __event->chan;                         \
+       struct lttng_channel *__chan = __event_recorder->chan;                \
        struct lttng_session *__session = __chan->session;                    \
        struct lib_ring_buffer_ctx __ctx;                                     \
        ssize_t __event_len;                                                  \
@@ -1087,7 +1088,7 @@ static void __event_probe__##_name(void *__data, _proto)                \
                return;                                                       \
        if (unlikely(!LTTNG_READ_ONCE(__chan->enabled)))                      \
                return;                                                       \
-       if (unlikely(!LTTNG_READ_ONCE(__event->enabled)))                     \
+       if (unlikely(!LTTNG_READ_ONCE(__event_recorder->parent.enabled)))     \
                return;                                                       \
        __lf = lttng_rcu_dereference(__session->pid_tracker.p);               \
        if (__lf && likely(!lttng_id_tracker_lookup(__lf, current->tgid)))    \
@@ -1114,13 +1115,13 @@ static void __event_probe__##_name(void *__data, _proto)                      \
        __orig_dynamic_len_offset = this_cpu_ptr(&lttng_dynamic_len_stack)->offset; \
        __dynamic_len_idx = __orig_dynamic_len_offset;                        \
        _code_pre                                                             \
-       if (unlikely(!list_empty(&__event->filter_bytecode_runtime_head))) {          \
+       if (unlikely(!list_empty(&__event_recorder->priv->parent.filter_bytecode_runtime_head))) { \
                struct lttng_bytecode_runtime *bc_runtime;                    \
-               int __filter_record = __event->has_enablers_without_bytecode; \
+               int __filter_record = __event_recorder->priv->parent.has_enablers_without_filter_bytecode; \
                                                                              \
                __event_prepare_interpreter_stack__##_name(__stackvar.__filter_stack_data, \
                                tp_locvar, _args);                                    \
-               lttng_list_for_each_entry_rcu(bc_runtime, &__event->filter_bytecode_runtime_head, node) { \
+               lttng_list_for_each_entry_rcu(bc_runtime, &__event_recorder->priv->parent.filter_bytecode_runtime_head, node) { \
                        if (unlikely(bc_runtime->interpreter_funcs.filter(bc_runtime, &__lttng_probe_ctx,             \
                                        __stackvar.__filter_stack_data) & LTTNG_INTERPRETER_RECORD_FLAG)) { \
                                __filter_record = 1;                          \
@@ -1138,7 +1139,7 @@ static void __event_probe__##_name(void *__data, _proto)                \
        __event_align = __event_get_align__##_name(tp_locvar, _args);         \
        lib_ring_buffer_ctx_init(&__ctx, __chan->chan, &__lttng_probe_ctx, __event_len,  \
                                 __event_align, -1);                          \
-       __ret = __chan->ops->event_reserve(&__ctx, __event->id);              \
+       __ret = __chan->ops->event_reserve(&__ctx, __event_recorder->priv->id); \
        if (__ret < 0)                                                        \
                goto __post;                                                  \
        _fields                                                               \
@@ -1155,13 +1156,13 @@ __post:                                                                       \
 static void __event_probe__##_name(void *__data)                             \
 {                                                                            \
        struct probe_local_vars { _locvar };                                  \
-       struct lttng_event *__event = __data;                                 \
+       struct lttng_kernel_event_recorder *__event_recorder = __data;        \
        struct lttng_probe_ctx __lttng_probe_ctx = {                          \
-               .event = __event,                                             \
+               .event = __event_recorder,                                    \
                .event_notifier = NULL,                                       \
                .interruptible = !irqs_disabled(),                            \
        };                                                                    \
-       struct lttng_channel *__chan = __event->chan;                         \
+       struct lttng_channel *__chan = __event_recorder->chan;                \
        struct lttng_session *__session = __chan->session;                    \
        struct lib_ring_buffer_ctx __ctx;                                     \
        ssize_t __event_len;                                                  \
@@ -1183,7 +1184,7 @@ static void __event_probe__##_name(void *__data)                        \
                return;                                                       \
        if (unlikely(!LTTNG_READ_ONCE(__chan->enabled)))                      \
                return;                                                       \
-       if (unlikely(!LTTNG_READ_ONCE(__event->enabled)))                     \
+       if (unlikely(!LTTNG_READ_ONCE(__event_recorder->parent.enabled)))     \
                return;                                                       \
        __lf = lttng_rcu_dereference(__session->pid_tracker.p);               \
        if (__lf && likely(!lttng_id_tracker_lookup(__lf, current->tgid)))    \
@@ -1210,13 +1211,13 @@ static void __event_probe__##_name(void *__data)                              \
        __orig_dynamic_len_offset = this_cpu_ptr(&lttng_dynamic_len_stack)->offset; \
        __dynamic_len_idx = __orig_dynamic_len_offset;                        \
        _code_pre                                                             \
-       if (unlikely(!list_empty(&__event->filter_bytecode_runtime_head))) {          \
+       if (unlikely(!list_empty(&__event_recorder->priv->parent.filter_bytecode_runtime_head))) { \
                struct lttng_bytecode_runtime *bc_runtime;                    \
-               int __filter_record = __event->has_enablers_without_bytecode; \
+               int __filter_record = __event_recorder->priv->parent.has_enablers_without_filter_bytecode; \
                                                                              \
                __event_prepare_interpreter_stack__##_name(__stackvar.__filter_stack_data, \
                                tp_locvar);                                   \
-               lttng_list_for_each_entry_rcu(bc_runtime, &__event->filter_bytecode_runtime_head, node) { \
+               lttng_list_for_each_entry_rcu(bc_runtime, &__event_recorder->priv->parent.filter_bytecode_runtime_head, node) { \
                        if (unlikely(bc_runtime->interpreter_funcs.filter(bc_runtime, &__lttng_probe_ctx,       \
                                        __stackvar.__filter_stack_data) & LTTNG_INTERPRETER_RECORD_FLAG)) { \
                                __filter_record = 1;                          \
@@ -1234,7 +1235,7 @@ static void __event_probe__##_name(void *__data)                        \
        __event_align = __event_get_align__##_name(tp_locvar);                \
        lib_ring_buffer_ctx_init(&__ctx, __chan->chan, &__lttng_probe_ctx, __event_len,  \
                                 __event_align, -1);                          \
-       __ret = __chan->ops->event_reserve(&__ctx, __event->id);              \
+       __ret = __chan->ops->event_reserve(&__ctx, __event_recorder->priv->id);       \
        if (__ret < 0)                                                        \
                goto __post;                                                  \
        _fields                                                               \
@@ -1289,7 +1290,7 @@ __post:                                                                         \
 static void __event_notifier_probe__##_name(void *__data, _proto)            \
 {                                                                            \
        struct probe_local_vars { _locvar };                                  \
-       struct lttng_event_notifier *__event_notifier = __data;               \
+       struct lttng_kernel_event_notifier *__event_notifier = __data;                \
        struct lttng_probe_ctx __lttng_probe_ctx = {                          \
                .event = NULL,                                                \
                .event_notifier = __event_notifier,                           \
@@ -1302,20 +1303,20 @@ static void __event_notifier_probe__##_name(void *__data, _proto)             \
        struct probe_local_vars __tp_locvar;                                  \
        struct probe_local_vars *tp_locvar __attribute__((unused)) =          \
                        &__tp_locvar;                                         \
-       struct lttng_kernel_notifier_ctx __notif_ctx;                         \
+       struct lttng_kernel_notification_ctx __notif_ctx;                             \
        bool __interpreter_stack_prepared = false;                            \
                                                                              \
-       if (unlikely(!READ_ONCE(__event_notifier->enabled)))                  \
+       if (unlikely(!READ_ONCE(__event_notifier->parent.enabled)))           \
                return;                                                       \
        _code_pre                                                             \
-       if (unlikely(!list_empty(&__event_notifier->filter_bytecode_runtime_head))) {   \
+       if (unlikely(!list_empty(&__event_notifier->priv->parent.filter_bytecode_runtime_head))) { \
                struct lttng_bytecode_runtime *bc_runtime;                    \
-               int __filter_record = __event_notifier->has_enablers_without_bytecode;  \
+               int __filter_record = __event_notifier->priv->parent.has_enablers_without_filter_bytecode; \
                                                                              \
                __event_prepare_interpreter_stack__##_name(__stackvar.__interpreter_stack_data, \
                                tp_locvar, _args);                            \
                __interpreter_stack_prepared = true;                          \
-               lttng_list_for_each_entry_rcu(bc_runtime, &__event_notifier->filter_bytecode_runtime_head, node) { \
+               lttng_list_for_each_entry_rcu(bc_runtime, &__event_notifier->priv->parent.filter_bytecode_runtime_head, node) { \
                        if (unlikely(bc_runtime->interpreter_funcs.filter(bc_runtime, &__lttng_probe_ctx,       \
                                        __stackvar.__interpreter_stack_data) & LTTNG_INTERPRETER_RECORD_FLAG))  \
                                __filter_record = 1;                          \
@@ -1330,7 +1331,7 @@ static void __event_notifier_probe__##_name(void *__data, _proto)       \
                                __stackvar.__interpreter_stack_data,          \
                                tp_locvar, _args);                            \
                                                                              \
-       __event_notifier->send_notification(__event_notifier,                 \
+       __event_notifier->notification_send(__event_notifier,                 \
                        &__lttng_probe_ctx,                                   \
                        __stackvar.__interpreter_stack_data,                  \
                        &__notif_ctx);                                        \
@@ -1345,7 +1346,7 @@ __post:                                                                         \
 static void __event_notifier_probe__##_name(void *__data)                    \
 {                                                                            \
        struct probe_local_vars { _locvar };                                  \
-       struct lttng_event_notifier *__event_notifier = __data;               \
+       struct lttng_kernel_event_notifier *__event_notifier = __data;        \
        struct lttng_probe_ctx __lttng_probe_ctx = {                          \
                .event = NULL,                                                \
                .event_notifier = __event_notifier,                           \
@@ -1358,20 +1359,20 @@ static void __event_notifier_probe__##_name(void *__data)                     \
        struct probe_local_vars __tp_locvar;                                  \
        struct probe_local_vars *tp_locvar __attribute__((unused)) =          \
                        &__tp_locvar;                                         \
-       struct lttng_kernel_notifier_ctx __notif_ctx;                         \
+       struct lttng_kernel_notification_ctx __notif_ctx;                             \
        bool __interpreter_stack_prepared = false;                            \
                                                                              \
-       if (unlikely(!READ_ONCE(__event_notifier->enabled)))                  \
+       if (unlikely(!READ_ONCE(__event_notifier->parent.enabled)))           \
                return;                                                       \
        _code_pre                                                             \
-       if (unlikely(!list_empty(&__event_notifier->filter_bytecode_runtime_head))) {   \
+       if (unlikely(!list_empty(&__event_notifier->priv->parent.filter_bytecode_runtime_head))) { \
                struct lttng_bytecode_runtime *bc_runtime;                    \
-               int __filter_record = __event_notifier->has_enablers_without_bytecode;  \
+               int __filter_record = __event_notifier->priv->parent.has_enablers_without_filter_bytecode; \
                                                                              \
                __event_prepare_interpreter_stack__##_name(__stackvar.__interpreter_stack_data, \
                                tp_locvar);                                   \
                __interpreter_stack_prepared = true;                          \
-               lttng_list_for_each_entry_rcu(bc_runtime, &__event_notifier->filter_bytecode_runtime_head, node) { \
+               lttng_list_for_each_entry_rcu(bc_runtime, &__event_notifier->priv->parent.filter_bytecode_runtime_head, node) { \
                        if (unlikely(bc_runtime->interpreter_funcs.filter(bc_runtime, &__lttng_probe_ctx,       \
                                        __stackvar.__interpreter_stack_data) & LTTNG_INTERPRETER_RECORD_FLAG))  \
                                __filter_record = 1;                          \
@@ -1386,7 +1387,7 @@ static void __event_notifier_probe__##_name(void *__data)               \
                                __stackvar.__interpreter_stack_data,          \
                                tp_locvar);                                   \
                                                                              \
-       __event_notifier->send_notification(__event_notifier,                 \
+       __event_notifier->notification_send(__event_notifier,                 \
                        &__lttng_probe_ctx,                                   \
                        __stackvar.__interpreter_stack_data,                  \
                        &__notif_ctx);                                        \
index 9f06295ffa6981d9de6bf4182f8d57be74c825f9..e06a98b478075e8790236d0cb6ec63b11f221ce1 100644 (file)
@@ -1860,15 +1860,14 @@ int lttng_abi_create_event(struct file *channel_file,
        case LTTNG_KERNEL_ABI_KRETPROBE:                /* Fall-through */
        case LTTNG_KERNEL_ABI_UPROBE:
        {
-               struct lttng_event *event;
+               struct lttng_kernel_event_recorder *event;
 
                /*
                 * We tolerate no failure path after event creation. It
                 * will stay invariant for the rest of the session.
                 */
-               event = lttng_event_create(channel, event_param,
-                               NULL, NULL,
-                               event_param->instrumentation);
+               event = lttng_kernel_event_recorder_create(channel, event_param,
+                               NULL, event_param->instrumentation);
                WARN_ON_ONCE(!event);
                if (IS_ERR(event)) {
                        ret = PTR_ERR(event);
@@ -1901,7 +1900,7 @@ fd_error:
 static
 long lttng_event_notifier_event_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
-       struct lttng_event_notifier *event_notifier = file->private_data;
+       struct lttng_kernel_event_notifier *event_notifier = file->private_data;
 
        switch (cmd) {
        case LTTNG_KERNEL_ABI_ENABLE:
@@ -1948,10 +1947,10 @@ long lttng_event_notifier_enabler_ioctl(struct file *file, unsigned int cmd, uns
 static
 int lttng_event_notifier_event_release(struct inode *inode, struct file *file)
 {
-       struct lttng_event_notifier *event_notifier = file->private_data;
+       struct lttng_kernel_event_notifier *event_notifier = file->private_data;
 
        if (event_notifier)
-               fput(event_notifier->group->file);
+               fput(event_notifier->priv->group->file);
        return 0;
 }
 
@@ -2084,7 +2083,7 @@ int lttng_abi_create_event_notifier(struct file *event_notifier_group_file,
        case LTTNG_KERNEL_ABI_KRETPROBE:                /* Fall-through */
        case LTTNG_KERNEL_ABI_UPROBE:
        {
-               struct lttng_event_notifier *event_notifier;
+               struct lttng_kernel_event_notifier *event_notifier;
 
                /*
                 * We tolerate no failure path after event notifier creation.
@@ -2094,7 +2093,7 @@ int lttng_abi_create_event_notifier(struct file *event_notifier_group_file,
                                event_notifier_param->event.token,
                                event_notifier_param->error_counter_index,
                                event_notifier_group,
-                               event_notifier_param, NULL,
+                               event_notifier_param,
                                event_notifier_param->event.instrumentation);
                WARN_ON_ONCE(!event_notifier);
                if (IS_ERR(event_notifier)) {
@@ -2583,7 +2582,7 @@ static const struct file_operations lttng_metadata_fops = {
 static
 long lttng_event_recorder_event_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
-       struct lttng_event *event = file->private_data;
+       struct lttng_kernel_event_recorder *event = file->private_data;
 
        switch (cmd) {
        case LTTNG_KERNEL_ABI_OLD_CONTEXT:
@@ -2663,7 +2662,7 @@ long lttng_event_recorder_enabler_ioctl(struct file *file, unsigned int cmd, uns
 static
 int lttng_event_recorder_event_release(struct inode *inode, struct file *file)
 {
-       struct lttng_event *event = file->private_data;
+       struct lttng_kernel_event_recorder *event = file->private_data;
 
        if (event)
                fput(event->chan->file);
index 49ecd77a118d619e5298aff9eddeb8ffcfa51dd5..cd95e59ed14b1fd453251501b6eb198c3640939a 100644 (file)
@@ -624,23 +624,23 @@ void lttng_free_enabler_filter_bytecode(struct lttng_enabler *enabler)
        }
 }
 
-void lttng_free_event_filter_runtime(struct lttng_event *event)
+void lttng_free_event_filter_runtime(struct lttng_kernel_event_recorder *event_recorder)
 {
        struct bytecode_runtime *runtime, *tmp;
 
        list_for_each_entry_safe(runtime, tmp,
-                       &event->filter_bytecode_runtime_head, p.node) {
+                       &event_recorder->priv->parent.filter_bytecode_runtime_head, p.node) {
                kfree(runtime->data);
                kfree(runtime);
        }
 }
 
-void lttng_free_event_notifier_filter_runtime(struct lttng_event_notifier *event_notifier)
+void lttng_free_event_notifier_filter_runtime(struct lttng_kernel_event_notifier *event_notifier)
 {
        struct bytecode_runtime *runtime, *tmp;
 
        list_for_each_entry_safe(runtime, tmp,
-                       &event_notifier->filter_bytecode_runtime_head, p.node) {
+                       &event_notifier->priv->parent.filter_bytecode_runtime_head, p.node) {
                kfree(runtime->data);
                kfree(runtime);
        }
index d10f0fdabec3772b292fa3eb063ca58da8837e5c..be481e4b7ca0689675ff3558e5f4295b4689d8c1 100644 (file)
@@ -325,18 +325,18 @@ int notification_append_empty_capture(
 
 static
 int notification_init(struct lttng_event_notifier_notification *notif,
-               struct lttng_event_notifier *event_notifier)
+               struct lttng_kernel_event_notifier *event_notifier)
 {
        struct lttng_msgpack_writer *writer = &notif->writer;
        int ret = 0;
 
        notif->has_captures = false;
 
-       if (event_notifier->num_captures > 0) {
+       if (event_notifier->priv->num_captures > 0) {
                lttng_msgpack_writer_init(writer, notif->capture_buf,
                                CAPTURE_BUFFER_SIZE);
 
-               ret = lttng_msgpack_begin_array(writer, event_notifier->num_captures);
+               ret = lttng_msgpack_begin_array(writer, event_notifier->priv->num_captures);
                if (ret) {
                        WARN_ON_ONCE(1);
                        goto end;
@@ -350,10 +350,10 @@ end:
 }
 
 static
-void record_error(struct lttng_event_notifier *event_notifier)
+void record_error(struct lttng_kernel_event_notifier *event_notifier)
 {
 
-       struct lttng_event_notifier_group *event_notifier_group = event_notifier->group;
+       struct lttng_event_notifier_group *event_notifier_group = event_notifier->priv->group;
        struct lttng_counter *error_counter;
        size_t dimension_index[1];
        int ret;
@@ -368,7 +368,7 @@ void record_error(struct lttng_event_notifier *event_notifier)
        if (!error_counter)
                return;
 
-       dimension_index[0] = event_notifier->error_counter_index;
+       dimension_index[0] = event_notifier->priv->error_counter_index;
 
        ret = error_counter->ops->counter_add(error_counter->counter,
                        dimension_index, 1);
@@ -378,16 +378,16 @@ void record_error(struct lttng_event_notifier *event_notifier)
 
 static
 void notification_send(struct lttng_event_notifier_notification *notif,
-               struct lttng_event_notifier *event_notifier)
+               struct lttng_kernel_event_notifier *event_notifier)
 {
-       struct lttng_event_notifier_group *event_notifier_group = event_notifier->group;
+       struct lttng_event_notifier_group *event_notifier_group = event_notifier->priv->group;
        struct lib_ring_buffer_ctx ctx;
        struct lttng_kernel_abi_event_notifier_notification kernel_notif;
        size_t capture_buffer_content_len, reserve_size;
        int ret;
 
        reserve_size = sizeof(kernel_notif);
-       kernel_notif.token = event_notifier->user_token;
+       kernel_notif.token = event_notifier->priv->parent.user_token;
 
        if (notif->has_captures) {
                capture_buffer_content_len = notif->writer.write_pos - notif->writer.buffer;
@@ -425,15 +425,15 @@ void notification_send(struct lttng_event_notifier_notification *notif,
        irq_work_queue(&event_notifier_group->wakeup_pending);
 }
 
-void lttng_event_notifier_notification_send(struct lttng_event_notifier *event_notifier,
-               struct lttng_probe_ctx *lttng_probe_ctx,
+void lttng_event_notifier_notification_send(struct lttng_kernel_event_notifier *event_notifier,
+               struct lttng_probe_ctx *probe_ctx,
                const char *stack_data,
-               struct lttng_kernel_notifier_ctx *notif_ctx)
+               struct lttng_kernel_notification_ctx *notif_ctx)
 {
        struct lttng_event_notifier_notification notif = { 0 };
        int ret;
 
-       if (unlikely(!READ_ONCE(event_notifier->enabled)))
+       if (unlikely(!READ_ONCE(event_notifier->parent.enabled)))
                return;
 
        ret = notification_init(&notif, event_notifier);
@@ -452,11 +452,11 @@ void lttng_event_notifier_notification_send(struct lttng_event_notifier *event_n
                 * fails, append an empty capture to the buffer.
                 */
                list_for_each_entry_rcu(capture_bc_runtime,
-                               &event_notifier->capture_bytecode_runtime_head, node) {
+                               &event_notifier->priv->capture_bytecode_runtime_head, node) {
                        struct lttng_interpreter_output output;
 
-                       if (capture_bc_runtime->interpreter_funcs.capture(capture_bc_runtime,
-                                       lttng_probe_ctx, stack_data, &output) & LTTNG_INTERPRETER_RECORD_FLAG)
+                       if (capture_bc_runtime->interpreter_funcs.capture(capture_bc_runtime, probe_ctx,
+                                       stack_data, &output) & LTTNG_INTERPRETER_RECORD_FLAG)
                                ret = notification_append_capture(&notif, &output);
                        else
                                ret = notification_append_empty_capture(&notif);
index 6676d5f715d873e7490a6422fbc6809d574ebda9..3000e856f56e9634cf985e84afe9db2c2fb7a1d1 100644 (file)
@@ -58,8 +58,10 @@ static LIST_HEAD(lttng_counter_transport_list);
  * Protect the sessions and metadata caches.
  */
 static DEFINE_MUTEX(sessions_mutex);
-static struct kmem_cache *event_cache;
+static struct kmem_cache *event_recorder_cache;
+static struct kmem_cache *event_recorder_private_cache;
 static struct kmem_cache *event_notifier_cache;
+static struct kmem_cache *event_notifier_private_cache;
 
 static void lttng_session_lazy_sync_event_enablers(struct lttng_session *session);
 static void lttng_session_sync_event_enablers(struct lttng_session *session);
@@ -67,15 +69,15 @@ static void lttng_event_enabler_destroy(struct lttng_event_enabler *event_enable
 static void lttng_event_notifier_enabler_destroy(struct lttng_event_notifier_enabler *event_notifier_enabler);
 static void lttng_event_notifier_group_sync_enablers(struct lttng_event_notifier_group *event_notifier_group);
 
-static void _lttng_event_destroy(struct lttng_event *event);
-static void _lttng_event_notifier_destroy(struct lttng_event_notifier *event_notifier);
+static void _lttng_event_destroy(struct lttng_kernel_event_recorder *event);
+static void _lttng_event_notifier_destroy(struct lttng_kernel_event_notifier *event_notifier);
 static void _lttng_channel_destroy(struct lttng_channel *chan);
-static int _lttng_event_unregister(struct lttng_event *event);
-static int _lttng_event_notifier_unregister(struct lttng_event_notifier *event_notifier);
+static int _lttng_event_unregister(struct lttng_kernel_event_recorder *event);
+static int _lttng_event_notifier_unregister(struct lttng_kernel_event_notifier *event_notifier);
 static
 int _lttng_event_metadata_statedump(struct lttng_session *session,
                                  struct lttng_channel *chan,
-                                 struct lttng_event *event);
+                                 struct lttng_kernel_event_recorder *event);
 static
 int _lttng_session_metadata_statedump(struct lttng_session *session);
 static
@@ -331,7 +333,7 @@ void metadata_cache_destroy(struct kref *kref)
 void lttng_session_destroy(struct lttng_session *session)
 {
        struct lttng_channel *chan, *tmpchan;
-       struct lttng_event *event, *tmpevent;
+       struct lttng_kernel_event_recorder_private *event_recorder_priv, *tmpevent_recorder_priv;
        struct lttng_metadata_stream *metadata_stream;
        struct lttng_event_enabler *event_enabler, *tmp_event_enabler;
        int ret;
@@ -342,8 +344,8 @@ void lttng_session_destroy(struct lttng_session *session)
                ret = lttng_syscalls_unregister_channel(chan);
                WARN_ON(ret);
        }
-       list_for_each_entry(event, &session->events, list) {
-               ret = _lttng_event_unregister(event);
+       list_for_each_entry(event_recorder_priv, &session->events, node) {
+               ret = _lttng_event_unregister(event_recorder_priv->pub);
                WARN_ON(ret);
        }
        synchronize_trace();    /* Wait for in-flight events to complete */
@@ -354,8 +356,8 @@ void lttng_session_destroy(struct lttng_session *session)
        list_for_each_entry_safe(event_enabler, tmp_event_enabler,
                        &session->enablers_head, node)
                lttng_event_enabler_destroy(event_enabler);
-       list_for_each_entry_safe(event, tmpevent, &session->events, list)
-               _lttng_event_destroy(event);
+       list_for_each_entry_safe(event_recorder_priv, tmpevent_recorder_priv, &session->events, node)
+               _lttng_event_destroy(event_recorder_priv->pub);
        list_for_each_entry_safe(chan, tmpchan, &session->chan, list) {
                BUG_ON(chan->channel_type == METADATA_CHANNEL);
                _lttng_channel_destroy(chan);
@@ -380,7 +382,7 @@ void lttng_event_notifier_group_destroy(
                struct lttng_event_notifier_group *event_notifier_group)
 {
        struct lttng_event_notifier_enabler *event_notifier_enabler, *tmp_event_notifier_enabler;
-       struct lttng_event_notifier *event_notifier, *tmpevent_notifier;
+       struct lttng_kernel_event_notifier_private *event_notifier_priv, *tmpevent_notifier_priv;
        int ret;
 
        if (!event_notifier_group)
@@ -391,9 +393,9 @@ void lttng_event_notifier_group_destroy(
        ret = lttng_syscalls_unregister_event_notifier_group(event_notifier_group);
        WARN_ON(ret);
 
-       list_for_each_entry_safe(event_notifier, tmpevent_notifier,
-                       &event_notifier_group->event_notifiers_head, list) {
-               ret = _lttng_event_notifier_unregister(event_notifier);
+       list_for_each_entry_safe(event_notifier_priv, tmpevent_notifier_priv,
+                       &event_notifier_group->event_notifiers_head, node) {
+               ret = _lttng_event_notifier_unregister(event_notifier_priv->pub);
                WARN_ON(ret);
        }
 
@@ -408,9 +410,9 @@ void lttng_event_notifier_group_destroy(
                        &event_notifier_group->enablers_head, node)
                lttng_event_notifier_enabler_destroy(event_notifier_enabler);
 
-       list_for_each_entry_safe(event_notifier, tmpevent_notifier,
-                       &event_notifier_group->event_notifiers_head, list)
-               _lttng_event_notifier_destroy(event_notifier);
+       list_for_each_entry_safe(event_notifier_priv, tmpevent_notifier_priv,
+                       &event_notifier_group->event_notifiers_head, node)
+               _lttng_event_notifier_destroy(event_notifier_priv->pub);
 
        if (event_notifier_group->error_counter) {
                struct lttng_counter *error_counter = event_notifier_group->error_counter;
@@ -520,7 +522,7 @@ int lttng_session_metadata_regenerate(struct lttng_session *session)
 {
        int ret = 0;
        struct lttng_channel *chan;
-       struct lttng_event *event;
+       struct lttng_kernel_event_recorder_private *event_recorder_priv;
        struct lttng_metadata_cache *cache = session->metadata_cache;
        struct lttng_metadata_stream *stream;
 
@@ -545,8 +547,8 @@ int lttng_session_metadata_regenerate(struct lttng_session *session)
                chan->metadata_dumped = 0;
        }
 
-       list_for_each_entry(event, &session->events, list) {
-               event->metadata_dumped = 0;
+       list_for_each_entry(event_recorder_priv, &session->events, node) {
+               event_recorder_priv->metadata_dumped = 0;
        }
 
        ret = _lttng_session_metadata_statedump(session);
@@ -602,12 +604,13 @@ end:
        return ret;
 }
 
-int lttng_event_enable(struct lttng_event *event)
+int lttng_event_enable(struct lttng_kernel_event_recorder *event_recorder)
 {
+       struct lttng_kernel_event_common *event = &event_recorder->parent;
        int ret = 0;
 
        mutex_lock(&sessions_mutex);
-       if (event->chan->channel_type == METADATA_CHANNEL) {
+       if (event_recorder->chan->channel_type == METADATA_CHANNEL) {
                ret = -EPERM;
                goto end;
        }
@@ -615,7 +618,7 @@ int lttng_event_enable(struct lttng_event *event)
                ret = -EEXIST;
                goto end;
        }
-       switch (event->instrumentation) {
+       switch (event->priv->instrumentation) {
        case LTTNG_KERNEL_ABI_TRACEPOINT:       /* Fall-through */
        case LTTNG_KERNEL_ABI_SYSCALL:
                ret = -EINVAL;
@@ -627,7 +630,7 @@ int lttng_event_enable(struct lttng_event *event)
                break;
 
        case LTTNG_KERNEL_ABI_KRETPROBE:
-               ret = lttng_kretprobes_event_enable_state(event, 1);
+               ret = lttng_kretprobes_event_enable_state(event_recorder, 1);
                break;
 
        case LTTNG_KERNEL_ABI_FUNCTION:         /* Fall-through */
@@ -641,12 +644,13 @@ end:
        return ret;
 }
 
-int lttng_event_disable(struct lttng_event *event)
+int lttng_event_disable(struct lttng_kernel_event_recorder *event_recorder)
 {
+       struct lttng_kernel_event_common *event = &event_recorder->parent;
        int ret = 0;
 
        mutex_lock(&sessions_mutex);
-       if (event->chan->channel_type == METADATA_CHANNEL) {
+       if (event_recorder->chan->channel_type == METADATA_CHANNEL) {
                ret = -EPERM;
                goto end;
        }
@@ -654,7 +658,7 @@ int lttng_event_disable(struct lttng_event *event)
                ret = -EEXIST;
                goto end;
        }
-       switch (event->instrumentation) {
+       switch (event->priv->instrumentation) {
        case LTTNG_KERNEL_ABI_TRACEPOINT:       /* Fall-through */
        case LTTNG_KERNEL_ABI_SYSCALL:
                ret = -EINVAL;
@@ -667,7 +671,7 @@ int lttng_event_disable(struct lttng_event *event)
 
        case LTTNG_KERNEL_ABI_KRETPROBE:
 
-               ret = lttng_kretprobes_event_enable_state(event, 0);
+               ret = lttng_kretprobes_event_enable_state(event_recorder, 0);
                break;
 
        case LTTNG_KERNEL_ABI_FUNCTION:         /* Fall-through */
@@ -681,16 +685,17 @@ end:
        return ret;
 }
 
-int lttng_event_notifier_enable(struct lttng_event_notifier *event_notifier)
+int lttng_event_notifier_enable(struct lttng_kernel_event_notifier *event_notifier)
 {
+       struct lttng_kernel_event_common *event = &event_notifier->parent;
        int ret = 0;
 
        mutex_lock(&sessions_mutex);
-       if (event_notifier->enabled) {
+       if (event->enabled) {
                ret = -EEXIST;
                goto end;
        }
-       switch (event_notifier->instrumentation) {
+       switch (event->priv->instrumentation) {
        case LTTNG_KERNEL_ABI_TRACEPOINT:       /* Fall-through */
        case LTTNG_KERNEL_ABI_SYSCALL:
                ret = -EINVAL;
@@ -698,7 +703,7 @@ int lttng_event_notifier_enable(struct lttng_event_notifier *event_notifier)
 
        case LTTNG_KERNEL_ABI_KPROBE:           /* Fall-through */
        case LTTNG_KERNEL_ABI_UPROBE:
-               WRITE_ONCE(event_notifier->enabled, 1);
+               WRITE_ONCE(event->enabled, 1);
                break;
 
        case LTTNG_KERNEL_ABI_FUNCTION:         /* Fall-through */
@@ -713,16 +718,17 @@ end:
        return ret;
 }
 
-int lttng_event_notifier_disable(struct lttng_event_notifier *event_notifier)
+int lttng_event_notifier_disable(struct lttng_kernel_event_notifier *event_notifier)
 {
+       struct lttng_kernel_event_common *event = &event_notifier->parent;
        int ret = 0;
 
        mutex_lock(&sessions_mutex);
-       if (!event_notifier->enabled) {
+       if (!event->enabled) {
                ret = -EEXIST;
                goto end;
        }
-       switch (event_notifier->instrumentation) {
+       switch (event->priv->instrumentation) {
        case LTTNG_KERNEL_ABI_TRACEPOINT:       /* Fall-through */
        case LTTNG_KERNEL_ABI_SYSCALL:
                ret = -EINVAL;
@@ -730,7 +736,7 @@ int lttng_event_notifier_disable(struct lttng_event_notifier *event_notifier)
 
        case LTTNG_KERNEL_ABI_KPROBE:           /* Fall-through */
        case LTTNG_KERNEL_ABI_UPROBE:
-               WRITE_ONCE(event_notifier->enabled, 0);
+               WRITE_ONCE(event->enabled, 0);
                break;
 
        case LTTNG_KERNEL_ABI_FUNCTION:         /* Fall-through */
@@ -842,14 +848,14 @@ void _lttng_metadata_channel_hangup(struct lttng_metadata_stream *stream)
  * Supports event creation while tracing session is active.
  * Needs to be called with sessions mutex held.
  */
-struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
+struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct lttng_channel *chan,
                                struct lttng_kernel_abi_event *event_param,
-                               void *filter,
                                const struct lttng_kernel_event_desc *event_desc,
                                enum lttng_kernel_abi_instrumentation itype)
 {
        struct lttng_session *session = chan->session;
-       struct lttng_event *event;
+       struct lttng_kernel_event_recorder *event_recorder;
+       struct lttng_kernel_event_recorder_private *event_recorder_priv;
        const char *event_name;
        struct hlist_head *head;
        int ret;
@@ -881,35 +887,45 @@ struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
 
        head = utils_borrow_hash_table_bucket(session->events_ht.table,
                LTTNG_EVENT_HT_SIZE, event_name);
-       lttng_hlist_for_each_entry(event, head, hlist) {
-               WARN_ON_ONCE(!event->desc);
-               if (!strncmp(event->desc->event_name, event_name,
+       lttng_hlist_for_each_entry(event_recorder_priv, head, hlist) {
+               WARN_ON_ONCE(!event_recorder_priv->parent.desc);
+               if (!strncmp(event_recorder_priv->parent.desc->event_name, event_name,
                                        LTTNG_KERNEL_ABI_SYM_NAME_LEN - 1)
-                               && chan == event->chan) {
+                               && chan == event_recorder_priv->pub->chan) {
                        ret = -EEXIST;
                        goto exist;
                }
        }
 
-       event = kmem_cache_zalloc(event_cache, GFP_KERNEL);
-       if (!event) {
+       event_recorder = kmem_cache_zalloc(event_recorder_cache, GFP_KERNEL);
+       if (!event_recorder) {
                ret = -ENOMEM;
                goto cache_error;
        }
-       event->chan = chan;
-       event->filter = filter;
-       event->id = chan->free_event_id++;
-       event->instrumentation = itype;
-       INIT_LIST_HEAD(&event->filter_bytecode_runtime_head);
-       INIT_LIST_HEAD(&event->enablers_ref_head);
+       event_recorder_priv = kmem_cache_zalloc(event_recorder_private_cache, GFP_KERNEL);
+       if (!event_recorder_priv) {
+               ret = -ENOMEM;
+               goto cache_private_error;
+       }
+       event_recorder_priv->pub = event_recorder;
+       event_recorder_priv->parent.pub = &event_recorder->parent;
+       event_recorder->priv = event_recorder_priv;
+       event_recorder->parent.priv = &event_recorder_priv->parent;
+       event_recorder->parent.type = LTTNG_KERNEL_EVENT_TYPE_RECORDER;
+
+       event_recorder->chan = chan;
+       event_recorder->priv->id = chan->free_event_id++;
+       event_recorder->priv->parent.instrumentation = itype;
+       INIT_LIST_HEAD(&event_recorder->priv->parent.filter_bytecode_runtime_head);
+       INIT_LIST_HEAD(&event_recorder->priv->parent.enablers_ref_head);
 
        switch (itype) {
        case LTTNG_KERNEL_ABI_TRACEPOINT:
                /* Event will be enabled by enabler sync. */
-               event->enabled = 0;
-               event->registered = 0;
-               event->desc = lttng_event_desc_get(event_name);
-               if (!event->desc) {
+               event_recorder->parent.enabled = 0;
+               event_recorder->priv->parent.registered = 0;
+               event_recorder->priv->parent.desc = lttng_event_desc_get(event_name);
+               if (!event_recorder->priv->parent.desc) {
                        ret = -ENOENT;
                        goto register_error;
                }
@@ -922,8 +938,8 @@ struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
                 * Needs to be explicitly enabled after creation, since
                 * we may want to apply filters.
                 */
-               event->enabled = 0;
-               event->registered = 1;
+               event_recorder->parent.enabled = 0;
+               event_recorder->priv->parent.registered = 1;
                /*
                 * Populate lttng_event structure before event
                 * registration.
@@ -933,40 +949,52 @@ struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
                                event_param->u.kprobe.symbol_name,
                                event_param->u.kprobe.offset,
                                event_param->u.kprobe.addr,
-                               event);
+                               event_recorder);
                if (ret) {
                        ret = -EINVAL;
                        goto register_error;
                }
-               ret = try_module_get(event->desc->owner);
+               ret = try_module_get(event_recorder->priv->parent.desc->owner);
                WARN_ON_ONCE(!ret);
                break;
 
        case LTTNG_KERNEL_ABI_KRETPROBE:
        {
-               struct lttng_event *event_return;
+               struct lttng_kernel_event_recorder *event_recorder_return;
+               struct lttng_kernel_event_recorder_private *event_recorder_return_priv;
 
                /* kretprobe defines 2 events */
                /*
                 * Needs to be explicitly enabled after creation, since
                 * we may want to apply filters.
                 */
-               event->enabled = 0;
-               event->registered = 1;
-               event_return =
-                       kmem_cache_zalloc(event_cache, GFP_KERNEL);
-               if (!event_return) {
+               event_recorder->parent.enabled = 0;
+               event_recorder->priv->parent.registered = 1;
+
+               event_recorder_return = kmem_cache_zalloc(event_recorder_cache, GFP_KERNEL);
+               if (!event_recorder_return) {
+                       ret = -ENOMEM;
+                       goto register_error;
+               }
+               event_recorder_return_priv = kmem_cache_zalloc(event_recorder_private_cache, GFP_KERNEL);
+               if (!event_recorder_return_priv) {
+                       kmem_cache_free(event_recorder_cache, event_recorder_return);
                        ret = -ENOMEM;
                        goto register_error;
                }
-               event_return->chan = chan;
-               event_return->filter = filter;
-               event_return->id = chan->free_event_id++;
-               event_return->enabled = 0;
-               event_return->registered = 1;
-               event_return->instrumentation = itype;
-               INIT_LIST_HEAD(&event_return->filter_bytecode_runtime_head);
-               INIT_LIST_HEAD(&event_return->enablers_ref_head);
+               event_recorder_return_priv->pub = event_recorder_return;
+               event_recorder_return_priv->parent.pub = &event_recorder_return->parent;
+               event_recorder_return->priv = event_recorder_return_priv;
+               event_recorder_return->parent.priv = &event_recorder_return_priv->parent;
+               event_recorder_return->parent.type = LTTNG_KERNEL_EVENT_TYPE_RECORDER;
+
+               event_recorder_return->chan = chan;
+               event_recorder_return->priv->id = chan->free_event_id++;
+               event_recorder_return->priv->parent.instrumentation = itype;
+               event_recorder_return->parent.enabled = 0;
+               event_recorder_return->priv->parent.registered = 1;
+               INIT_LIST_HEAD(&event_recorder_return->priv->parent.filter_bytecode_runtime_head);
+               INIT_LIST_HEAD(&event_recorder_return->priv->parent.enablers_ref_head);
                /*
                 * Populate lttng_event structure before kretprobe registration.
                 */
@@ -975,27 +1003,29 @@ struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
                                event_param->u.kretprobe.symbol_name,
                                event_param->u.kretprobe.offset,
                                event_param->u.kretprobe.addr,
-                               event, event_return);
+                               event_recorder, event_recorder_return);
                if (ret) {
-                       kmem_cache_free(event_cache, event_return);
+                       kmem_cache_free(event_recorder_private_cache, event_recorder_return_priv);
+                       kmem_cache_free(event_recorder_cache, event_recorder_return);
                        ret = -EINVAL;
                        goto register_error;
                }
                /* Take 2 refs on the module: one per event. */
-               ret = try_module_get(event->desc->owner);
+               ret = try_module_get(event_recorder->priv->parent.desc->owner);
                WARN_ON_ONCE(!ret);
-               ret = try_module_get(event->desc->owner);
+               ret = try_module_get(event_recorder_return->priv->parent.desc->owner);
                WARN_ON_ONCE(!ret);
                ret = _lttng_event_metadata_statedump(chan->session, chan,
-                                                   event_return);
+                                                   event_recorder_return);
                WARN_ON_ONCE(ret > 0);
                if (ret) {
-                       kmem_cache_free(event_cache, event_return);
-                       module_put(event->desc->owner);
-                       module_put(event->desc->owner);
+                       kmem_cache_free(event_recorder_private_cache, event_recorder_return_priv);
+                       kmem_cache_free(event_recorder_cache, event_recorder_return);
+                       module_put(event_recorder_return->priv->parent.desc->owner);
+                       module_put(event_recorder->priv->parent.desc->owner);
                        goto statedump_error;
                }
-               list_add(&event_return->list, &chan->session->events);
+               list_add(&event_recorder_return->priv->node, &chan->session->events);
                break;
        }
 
@@ -1004,18 +1034,18 @@ struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
                 * Needs to be explicitly enabled after creation, since
                 * we may want to apply filters.
                 */
-               event->enabled = 0;
-               event->registered = 0;
-               event->desc = event_desc;
+               event_recorder->parent.enabled = 0;
+               event_recorder->priv->parent.registered = 0;
+               event_recorder->priv->parent.desc = event_desc;
                switch (event_param->u.syscall.entryexit) {
                case LTTNG_KERNEL_ABI_SYSCALL_ENTRYEXIT:
                        ret = -EINVAL;
                        goto register_error;
                case LTTNG_KERNEL_ABI_SYSCALL_ENTRY:
-                       event->u.syscall.entryexit = LTTNG_SYSCALL_ENTRY;
+                       event_recorder->priv->parent.u.syscall.entryexit = LTTNG_SYSCALL_ENTRY;
                        break;
                case LTTNG_KERNEL_ABI_SYSCALL_EXIT:
-                       event->u.syscall.entryexit = LTTNG_SYSCALL_EXIT;
+                       event_recorder->priv->parent.u.syscall.entryexit = LTTNG_SYSCALL_EXIT;
                        break;
                }
                switch (event_param->u.syscall.abi) {
@@ -1023,13 +1053,13 @@ struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
                        ret = -EINVAL;
                        goto register_error;
                case LTTNG_KERNEL_ABI_SYSCALL_ABI_NATIVE:
-                       event->u.syscall.abi = LTTNG_SYSCALL_ABI_NATIVE;
+                       event_recorder->priv->parent.u.syscall.abi = LTTNG_SYSCALL_ABI_NATIVE;
                        break;
                case LTTNG_KERNEL_ABI_SYSCALL_ABI_COMPAT:
-                       event->u.syscall.abi = LTTNG_SYSCALL_ABI_COMPAT;
+                       event_recorder->priv->parent.u.syscall.abi = LTTNG_SYSCALL_ABI_COMPAT;
                        break;
                }
-               if (!event->desc) {
+               if (!event_recorder->priv->parent.desc) {
                        ret = -EINVAL;
                        goto register_error;
                }
@@ -1040,8 +1070,8 @@ struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
                 * Needs to be explicitly enabled after creation, since
                 * we may want to apply filters.
                 */
-               event->enabled = 0;
-               event->registered = 1;
+               event_recorder->parent.enabled = 0;
+               event_recorder->priv->parent.registered = 1;
 
                /*
                 * Populate lttng_event structure before event
@@ -1051,10 +1081,10 @@ struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
 
                ret = lttng_uprobes_register_event(event_param->name,
                                event_param->u.uprobe.fd,
-                               event);
+                               event_recorder);
                if (ret)
                        goto register_error;
-               ret = try_module_get(event->desc->owner);
+               ret = try_module_get(event_recorder->priv->parent.desc->owner);
                WARN_ON_ONCE(!ret);
                break;
 
@@ -1065,19 +1095,21 @@ struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
                ret = -EINVAL;
                goto register_error;
        }
-       ret = _lttng_event_metadata_statedump(chan->session, chan, event);
+       ret = _lttng_event_metadata_statedump(chan->session, chan, event_recorder);
        WARN_ON_ONCE(ret > 0);
        if (ret) {
                goto statedump_error;
        }
-       hlist_add_head(&event->hlist, head);
-       list_add(&event->list, &chan->session->events);
-       return event;
+       hlist_add_head(&event_recorder->priv->hlist, head);
+       list_add(&event_recorder->priv->node, &chan->session->events);
+       return event_recorder;
 
 statedump_error:
        /* If a statedump error occurs, events will not be readable. */
 register_error:
-       kmem_cache_free(event_cache, event);
+       kmem_cache_free(event_recorder_private_cache, event_recorder_priv);
+cache_private_error:
+       kmem_cache_free(event_recorder_cache, event_recorder);
 cache_error:
 exist:
 type_error:
@@ -1085,14 +1117,15 @@ full:
        return ERR_PTR(ret);
 }
 
-struct lttng_event_notifier *_lttng_event_notifier_create(
+struct lttng_kernel_event_notifier *_lttng_event_notifier_create(
                const struct lttng_kernel_event_desc *event_desc,
                uint64_t token, uint64_t error_counter_index,
                struct lttng_event_notifier_group *event_notifier_group,
                struct lttng_kernel_abi_event_notifier *event_notifier_param,
-               void *filter, enum lttng_kernel_abi_instrumentation itype)
+               enum lttng_kernel_abi_instrumentation itype)
 {
-       struct lttng_event_notifier *event_notifier;
+       struct lttng_kernel_event_notifier *event_notifier;
+       struct lttng_kernel_event_notifier_private *event_notifier_priv;
        struct lttng_counter *error_counter;
        const char *event_name;
        struct hlist_head *head;
@@ -1120,12 +1153,12 @@ struct lttng_event_notifier *_lttng_event_notifier_create(
 
        head = utils_borrow_hash_table_bucket(event_notifier_group->event_notifiers_ht.table,
                LTTNG_EVENT_NOTIFIER_HT_SIZE, event_name);
-       lttng_hlist_for_each_entry(event_notifier, head, hlist) {
-               WARN_ON_ONCE(!event_notifier->desc);
-               if (!strncmp(event_notifier->desc->event_name, event_name,
+       lttng_hlist_for_each_entry(event_notifier_priv, head, hlist) {
+               WARN_ON_ONCE(!event_notifier_priv->parent.desc);
+               if (!strncmp(event_notifier_priv->parent.desc->event_name, event_name,
                                        LTTNG_KERNEL_ABI_SYM_NAME_LEN - 1)
-                               && event_notifier_group == event_notifier->group
-                               && token == event_notifier->user_token) {
+                               && event_notifier_group == event_notifier_priv->group
+                               && token == event_notifier_priv->parent.user_token) {
                        ret = -EEXIST;
                        goto exist;
                }
@@ -1136,25 +1169,34 @@ struct lttng_event_notifier *_lttng_event_notifier_create(
                ret = -ENOMEM;
                goto cache_error;
        }
-
-       event_notifier->group = event_notifier_group;
-       event_notifier->user_token = token;
-       event_notifier->error_counter_index = error_counter_index;
-       event_notifier->num_captures = 0;
-       event_notifier->filter = filter;
-       event_notifier->instrumentation = itype;
-       event_notifier->send_notification = lttng_event_notifier_notification_send;
-       INIT_LIST_HEAD(&event_notifier->filter_bytecode_runtime_head);
-       INIT_LIST_HEAD(&event_notifier->capture_bytecode_runtime_head);
-       INIT_LIST_HEAD(&event_notifier->enablers_ref_head);
+       event_notifier_priv = kmem_cache_zalloc(event_notifier_private_cache, GFP_KERNEL);
+       if (!event_notifier_priv) {
+               ret = -ENOMEM;
+               goto cache_private_error;
+       }
+       event_notifier_priv->pub = event_notifier;
+       event_notifier_priv->parent.pub = &event_notifier->parent;
+       event_notifier->priv = event_notifier_priv;
+       event_notifier->parent.priv = &event_notifier_priv->parent;
+       event_notifier->parent.type = LTTNG_KERNEL_EVENT_TYPE_NOTIFIER;
+
+       event_notifier->priv->group = event_notifier_group;
+       event_notifier->priv->parent.user_token = token;
+       event_notifier->priv->error_counter_index = error_counter_index;
+       event_notifier->priv->num_captures = 0;
+       event_notifier->priv->parent.instrumentation = itype;
+       event_notifier->notification_send = lttng_event_notifier_notification_send;
+       INIT_LIST_HEAD(&event_notifier->priv->parent.filter_bytecode_runtime_head);
+       INIT_LIST_HEAD(&event_notifier->priv->parent.enablers_ref_head);
+       INIT_LIST_HEAD(&event_notifier->priv->capture_bytecode_runtime_head);
 
        switch (itype) {
        case LTTNG_KERNEL_ABI_TRACEPOINT:
                /* Event will be enabled by enabler sync. */
-               event_notifier->enabled = 0;
-               event_notifier->registered = 0;
-               event_notifier->desc = lttng_event_desc_get(event_name);
-               if (!event_notifier->desc) {
+               event_notifier->parent.enabled = 0;
+               event_notifier->priv->parent.registered = 0;
+               event_notifier->priv->parent.desc = lttng_event_desc_get(event_name);
+               if (!event_notifier->priv->parent.desc) {
                        ret = -ENOENT;
                        goto register_error;
                }
@@ -1167,8 +1209,8 @@ struct lttng_event_notifier *_lttng_event_notifier_create(
                 * Needs to be explicitly enabled after creation, since
                 * we may want to apply filters.
                 */
-               event_notifier->enabled = 0;
-               event_notifier->registered = 1;
+               event_notifier->parent.enabled = 0;
+               event_notifier->priv->parent.registered = 1;
                /*
                 * Populate lttng_event_notifier structure before event
                 * registration.
@@ -1183,7 +1225,7 @@ struct lttng_event_notifier *_lttng_event_notifier_create(
                        ret = -EINVAL;
                        goto register_error;
                }
-               ret = try_module_get(event_notifier->desc->owner);
+               ret = try_module_get(event_notifier->priv->parent.desc->owner);
                WARN_ON_ONCE(!ret);
                break;
 
@@ -1192,18 +1234,18 @@ struct lttng_event_notifier *_lttng_event_notifier_create(
                 * Needs to be explicitly enabled after creation, since
                 * we may want to apply filters.
                 */
-               event_notifier->enabled = 0;
-               event_notifier->registered = 0;
-               event_notifier->desc = event_desc;
+               event_notifier->parent.enabled = 0;
+               event_notifier->priv->parent.registered = 0;
+               event_notifier->priv->parent.desc = event_desc;
                switch (event_notifier_param->event.u.syscall.entryexit) {
                case LTTNG_KERNEL_ABI_SYSCALL_ENTRYEXIT:
                        ret = -EINVAL;
                        goto register_error;
                case LTTNG_KERNEL_ABI_SYSCALL_ENTRY:
-                       event_notifier->u.syscall.entryexit = LTTNG_SYSCALL_ENTRY;
+                       event_notifier->priv->parent.u.syscall.entryexit = LTTNG_SYSCALL_ENTRY;
                        break;
                case LTTNG_KERNEL_ABI_SYSCALL_EXIT:
-                       event_notifier->u.syscall.entryexit = LTTNG_SYSCALL_EXIT;
+                       event_notifier->priv->parent.u.syscall.entryexit = LTTNG_SYSCALL_EXIT;
                        break;
                }
                switch (event_notifier_param->event.u.syscall.abi) {
@@ -1211,14 +1253,14 @@ struct lttng_event_notifier *_lttng_event_notifier_create(
                        ret = -EINVAL;
                        goto register_error;
                case LTTNG_KERNEL_ABI_SYSCALL_ABI_NATIVE:
-                       event_notifier->u.syscall.abi = LTTNG_SYSCALL_ABI_NATIVE;
+                       event_notifier->priv->parent.u.syscall.abi = LTTNG_SYSCALL_ABI_NATIVE;
                        break;
                case LTTNG_KERNEL_ABI_SYSCALL_ABI_COMPAT:
-                       event_notifier->u.syscall.abi = LTTNG_SYSCALL_ABI_COMPAT;
+                       event_notifier->priv->parent.u.syscall.abi = LTTNG_SYSCALL_ABI_COMPAT;
                        break;
                }
 
-               if (!event_notifier->desc) {
+               if (!event_notifier->priv->parent.desc) {
                        ret = -EINVAL;
                        goto register_error;
                }
@@ -1229,8 +1271,8 @@ struct lttng_event_notifier *_lttng_event_notifier_create(
                 * Needs to be explicitly enabled after creation, since
                 * we may want to apply filters.
                 */
-               event_notifier->enabled = 0;
-               event_notifier->registered = 1;
+               event_notifier->parent.enabled = 0;
+               event_notifier->priv->parent.registered = 1;
 
                /*
                 * Populate lttng_event_notifier structure before
@@ -1244,7 +1286,7 @@ struct lttng_event_notifier *_lttng_event_notifier_create(
                                event_notifier);
                if (ret)
                        goto register_error;
-               ret = try_module_get(event_notifier->desc->owner);
+               ret = try_module_get(event_notifier->priv->parent.desc->owner);
                WARN_ON_ONCE(!ret);
                break;
 
@@ -1257,8 +1299,8 @@ struct lttng_event_notifier *_lttng_event_notifier_create(
                goto register_error;
        }
 
-       list_add(&event_notifier->list, &event_notifier_group->event_notifiers_head);
-       hlist_add_head(&event_notifier->hlist, head);
+       list_add(&event_notifier->priv->node, &event_notifier_group->event_notifiers_head);
+       hlist_add_head(&event_notifier->priv->hlist, head);
 
        /*
         * Clear the error counter bucket. The sessiond keeps track of which
@@ -1273,18 +1315,18 @@ struct lttng_event_notifier *_lttng_event_notifier_create(
                /*
                 * Check that the index is within the boundary of the counter.
                 */
-               if (event_notifier->error_counter_index >= event_notifier_group->error_counter_len) {
+               if (event_notifier->priv->error_counter_index >= event_notifier_group->error_counter_len) {
                        printk(KERN_INFO "LTTng: event_notifier: Error counter index out-of-bound: counter-len=%zu, index=%llu\n",
-                               event_notifier_group->error_counter_len, event_notifier->error_counter_index);
+                               event_notifier_group->error_counter_len, event_notifier->priv->error_counter_index);
                        ret = -EINVAL;
                        goto register_error;
                }
 
-               dimension_index[0] = event_notifier->error_counter_index;
+               dimension_index[0] = event_notifier->priv->error_counter_index;
                ret = error_counter->ops->counter_clear(error_counter->counter, dimension_index);
                if (ret) {
                        printk(KERN_INFO "LTTng: event_notifier: Unable to clear error counter bucket %llu\n",
-                               event_notifier->error_counter_index);
+                               event_notifier->priv->error_counter_index);
                        goto register_error;
                }
        }
@@ -1292,6 +1334,8 @@ struct lttng_event_notifier *_lttng_event_notifier_create(
        return event_notifier;
 
 register_error:
+       kmem_cache_free(event_notifier_private_cache, event_notifier_priv);
+cache_private_error:
        kmem_cache_free(event_notifier_cache, event_notifier);
 cache_error:
 exist:
@@ -1321,58 +1365,56 @@ int lttng_kernel_counter_clear(struct lttng_counter *counter,
        return counter->ops->counter_clear(counter->counter, dim_indexes);
 }
 
-struct lttng_event *lttng_event_create(struct lttng_channel *chan,
+struct lttng_kernel_event_recorder *lttng_kernel_event_recorder_create(struct lttng_channel *chan,
                                struct lttng_kernel_abi_event *event_param,
-                               void *filter,
                                const struct lttng_kernel_event_desc *event_desc,
                                enum lttng_kernel_abi_instrumentation itype)
 {
-       struct lttng_event *event;
+       struct lttng_kernel_event_recorder *event;
 
        mutex_lock(&sessions_mutex);
-       event = _lttng_event_create(chan, event_param, filter, event_desc,
-                               itype);
+       event = _lttng_kernel_event_recorder_create(chan, event_param, event_desc, itype);
        mutex_unlock(&sessions_mutex);
        return event;
 }
 
-struct lttng_event_notifier *lttng_event_notifier_create(
+struct lttng_kernel_event_notifier *lttng_event_notifier_create(
                const struct lttng_kernel_event_desc *event_desc,
                uint64_t id, uint64_t error_counter_index,
                struct lttng_event_notifier_group *event_notifier_group,
                struct lttng_kernel_abi_event_notifier *event_notifier_param,
-               void *filter, enum lttng_kernel_abi_instrumentation itype)
+               enum lttng_kernel_abi_instrumentation itype)
 {
-       struct lttng_event_notifier *event_notifier;
+       struct lttng_kernel_event_notifier *event_notifier;
 
        mutex_lock(&sessions_mutex);
        event_notifier = _lttng_event_notifier_create(event_desc, id,
                error_counter_index, event_notifier_group,
-               event_notifier_param, filter, itype);
+               event_notifier_param, itype);
        mutex_unlock(&sessions_mutex);
        return event_notifier;
 }
 
 /* Only used for tracepoints for now. */
 static
-void register_event(struct lttng_event *event)
+void register_event(struct lttng_kernel_event_recorder *event_recorder)
 {
        const struct lttng_kernel_event_desc *desc;
        int ret = -EINVAL;
 
-       if (event->registered)
+       if (event_recorder->priv->parent.registered)
                return;
 
-       desc = event->desc;
-       switch (event->instrumentation) {
+       desc = event_recorder->priv->parent.desc;
+       switch (event_recorder->priv->parent.instrumentation) {
        case LTTNG_KERNEL_ABI_TRACEPOINT:
                ret = lttng_wrapper_tracepoint_probe_register(desc->event_kname,
                                                  desc->probe_callback,
-                                                 event);
+                                                 event_recorder);
                break;
 
        case LTTNG_KERNEL_ABI_SYSCALL:
-               ret = lttng_syscall_filter_enable_event(event->chan, event);
+               ret = lttng_syscall_filter_enable_event(event_recorder->chan, event_recorder);
                break;
 
        case LTTNG_KERNEL_ABI_KPROBE:           /* Fall-through */
@@ -1387,40 +1429,41 @@ void register_event(struct lttng_event *event)
                WARN_ON_ONCE(1);
        }
        if (!ret)
-               event->registered = 1;
+               event_recorder->priv->parent.registered = 1;
 }
 
 /*
  * Only used internally at session destruction.
  */
-int _lttng_event_unregister(struct lttng_event *event)
+int _lttng_event_unregister(struct lttng_kernel_event_recorder *event_recorder)
 {
+       struct lttng_kernel_event_common_private *event_priv = &event_recorder->priv->parent;
        const struct lttng_kernel_event_desc *desc;
        int ret = -EINVAL;
 
-       if (!event->registered)
+       if (!event_priv->registered)
                return 0;
 
-       desc = event->desc;
-       switch (event->instrumentation) {
+       desc = event_priv->desc;
+       switch (event_priv->instrumentation) {
        case LTTNG_KERNEL_ABI_TRACEPOINT:
-               ret = lttng_wrapper_tracepoint_probe_unregister(event->desc->event_kname,
-                                                 event->desc->probe_callback,
-                                                 event);
+               ret = lttng_wrapper_tracepoint_probe_unregister(event_priv->desc->event_kname,
+                                                 event_priv->desc->probe_callback,
+                                                 event_recorder);
                break;
 
        case LTTNG_KERNEL_ABI_KPROBE:
-               lttng_kprobes_unregister_event(event);
+               lttng_kprobes_unregister_event(event_recorder);
                ret = 0;
                break;
 
        case LTTNG_KERNEL_ABI_KRETPROBE:
-               lttng_kretprobes_unregister(event);
+               lttng_kretprobes_unregister(event_recorder);
                ret = 0;
                break;
 
        case LTTNG_KERNEL_ABI_SYSCALL:
-               ret = lttng_syscall_filter_disable_event(event->chan, event);
+               ret = lttng_syscall_filter_disable_event(event_recorder->chan, event_recorder);
                break;
 
        case LTTNG_KERNEL_ABI_NOOP:
@@ -1428,7 +1471,7 @@ int _lttng_event_unregister(struct lttng_event *event)
                break;
 
        case LTTNG_KERNEL_ABI_UPROBE:
-               lttng_uprobes_unregister_event(event);
+               lttng_uprobes_unregister_event(event_recorder);
                ret = 0;
                break;
 
@@ -1437,22 +1480,22 @@ int _lttng_event_unregister(struct lttng_event *event)
                WARN_ON_ONCE(1);
        }
        if (!ret)
-               event->registered = 0;
+               event_priv->registered = 0;
        return ret;
 }
 
 /* Only used for tracepoints for now. */
 static
-void register_event_notifier(struct lttng_event_notifier *event_notifier)
+void register_event_notifier(struct lttng_kernel_event_notifier *event_notifier)
 {
        const struct lttng_kernel_event_desc *desc;
        int ret = -EINVAL;
 
-       if (event_notifier->registered)
+       if (event_notifier->priv->parent.registered)
                return;
 
-       desc = event_notifier->desc;
-       switch (event_notifier->instrumentation) {
+       desc = event_notifier->priv->parent.desc;
+       switch (event_notifier->priv->parent.instrumentation) {
        case LTTNG_KERNEL_ABI_TRACEPOINT:
                ret = lttng_wrapper_tracepoint_probe_register(desc->event_kname,
                                                  desc->event_notifier_callback,
@@ -1475,24 +1518,24 @@ void register_event_notifier(struct lttng_event_notifier *event_notifier)
                WARN_ON_ONCE(1);
        }
        if (!ret)
-               event_notifier->registered = 1;
+               event_notifier->priv->parent.registered = 1;
 }
 
 static
 int _lttng_event_notifier_unregister(
-               struct lttng_event_notifier *event_notifier)
+               struct lttng_kernel_event_notifier *event_notifier)
 {
        const struct lttng_kernel_event_desc *desc;
        int ret = -EINVAL;
 
-       if (!event_notifier->registered)
+       if (!event_notifier->priv->parent.registered)
                return 0;
 
-       desc = event_notifier->desc;
-       switch (event_notifier->instrumentation) {
+       desc = event_notifier->priv->parent.desc;
+       switch (event_notifier->priv->parent.instrumentation) {
        case LTTNG_KERNEL_ABI_TRACEPOINT:
-               ret = lttng_wrapper_tracepoint_probe_unregister(event_notifier->desc->event_kname,
-                                                 event_notifier->desc->event_notifier_callback,
+               ret = lttng_wrapper_tracepoint_probe_unregister(event_notifier->priv->parent.desc->event_kname,
+                                                 event_notifier->priv->parent.desc->event_notifier_callback,
                                                  event_notifier);
                break;
 
@@ -1517,7 +1560,7 @@ int _lttng_event_notifier_unregister(
                WARN_ON_ONCE(1);
        }
        if (!ret)
-               event_notifier->registered = 0;
+               event_notifier->priv->parent.registered = 0;
        return ret;
 }
 
@@ -1525,31 +1568,32 @@ int _lttng_event_notifier_unregister(
  * Only used internally at session destruction.
  */
 static
-void _lttng_event_destroy(struct lttng_event *event)
+void _lttng_event_destroy(struct lttng_kernel_event_recorder *event_recorder)
 {
+       struct lttng_kernel_event_common_private *event_priv = &event_recorder->priv->parent;
        struct lttng_enabler_ref *enabler_ref, *tmp_enabler_ref;
 
-       switch (event->instrumentation) {
+       switch (event_priv->instrumentation) {
        case LTTNG_KERNEL_ABI_TRACEPOINT:
-               lttng_event_desc_put(event->desc);
+               lttng_event_desc_put(event_priv->desc);
                break;
 
        case LTTNG_KERNEL_ABI_KPROBE:
-               module_put(event->desc->owner);
-               lttng_kprobes_destroy_event_private(event);
+               module_put(event_priv->desc->owner);
+               lttng_kprobes_destroy_event_private(event_recorder);
                break;
 
        case LTTNG_KERNEL_ABI_KRETPROBE:
-               module_put(event->desc->owner);
-               lttng_kretprobes_destroy_private(event);
+               module_put(event_priv->desc->owner);
+               lttng_kretprobes_destroy_private(event_recorder);
                break;
 
        case LTTNG_KERNEL_ABI_SYSCALL:
                break;
 
        case LTTNG_KERNEL_ABI_UPROBE:
-               module_put(event->desc->owner);
-               lttng_uprobes_destroy_event_private(event);
+               module_put(event_priv->desc->owner);
+               lttng_uprobes_destroy_event_private(event_recorder);
                break;
 
        case LTTNG_KERNEL_ABI_FUNCTION:         /* Fall-through */
@@ -1557,31 +1601,31 @@ void _lttng_event_destroy(struct lttng_event *event)
        default:
                WARN_ON_ONCE(1);
        }
-       list_del(&event->list);
-       lttng_kernel_destroy_context(event->ctx);
-       lttng_free_event_filter_runtime(event);
+       list_del(&event_recorder->priv->node);
+       lttng_free_event_filter_runtime(event_recorder);
        /* Free event enabler refs */
        list_for_each_entry_safe(enabler_ref, tmp_enabler_ref,
-                                &event->enablers_ref_head, node)
+                                &event_priv->enablers_ref_head, node)
                kfree(enabler_ref);
-       kmem_cache_free(event_cache, event);
+       kmem_cache_free(event_recorder_private_cache, event_recorder->priv);
+       kmem_cache_free(event_recorder_cache, event_recorder);
 }
 
 /*
  * Only used internally at session destruction.
  */
 static
-void _lttng_event_notifier_destroy(struct lttng_event_notifier *event_notifier)
+void _lttng_event_notifier_destroy(struct lttng_kernel_event_notifier *event_notifier)
 {
        struct lttng_enabler_ref *enabler_ref, *tmp_enabler_ref;
 
-       switch (event_notifier->instrumentation) {
+       switch (event_notifier->priv->parent.instrumentation) {
        case LTTNG_KERNEL_ABI_TRACEPOINT:
-               lttng_event_desc_put(event_notifier->desc);
+               lttng_event_desc_put(event_notifier->priv->parent.desc);
                break;
 
        case LTTNG_KERNEL_ABI_KPROBE:
-               module_put(event_notifier->desc->owner);
+               module_put(event_notifier->priv->parent.desc->owner);
                lttng_kprobes_destroy_event_notifier_private(event_notifier);
                break;
 
@@ -1589,7 +1633,7 @@ void _lttng_event_notifier_destroy(struct lttng_event_notifier *event_notifier)
                break;
 
        case LTTNG_KERNEL_ABI_UPROBE:
-               module_put(event_notifier->desc->owner);
+               module_put(event_notifier->priv->parent.desc->owner);
                lttng_uprobes_destroy_event_notifier_private(event_notifier);
                break;
 
@@ -1599,12 +1643,13 @@ void _lttng_event_notifier_destroy(struct lttng_event_notifier *event_notifier)
        default:
                WARN_ON_ONCE(1);
        }
-       list_del(&event_notifier->list);
+       list_del(&event_notifier->priv->node);
        lttng_free_event_notifier_filter_runtime(event_notifier);
        /* Free event enabler refs */
        list_for_each_entry_safe(enabler_ref, tmp_enabler_ref,
-                                &event_notifier->enablers_ref_head, node)
+                                &event_notifier->priv->parent.enablers_ref_head, node)
                kfree(enabler_ref);
+       kmem_cache_free(event_notifier_private_cache, event_notifier->priv);
        kmem_cache_free(event_notifier_cache, event_notifier);
 }
 
@@ -1974,15 +2019,15 @@ int lttng_desc_match_enabler(const struct lttng_kernel_event_desc *desc,
 
 static
 int lttng_event_enabler_match_event(struct lttng_event_enabler *event_enabler,
-               struct lttng_event *event)
+               struct lttng_kernel_event_recorder *event_recorder)
 {
        struct lttng_enabler *base_enabler = lttng_event_enabler_as_enabler(
                event_enabler);
 
-       if (base_enabler->event_param.instrumentation != event->instrumentation)
+       if (base_enabler->event_param.instrumentation != event_recorder->priv->parent.instrumentation)
                return 0;
-       if (lttng_desc_match_enabler(event->desc, base_enabler)
-                       && event->chan == event_enabler->chan)
+       if (lttng_desc_match_enabler(event_recorder->priv->parent.desc, base_enabler)
+                       && event_recorder->chan == event_enabler->chan)
                return 1;
        else
                return 0;
@@ -1990,16 +2035,16 @@ int lttng_event_enabler_match_event(struct lttng_event_enabler *event_enabler,
 
 static
 int lttng_event_notifier_enabler_match_event_notifier(struct lttng_event_notifier_enabler *event_notifier_enabler,
-               struct lttng_event_notifier *event_notifier)
+               struct lttng_kernel_event_notifier *event_notifier)
 {
        struct lttng_enabler *base_enabler = lttng_event_notifier_enabler_as_enabler(
                event_notifier_enabler);
 
-       if (base_enabler->event_param.instrumentation != event_notifier->instrumentation)
+       if (base_enabler->event_param.instrumentation != event_notifier->priv->parent.instrumentation)
                return 0;
-       if (lttng_desc_match_enabler(event_notifier->desc, base_enabler)
-                       && event_notifier->group == event_notifier_enabler->group
-                       && event_notifier->user_token == event_notifier_enabler->base.user_token)
+       if (lttng_desc_match_enabler(event_notifier->priv->parent.desc, base_enabler)
+                       && event_notifier->priv->group == event_notifier_enabler->group
+                       && event_notifier->priv->parent.user_token == event_notifier_enabler->base.user_token)
                return 1;
        else
                return 0;
@@ -2038,7 +2083,8 @@ void lttng_create_tracepoint_event_if_missing(struct lttng_event_enabler *event_
                for (i = 0; i < probe_desc->nr_events; i++) {
                        int found = 0;
                        struct hlist_head *head;
-                       struct lttng_event *event;
+                       struct lttng_kernel_event_recorder_private *event_recorder_private;
+                       struct lttng_kernel_event_recorder *event_recorder;
 
                        desc = probe_desc->event_desc[i];
                        if (!lttng_desc_match_enabler(desc,
@@ -2051,9 +2097,9 @@ void lttng_create_tracepoint_event_if_missing(struct lttng_event_enabler *event_
                        head = utils_borrow_hash_table_bucket(
                                session->events_ht.table, LTTNG_EVENT_HT_SIZE,
                                desc->event_name);
-                       lttng_hlist_for_each_entry(event, head, hlist) {
-                               if (event->desc == desc
-                                               && event->chan == event_enabler->chan)
+                       lttng_hlist_for_each_entry(event_recorder_private, head, hlist) {
+                               if (event_recorder_private->parent.desc == desc
+                                               && event_recorder_private->pub->chan == event_enabler->chan)
                                        found = 1;
                        }
                        if (found)
@@ -2063,10 +2109,9 @@ void lttng_create_tracepoint_event_if_missing(struct lttng_event_enabler *event_
                         * We need to create an event for this
                         * event probe.
                         */
-                       event = _lttng_event_create(event_enabler->chan,
-                                       NULL, NULL, desc,
-                                       LTTNG_KERNEL_ABI_TRACEPOINT);
-                       if (!event) {
+                       event_recorder = _lttng_kernel_event_recorder_create(event_enabler->chan,
+                                       NULL, desc, LTTNG_KERNEL_ABI_TRACEPOINT);
+                       if (!event_recorder) {
                                printk(KERN_INFO "LTTng: Unable to create event %s\n",
                                        probe_desc->event_desc[i]->event_name);
                        }
@@ -2093,7 +2138,8 @@ void lttng_create_tracepoint_event_notifier_if_missing(struct lttng_event_notifi
                for (i = 0; i < probe_desc->nr_events; i++) {
                        int found = 0;
                        struct hlist_head *head;
-                       struct lttng_event_notifier *event_notifier;
+                       struct lttng_kernel_event_notifier_private *event_notifier_priv;
+                       struct lttng_kernel_event_notifier *event_notifier;
 
                        desc = probe_desc->event_desc[i];
                        if (!lttng_desc_match_enabler(desc,
@@ -2106,9 +2152,9 @@ void lttng_create_tracepoint_event_notifier_if_missing(struct lttng_event_notifi
                        head = utils_borrow_hash_table_bucket(
                                event_notifier_group->event_notifiers_ht.table,
                                LTTNG_EVENT_NOTIFIER_HT_SIZE, desc->event_name);
-                       lttng_hlist_for_each_entry(event_notifier, head, hlist) {
-                               if (event_notifier->desc == desc
-                                               && event_notifier->user_token == event_notifier_enabler->base.user_token)
+                       lttng_hlist_for_each_entry(event_notifier_priv, head, hlist) {
+                               if (event_notifier_priv->parent.desc == desc
+                                               && event_notifier_priv->parent.user_token == event_notifier_enabler->base.user_token)
                                        found = 1;
                        }
                        if (found)
@@ -2120,7 +2166,7 @@ void lttng_create_tracepoint_event_notifier_if_missing(struct lttng_event_notifi
                        event_notifier = _lttng_event_notifier_create(desc,
                                event_notifier_enabler->base.user_token,
                                event_notifier_enabler->error_counter_index,
-                               event_notifier_group, NULL, NULL,
+                               event_notifier_group, NULL,
                                LTTNG_KERNEL_ABI_TRACEPOINT);
                        if (IS_ERR(event_notifier)) {
                                printk(KERN_INFO "Unable to create event_notifier %s\n",
@@ -2135,7 +2181,7 @@ void lttng_create_syscall_event_if_missing(struct lttng_event_enabler *event_ena
 {
        int ret;
 
-       ret = lttng_syscalls_register_event(event_enabler, NULL);
+       ret = lttng_syscalls_register_event(event_enabler);
        WARN_ON_ONCE(ret);
 }
 
@@ -2144,14 +2190,14 @@ void lttng_create_syscall_event_notifier_if_missing(struct lttng_event_notifier_
 {
        int ret;
 
-       ret = lttng_syscalls_register_event_notifier(event_notifier_enabler, NULL);
+       ret = lttng_syscalls_register_event_notifier(event_notifier_enabler);
        WARN_ON_ONCE(ret);
-       ret = lttng_syscals_create_matching_event_notifiers(event_notifier_enabler, NULL);
+       ret = lttng_syscalls_create_matching_event_notifiers(event_notifier_enabler);
        WARN_ON_ONCE(ret);
 }
 
 /*
- * Create struct lttng_event if it is missing and present in the list of
+ * Create struct lttng_kernel_event_recorder if it is missing and present in the list of
  * tracepoint probes.
  * Should be called with sessions mutex held.
  */
@@ -2184,7 +2230,7 @@ int lttng_event_enabler_ref_events(struct lttng_event_enabler *event_enabler)
        struct lttng_channel *chan = event_enabler->chan;
        struct lttng_session *session = event_enabler->chan->session;
        struct lttng_enabler *base_enabler = lttng_event_enabler_as_enabler(event_enabler);
-       struct lttng_event *event;
+       struct lttng_kernel_event_recorder_private *event_recorder_priv;
 
        if (base_enabler->event_param.instrumentation == LTTNG_KERNEL_ABI_SYSCALL &&
                        base_enabler->event_param.u.syscall.abi == LTTNG_KERNEL_ABI_SYSCALL_ABI_ALL &&
@@ -2204,12 +2250,13 @@ int lttng_event_enabler_ref_events(struct lttng_event_enabler *event_enabler)
        lttng_create_event_if_missing(event_enabler);
 
        /* For each event matching event_enabler in session event list. */
-       list_for_each_entry(event, &session->events, list) {
+       list_for_each_entry(event_recorder_priv, &session->events, node) {
+               struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
                struct lttng_enabler_ref *enabler_ref;
 
-               if (!lttng_event_enabler_match_event(event_enabler, event))
+               if (!lttng_event_enabler_match_event(event_enabler, event_recorder))
                        continue;
-               enabler_ref = lttng_enabler_ref(&event->enablers_ref_head,
+               enabler_ref = lttng_enabler_ref(&event_recorder_priv->parent.enablers_ref_head,
                        lttng_event_enabler_as_enabler(event_enabler));
                if (!enabler_ref) {
                        /*
@@ -2221,24 +2268,22 @@ int lttng_event_enabler_ref_events(struct lttng_event_enabler *event_enabler)
                                return -ENOMEM;
                        enabler_ref->ref = lttng_event_enabler_as_enabler(event_enabler);
                        list_add(&enabler_ref->node,
-                               &event->enablers_ref_head);
+                               &event_recorder_priv->parent.enablers_ref_head);
                }
 
                /*
                 * Link filter bytecodes if not linked yet.
                 */
-               lttng_enabler_link_bytecode(event->desc,
+               lttng_enabler_link_bytecode(event_recorder_priv->parent.desc,
                        lttng_static_ctx,
-                       &event->filter_bytecode_runtime_head,
+                       &event_recorder_priv->parent.filter_bytecode_runtime_head,
                        &lttng_event_enabler_as_enabler(event_enabler)->filter_bytecode_head);
-
-               /* TODO: merge event context. */
        }
        return 0;
 }
 
 /*
- * Create struct lttng_event_notifier if it is missing and present in the list of
+ * Create struct lttng_kernel_event_notifier if it is missing and present in the list of
  * tracepoint probes.
  * Should be called with sessions mutex held.
  */
@@ -2269,7 +2314,7 @@ int lttng_event_notifier_enabler_ref_event_notifiers(
 {
        struct lttng_event_notifier_group *event_notifier_group = event_notifier_enabler->group;
        struct lttng_enabler *base_enabler = lttng_event_notifier_enabler_as_enabler(event_notifier_enabler);
-       struct lttng_event_notifier *event_notifier;
+       struct lttng_kernel_event_notifier_private *event_notifier_priv;
 
        if (base_enabler->event_param.instrumentation == LTTNG_KERNEL_ABI_SYSCALL &&
                        base_enabler->event_param.u.syscall.abi == LTTNG_KERNEL_ABI_SYSCALL_ABI_ALL &&
@@ -2291,13 +2336,14 @@ int lttng_event_notifier_enabler_ref_event_notifiers(
        lttng_create_event_notifier_if_missing(event_notifier_enabler);
 
        /* Link the created event_notifier with its associated enabler. */
-       list_for_each_entry(event_notifier, &event_notifier_group->event_notifiers_head, list) {
+       list_for_each_entry(event_notifier_priv, &event_notifier_group->event_notifiers_head, node) {
+               struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
                struct lttng_enabler_ref *enabler_ref;
 
                if (!lttng_event_notifier_enabler_match_event_notifier(event_notifier_enabler, event_notifier))
                        continue;
 
-               enabler_ref = lttng_enabler_ref(&event_notifier->enablers_ref_head,
+               enabler_ref = lttng_enabler_ref(&event_notifier_priv->parent.enablers_ref_head,
                        lttng_event_notifier_enabler_as_enabler(event_notifier_enabler));
                if (!enabler_ref) {
                        /*
@@ -2311,22 +2357,22 @@ int lttng_event_notifier_enabler_ref_event_notifiers(
                        enabler_ref->ref = lttng_event_notifier_enabler_as_enabler(
                                event_notifier_enabler);
                        list_add(&enabler_ref->node,
-                               &event_notifier->enablers_ref_head);
+                               &event_notifier_priv->parent.enablers_ref_head);
                }
 
                /*
                 * Link filter bytecodes if not linked yet.
                 */
-               lttng_enabler_link_bytecode(event_notifier->desc,
-                       lttng_static_ctx, &event_notifier->filter_bytecode_runtime_head,
+               lttng_enabler_link_bytecode(event_notifier_priv->parent.desc,
+                       lttng_static_ctx, &event_notifier_priv->parent.filter_bytecode_runtime_head,
                        &lttng_event_notifier_enabler_as_enabler(event_notifier_enabler)->filter_bytecode_head);
 
                /* Link capture bytecodes if not linked yet. */
-               lttng_enabler_link_bytecode(event_notifier->desc,
-                       lttng_static_ctx, &event_notifier->capture_bytecode_runtime_head,
+               lttng_enabler_link_bytecode(event_notifier_priv->parent.desc,
+                       lttng_static_ctx, &event_notifier_priv->capture_bytecode_runtime_head,
                        &event_notifier_enabler->capture_bytecode_head);
 
-               event_notifier->num_captures = event_notifier_enabler->num_captures;
+               event_notifier_priv->num_captures = event_notifier_enabler->num_captures;
        }
        return 0;
 }
@@ -2469,13 +2515,13 @@ error:
        return ret;
 }
 
-int lttng_event_add_callsite(struct lttng_event *event,
+int lttng_event_add_callsite(struct lttng_kernel_event_recorder *event_recorder,
                struct lttng_kernel_abi_event_callsite __user *callsite)
 {
 
-       switch (event->instrumentation) {
+       switch (event_recorder->priv->parent.instrumentation) {
        case LTTNG_KERNEL_ABI_UPROBE:
-               return lttng_uprobes_event_add_callsite(event, callsite);
+               return lttng_uprobes_event_add_callsite(event_recorder, callsite);
        default:
                return -EINVAL;
        }
@@ -2498,9 +2544,6 @@ void lttng_event_enabler_destroy(struct lttng_event_enabler *event_enabler)
 {
        lttng_enabler_destroy(lttng_event_enabler_as_enabler(event_enabler));
 
-       /* Destroy contexts */
-       lttng_kernel_destroy_context(event_enabler->ctx);
-
        list_del(&event_enabler->node);
        kfree(event_enabler);
 }
@@ -2620,11 +2663,11 @@ end:
        return ret;
 }
 
-int lttng_event_notifier_add_callsite(struct lttng_event_notifier *event_notifier,
+int lttng_event_notifier_add_callsite(struct lttng_kernel_event_notifier *event_notifier,
                struct lttng_kernel_abi_event_callsite __user *callsite)
 {
 
-       switch (event_notifier->instrumentation) {
+       switch (event_notifier->priv->parent.instrumentation) {
        case LTTNG_KERNEL_ABI_UPROBE:
                return lttng_uprobes_event_notifier_add_callsite(event_notifier,
                                callsite);
@@ -2656,7 +2699,7 @@ static
 void lttng_session_sync_event_enablers(struct lttng_session *session)
 {
        struct lttng_event_enabler *event_enabler;
-       struct lttng_event *event;
+       struct lttng_kernel_event_recorder_private *event_recorder_priv;
 
        list_for_each_entry(event_enabler, &session->enablers_head, node)
                lttng_event_enabler_ref_events(event_enabler);
@@ -2665,17 +2708,18 @@ void lttng_session_sync_event_enablers(struct lttng_session *session)
         * and its channel and session transient states are enabled, we
         * enable the event, else we disable it.
         */
-       list_for_each_entry(event, &session->events, list) {
+       list_for_each_entry(event_recorder_priv, &session->events, node) {
+               struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
                struct lttng_enabler_ref *enabler_ref;
                struct lttng_bytecode_runtime *runtime;
                int enabled = 0, has_enablers_without_bytecode = 0;
 
-               switch (event->instrumentation) {
+               switch (event_recorder_priv->parent.instrumentation) {
                case LTTNG_KERNEL_ABI_TRACEPOINT:       /* Fall-through */
                case LTTNG_KERNEL_ABI_SYSCALL:
                        /* Enable events */
                        list_for_each_entry(enabler_ref,
-                                       &event->enablers_ref_head, node) {
+                                       &event_recorder_priv->parent.enablers_ref_head, node) {
                                if (enabler_ref->ref->enabled) {
                                        enabled = 1;
                                        break;
@@ -2692,34 +2736,34 @@ void lttng_session_sync_event_enablers(struct lttng_session *session)
                 * intesection of session and channel transient enable
                 * states.
                 */
-               enabled = enabled && session->tstate && event->chan->tstate;
+               enabled = enabled && session->tstate && event_recorder->chan->tstate;
 
-               WRITE_ONCE(event->enabled, enabled);
+               WRITE_ONCE(event_recorder->parent.enabled, enabled);
                /*
                 * Sync tracepoint registration with event enabled
                 * state.
                 */
                if (enabled) {
-                       register_event(event);
+                       register_event(event_recorder);
                } else {
-                       _lttng_event_unregister(event);
+                       _lttng_event_unregister(event_recorder);
                }
 
                /* Check if has enablers without bytecode enabled */
                list_for_each_entry(enabler_ref,
-                               &event->enablers_ref_head, node) {
+                               &event_recorder_priv->parent.enablers_ref_head, node) {
                        if (enabler_ref->ref->enabled
                                        && list_empty(&enabler_ref->ref->filter_bytecode_head)) {
                                has_enablers_without_bytecode = 1;
                                break;
                        }
                }
-               event->has_enablers_without_bytecode =
+               event_recorder_priv->parent.has_enablers_without_filter_bytecode =
                        has_enablers_without_bytecode;
 
                /* Enable filters */
                list_for_each_entry(runtime,
-                               &event->filter_bytecode_runtime_head, node)
+                               &event_recorder_priv->parent.filter_bytecode_runtime_head, node)
                        lttng_bytecode_filter_sync_state(runtime);
        }
 }
@@ -2744,7 +2788,7 @@ static
 void lttng_event_notifier_group_sync_enablers(struct lttng_event_notifier_group *event_notifier_group)
 {
        struct lttng_event_notifier_enabler *event_notifier_enabler;
-       struct lttng_event_notifier *event_notifier;
+       struct lttng_kernel_event_notifier_private *event_notifier_priv;
 
        list_for_each_entry(event_notifier_enabler, &event_notifier_group->enablers_head, node)
                lttng_event_notifier_enabler_ref_event_notifiers(event_notifier_enabler);
@@ -2753,17 +2797,18 @@ void lttng_event_notifier_group_sync_enablers(struct lttng_event_notifier_group
         * For each event_notifier, if at least one of its enablers is enabled,
         * we enable the event_notifier, else we disable it.
         */
-       list_for_each_entry(event_notifier, &event_notifier_group->event_notifiers_head, list) {
+       list_for_each_entry(event_notifier_priv, &event_notifier_group->event_notifiers_head, node) {
+               struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
                struct lttng_enabler_ref *enabler_ref;
                struct lttng_bytecode_runtime *runtime;
                int enabled = 0, has_enablers_without_bytecode = 0;
 
-               switch (event_notifier->instrumentation) {
+               switch (event_notifier_priv->parent.instrumentation) {
                case LTTNG_KERNEL_ABI_TRACEPOINT:       /* Fall-through */
                case LTTNG_KERNEL_ABI_SYSCALL:
                        /* Enable event_notifiers */
                        list_for_each_entry(enabler_ref,
-                                       &event_notifier->enablers_ref_head, node) {
+                                       &event_notifier_priv->parent.enablers_ref_head, node) {
                                if (enabler_ref->ref->enabled) {
                                        enabled = 1;
                                        break;
@@ -2776,42 +2821,42 @@ void lttng_event_notifier_group_sync_enablers(struct lttng_event_notifier_group
                        continue;
                }
 
-               WRITE_ONCE(event_notifier->enabled, enabled);
+               WRITE_ONCE(event_notifier->parent.enabled, enabled);
                /*
                 * Sync tracepoint registration with event_notifier enabled
                 * state.
                 */
                if (enabled) {
-                       if (!event_notifier->registered)
+                       if (!event_notifier_priv->parent.registered)
                                register_event_notifier(event_notifier);
                } else {
-                       if (event_notifier->registered)
+                       if (event_notifier_priv->parent.registered)
                                _lttng_event_notifier_unregister(event_notifier);
                }
 
                /* Check if has enablers without bytecode enabled */
                list_for_each_entry(enabler_ref,
-                               &event_notifier->enablers_ref_head, node) {
+                               &event_notifier_priv->parent.enablers_ref_head, node) {
                        if (enabler_ref->ref->enabled
                                        && list_empty(&enabler_ref->ref->filter_bytecode_head)) {
                                has_enablers_without_bytecode = 1;
                                break;
                        }
                }
-               event_notifier->has_enablers_without_bytecode =
+               event_notifier_priv->parent.has_enablers_without_filter_bytecode =
                        has_enablers_without_bytecode;
 
                /* Enable filters */
                list_for_each_entry(runtime,
-                               &event_notifier->filter_bytecode_runtime_head, node)
+                               &event_notifier_priv->parent.filter_bytecode_runtime_head, node)
                        lttng_bytecode_filter_sync_state(runtime);
 
                /* Enable captures */
                list_for_each_entry(runtime,
-                               &event_notifier->capture_bytecode_runtime_head, node)
+                               &event_notifier_priv->capture_bytecode_runtime_head, node)
                        lttng_bytecode_capture_sync_state(runtime);
 
-               WRITE_ONCE(event_notifier->eval_capture, !!event_notifier->num_captures);
+               WRITE_ONCE(event_notifier->eval_capture, !!event_notifier_priv->num_captures);
        }
 }
 
@@ -3539,9 +3584,9 @@ int _lttng_context_metadata_statedump(struct lttng_session *session,
 
 static
 int _lttng_fields_metadata_statedump(struct lttng_session *session,
-                                  struct lttng_event *event)
+                                  struct lttng_kernel_event_recorder *event_recorder)
 {
-       const struct lttng_kernel_event_desc *desc = event->desc;
+       const struct lttng_kernel_event_desc *desc = event_recorder->priv->parent.desc;
        int ret = 0;
        int i;
 
@@ -3563,11 +3608,11 @@ int _lttng_fields_metadata_statedump(struct lttng_session *session,
 static
 int _lttng_event_metadata_statedump(struct lttng_session *session,
                                  struct lttng_channel *chan,
-                                 struct lttng_event *event)
+                                 struct lttng_kernel_event_recorder *event_recorder)
 {
        int ret = 0;
 
-       if (event->metadata_dumped || !LTTNG_READ_ONCE(session->active))
+       if (event_recorder->priv->metadata_dumped || !LTTNG_READ_ONCE(session->active))
                return 0;
        if (chan->channel_type == METADATA_CHANNEL)
                return 0;
@@ -3579,35 +3624,19 @@ int _lttng_event_metadata_statedump(struct lttng_session *session,
                "       name = \"%s\";\n"
                "       id = %u;\n"
                "       stream_id = %u;\n",
-               event->desc->event_name,
-               event->id,
-               event->chan->id);
+               event_recorder->priv->parent.desc->event_name,
+               event_recorder->priv->id,
+               event_recorder->chan->id);
        if (ret)
                goto end;
 
-       if (event->ctx) {
-               ret = lttng_metadata_printf(session,
-                       "       context := struct {\n");
-               if (ret)
-                       goto end;
-       }
-       ret = _lttng_context_metadata_statedump(session, event->ctx);
-       if (ret)
-               goto end;
-       if (event->ctx) {
-               ret = lttng_metadata_printf(session,
-                       "       };\n");
-               if (ret)
-                       goto end;
-       }
-
        ret = lttng_metadata_printf(session,
                "       fields := struct {\n"
                );
        if (ret)
                goto end;
 
-       ret = _lttng_fields_metadata_statedump(session, event);
+       ret = _lttng_fields_metadata_statedump(session, event_recorder);
        if (ret)
                goto end;
 
@@ -3621,7 +3650,7 @@ int _lttng_event_metadata_statedump(struct lttng_session *session,
        if (ret)
                goto end;
 
-       event->metadata_dumped = 1;
+       event_recorder->priv->metadata_dumped = 1;
 end:
        lttng_metadata_end(session);
        return ret;
@@ -3863,7 +3892,7 @@ int _lttng_session_metadata_statedump(struct lttng_session *session)
        unsigned char uuid_s[37], clock_uuid_s[BOOT_ID_LEN];
        const char *product_uuid;
        struct lttng_channel *chan;
-       struct lttng_event *event;
+       struct lttng_kernel_event_recorder_private *event_recorder_priv;
        int ret = 0;
 
        if (!LTTNG_READ_ONCE(session->active))
@@ -4036,8 +4065,9 @@ skip_session:
                        goto end;
        }
 
-       list_for_each_entry(event, &session->events, list) {
-               ret = _lttng_event_metadata_statedump(session, event->chan, event);
+       list_for_each_entry(event_recorder_priv, &session->events, node) {
+               ret = _lttng_event_metadata_statedump(session, event_recorder_priv->pub->chan,
+                               event_recorder_priv->pub);
                if (ret)
                        goto end;
        }
@@ -4258,16 +4288,26 @@ static int __init lttng_events_init(void)
        ret = lttng_tracepoint_init();
        if (ret)
                goto error_tp;
-       event_cache = KMEM_CACHE(lttng_event, 0);
-       if (!event_cache) {
+       event_recorder_cache = KMEM_CACHE(lttng_kernel_event_recorder, 0);
+       if (!event_recorder_cache) {
                ret = -ENOMEM;
-               goto error_kmem_event;
+               goto error_kmem_event_recorder;
        }
-       event_notifier_cache = KMEM_CACHE(lttng_event_notifier, 0);
+       event_recorder_private_cache = KMEM_CACHE(lttng_kernel_event_recorder_private, 0);
+       if (!event_recorder_private_cache) {
+               ret = -ENOMEM;
+               goto error_kmem_event_recorder_private;
+       }
+       event_notifier_cache = KMEM_CACHE(lttng_kernel_event_notifier, 0);
        if (!event_notifier_cache) {
                ret = -ENOMEM;
                goto error_kmem_event_notifier;
        }
+       event_notifier_private_cache = KMEM_CACHE(lttng_kernel_event_notifier_private, 0);
+       if (!event_notifier_private_cache) {
+               ret = -ENOMEM;
+               goto error_kmem_event_notifier_private;
+       }
        ret = lttng_abi_init();
        if (ret)
                goto error_abi;
@@ -4300,10 +4340,14 @@ error_hotplug:
 error_logger:
        lttng_abi_exit();
 error_abi:
+       kmem_cache_destroy(event_notifier_private_cache);
+error_kmem_event_notifier_private:
        kmem_cache_destroy(event_notifier_cache);
 error_kmem_event_notifier:
-       kmem_cache_destroy(event_cache);
-error_kmem_event:
+       kmem_cache_destroy(event_recorder_private_cache);
+error_kmem_event_recorder_private:
+       kmem_cache_destroy(event_recorder_cache);
+error_kmem_event_recorder:
        lttng_tracepoint_exit();
 error_tp:
        lttng_context_exit();
@@ -4337,8 +4381,10 @@ static void __exit lttng_events_exit(void)
        lttng_abi_exit();
        list_for_each_entry_safe(session, tmpsession, &sessions, list)
                lttng_session_destroy(session);
-       kmem_cache_destroy(event_cache);
+       kmem_cache_destroy(event_recorder_cache);
+       kmem_cache_destroy(event_recorder_private_cache);
        kmem_cache_destroy(event_notifier_cache);
+       kmem_cache_destroy(event_notifier_private_cache);
        lttng_tracepoint_exit();
        lttng_context_exit();
        printk(KERN_NOTICE "LTTng: Unloaded modules v%s.%s.%s%s (%s)%s%s\n",
index 6055d66bc63ee1437b3d3d4fc8a45e520a7e65d0..26034e92cf79b864f0f02087f880d240f2f2bfa8 100644 (file)
@@ -142,8 +142,6 @@ size_t record_header_size(const struct lib_ring_buffer_config *config,
                                 struct lttng_client_ctx *client_ctx)
 {
        struct lttng_channel *lttng_chan = channel_get_private(chan);
-       struct lttng_probe_ctx *lttng_probe_ctx = ctx->priv;
-       struct lttng_event *event = lttng_probe_ctx->event;
        size_t orig_offset = offset;
        size_t padding;
 
@@ -184,9 +182,6 @@ size_t record_header_size(const struct lib_ring_buffer_config *config,
        }
        offset += ctx_get_aligned_size(offset, lttng_chan->ctx,
                        client_ctx->packet_context_len);
-       offset += ctx_get_aligned_size(offset, event->ctx,
-                       client_ctx->event_context_len);
-
        *pre_header_padding = padding;
        return offset - orig_offset;
 }
@@ -213,8 +208,6 @@ void lttng_write_event_header(const struct lib_ring_buffer_config *config,
                            uint32_t event_id)
 {
        struct lttng_channel *lttng_chan = channel_get_private(ctx->chan);
-       struct lttng_probe_ctx *lttng_probe_ctx = ctx->priv;
-       struct lttng_event *event = lttng_probe_ctx->event;
 
        if (unlikely(ctx->rflags))
                goto slow_path;
@@ -250,7 +243,6 @@ void lttng_write_event_header(const struct lib_ring_buffer_config *config,
        }
 
        ctx_record(ctx, lttng_chan, lttng_chan->ctx);
-       ctx_record(ctx, lttng_chan, event->ctx);
        lib_ring_buffer_align_ctx(ctx, ctx->largest_align);
 
        return;
@@ -265,8 +257,6 @@ void lttng_write_event_header_slow(const struct lib_ring_buffer_config *config,
                                 uint32_t event_id)
 {
        struct lttng_channel *lttng_chan = channel_get_private(ctx->chan);
-       struct lttng_probe_ctx *lttng_probe_ctx = ctx->priv;
-       struct lttng_event *event = lttng_probe_ctx->event;
 
        switch (lttng_chan->header_type) {
        case 1: /* compact */
@@ -323,7 +313,6 @@ void lttng_write_event_header_slow(const struct lib_ring_buffer_config *config,
                WARN_ON_ONCE(1);
        }
        ctx_record(ctx, lttng_chan, lttng_chan->ctx);
-       ctx_record(ctx, lttng_chan, event->ctx);
        lib_ring_buffer_align_ctx(ctx, ctx->largest_align);
 }
 
@@ -619,8 +608,6 @@ int lttng_event_reserve(struct lib_ring_buffer_ctx *ctx,
                      uint32_t event_id)
 {
        struct lttng_channel *lttng_chan = channel_get_private(ctx->chan);
-       struct lttng_probe_ctx *lttng_probe_ctx = ctx->priv;
-       struct lttng_event *event = lttng_probe_ctx->event;
        struct lttng_client_ctx client_ctx;
        int ret, cpu;
 
@@ -631,7 +618,6 @@ int lttng_event_reserve(struct lib_ring_buffer_ctx *ctx,
 
        /* Compute internal size of context structures. */
        ctx_get_struct_size(lttng_chan->ctx, &client_ctx.packet_context_len, lttng_chan, ctx);
-       ctx_get_struct_size(event->ctx, &client_ctx.event_context_len, lttng_chan, ctx);
 
        switch (lttng_chan->header_type) {
        case 1: /* compact */
index 6f95fe9378fd13fbb930bcb06e8d40a4c0190cb8..d4914037392219e38bd5a29be2bace941b7a288c 100644 (file)
@@ -392,14 +392,18 @@ static void syscall_entry_event_unknown(struct hlist_head *unknown_action_list_h
        struct pt_regs *regs, long id)
 {
        unsigned long args[LTTNG_SYSCALL_NR_ARGS];
-       struct lttng_event *event;
+       struct lttng_kernel_event_common_private *event_priv;
 
        lttng_syscall_get_arguments(current, regs, args);
-       lttng_hlist_for_each_entry_rcu(event, unknown_action_list_head, u.syscall.node) {
+       lttng_hlist_for_each_entry_rcu(event_priv, unknown_action_list_head, u.syscall.node) {
+               struct lttng_kernel_event_recorder_private *event_recorder_priv =
+                       container_of(event_priv, struct lttng_kernel_event_recorder_private, parent);
+               struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
+
                if (unlikely(in_compat_syscall()))
-                       __event_probe__compat_syscall_entry_unknown(event, id, args);
+                       __event_probe__compat_syscall_entry_unknown(event_recorder, id, args);
                else
-                       __event_probe__syscall_entry_unknown(event, id, args);
+                       __event_probe__syscall_entry_unknown(event_recorder, id, args);
        }
 }
 
@@ -408,14 +412,18 @@ static void syscall_entry_event_notifier_unknown(
                struct pt_regs *regs, long id)
 {
        unsigned long args[LTTNG_SYSCALL_NR_ARGS];
-       struct lttng_event_notifier *notifier;
+       struct lttng_kernel_event_common_private *event_priv;
 
        lttng_syscall_get_arguments(current, regs, args);
-       lttng_hlist_for_each_entry_rcu(notifier, unknown_dispatch_list_head, u.syscall.node) {
+       lttng_hlist_for_each_entry_rcu(event_priv, unknown_dispatch_list_head, u.syscall.node) {
+               struct lttng_kernel_event_notifier_private *event_notifier_priv =
+                       container_of(event_priv, struct lttng_kernel_event_notifier_private, parent);
+               struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
+
                if (unlikely(in_compat_syscall()))
-                       __event_notifier_probe__compat_syscall_entry_unknown(notifier, id, args);
+                       __event_notifier_probe__compat_syscall_entry_unknown(event_notifier, id, args);
                else
-                       __event_notifier_probe__syscall_entry_unknown(notifier, id, args);
+                       __event_notifier_probe__syscall_entry_unknown(event_notifier, id, args);
        }
 }
 
@@ -424,14 +432,18 @@ static void syscall_exit_event_notifier_unknown(
                struct pt_regs *regs, long id, long ret)
 {
        unsigned long args[LTTNG_SYSCALL_NR_ARGS];
-       struct lttng_event_notifier *notifier;
+       struct lttng_kernel_event_common_private *event_priv;
 
        lttng_syscall_get_arguments(current, regs, args);
-       lttng_hlist_for_each_entry_rcu(notifier, unknown_dispatch_list_head, u.syscall.node) {
+       lttng_hlist_for_each_entry_rcu(event_priv, unknown_dispatch_list_head, u.syscall.node) {
+               struct lttng_kernel_event_notifier_private *event_notifier_priv =
+                       container_of(event_priv, struct lttng_kernel_event_notifier_private, parent);
+               struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
+
                if (unlikely(in_compat_syscall()))
-                       __event_notifier_probe__compat_syscall_exit_unknown(notifier, id, ret, args);
+                       __event_notifier_probe__compat_syscall_exit_unknown(event_notifier, id, ret, args);
                else
-                       __event_notifier_probe__syscall_exit_unknown(notifier, id, ret, args);
+                       __event_notifier_probe__syscall_exit_unknown(event_notifier, id, ret, args);
        }
 }
 
@@ -440,15 +452,20 @@ void syscall_entry_call_func(struct hlist_head *action_list,
                void *func, unsigned int nrargs,
                struct pt_regs *regs)
 {
-       struct lttng_event *event;
+       struct lttng_kernel_event_common_private *event_priv;
 
        switch (nrargs) {
        case 0:
        {
                void (*fptr)(void *__data) = func;
 
-               lttng_hlist_for_each_entry_rcu(event, action_list, u.syscall.node)
-                       fptr(event);
+               lttng_hlist_for_each_entry_rcu(event_priv, action_list, u.syscall.node) {
+                       struct lttng_kernel_event_recorder_private *event_recorder_priv =
+                               container_of(event_priv, struct lttng_kernel_event_recorder_private, parent);
+                       struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
+
+                       fptr(event_recorder);
+               }
                break;
        }
        case 1:
@@ -457,8 +474,13 @@ void syscall_entry_call_func(struct hlist_head *action_list,
                unsigned long args[LTTNG_SYSCALL_NR_ARGS];
 
                lttng_syscall_get_arguments(current, regs, args);
-               lttng_hlist_for_each_entry_rcu(event, action_list, u.syscall.node)
-                       fptr(event, args[0]);
+               lttng_hlist_for_each_entry_rcu(event_priv, action_list, u.syscall.node) {
+                       struct lttng_kernel_event_recorder_private *event_recorder_priv =
+                               container_of(event_priv, struct lttng_kernel_event_recorder_private, parent);
+                       struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
+
+                       fptr(event_recorder, args[0]);
+               }
                break;
        }
        case 2:
@@ -469,8 +491,13 @@ void syscall_entry_call_func(struct hlist_head *action_list,
                unsigned long args[LTTNG_SYSCALL_NR_ARGS];
 
                lttng_syscall_get_arguments(current, regs, args);
-               lttng_hlist_for_each_entry_rcu(event, action_list, u.syscall.node)
-                       fptr(event, args[0], args[1]);
+               lttng_hlist_for_each_entry_rcu(event_priv, action_list, u.syscall.node) {
+                       struct lttng_kernel_event_recorder_private *event_recorder_priv =
+                               container_of(event_priv, struct lttng_kernel_event_recorder_private, parent);
+                       struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
+
+                       fptr(event_recorder, args[0], args[1]);
+               }
                break;
        }
        case 3:
@@ -482,8 +509,13 @@ void syscall_entry_call_func(struct hlist_head *action_list,
                unsigned long args[LTTNG_SYSCALL_NR_ARGS];
 
                lttng_syscall_get_arguments(current, regs, args);
-               lttng_hlist_for_each_entry_rcu(event, action_list, u.syscall.node)
-                       fptr(event, args[0], args[1], args[2]);
+               lttng_hlist_for_each_entry_rcu(event_priv, action_list, u.syscall.node) {
+                       struct lttng_kernel_event_recorder_private *event_recorder_priv =
+                               container_of(event_priv, struct lttng_kernel_event_recorder_private, parent);
+                       struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
+
+                       fptr(event_recorder, args[0], args[1], args[2]);
+               }
                break;
        }
        case 4:
@@ -496,8 +528,13 @@ void syscall_entry_call_func(struct hlist_head *action_list,
                unsigned long args[LTTNG_SYSCALL_NR_ARGS];
 
                lttng_syscall_get_arguments(current, regs, args);
-               lttng_hlist_for_each_entry_rcu(event, action_list, u.syscall.node)
-                       fptr(event, args[0], args[1], args[2], args[3]);
+               lttng_hlist_for_each_entry_rcu(event_priv, action_list, u.syscall.node) {
+                       struct lttng_kernel_event_recorder_private *event_recorder_priv =
+                               container_of(event_priv, struct lttng_kernel_event_recorder_private, parent);
+                       struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
+
+                       fptr(event_recorder, args[0], args[1], args[2], args[3]);
+               }
                break;
        }
        case 5:
@@ -511,8 +548,13 @@ void syscall_entry_call_func(struct hlist_head *action_list,
                unsigned long args[LTTNG_SYSCALL_NR_ARGS];
 
                lttng_syscall_get_arguments(current, regs, args);
-               lttng_hlist_for_each_entry_rcu(event, action_list, u.syscall.node)
-                       fptr(event, args[0], args[1], args[2], args[3], args[4]);
+               lttng_hlist_for_each_entry_rcu(event_priv, action_list, u.syscall.node) {
+                       struct lttng_kernel_event_recorder_private *event_recorder_priv =
+                               container_of(event_priv, struct lttng_kernel_event_recorder_private, parent);
+                       struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
+
+                       fptr(event_recorder, args[0], args[1], args[2], args[3], args[4]);
+               }
                break;
        }
        case 6:
@@ -527,9 +569,14 @@ void syscall_entry_call_func(struct hlist_head *action_list,
                unsigned long args[LTTNG_SYSCALL_NR_ARGS];
 
                lttng_syscall_get_arguments(current, regs, args);
-               lttng_hlist_for_each_entry_rcu(event, action_list, u.syscall.node)
-                       fptr(event, args[0], args[1], args[2],
+               lttng_hlist_for_each_entry_rcu(event_priv, action_list, u.syscall.node) {
+                       struct lttng_kernel_event_recorder_private *event_recorder_priv =
+                               container_of(event_priv, struct lttng_kernel_event_recorder_private, parent);
+                       struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
+
+                       fptr(event_recorder, args[0], args[1], args[2],
                             args[3], args[4], args[5]);
+               }
                break;
        }
        default:
@@ -541,15 +588,20 @@ static __always_inline
 void syscall_entry_event_notifier_call_func(struct hlist_head *dispatch_list,
                void *func, unsigned int nrargs, struct pt_regs *regs)
 {
-       struct lttng_event_notifier *notifier;
+       struct lttng_kernel_event_common_private *event_priv;
 
        switch (nrargs) {
        case 0:
        {
                void (*fptr)(void *__data) = func;
 
-               lttng_hlist_for_each_entry_rcu(notifier, dispatch_list, u.syscall.node)
-                       fptr(notifier);
+               lttng_hlist_for_each_entry_rcu(event_priv, dispatch_list, u.syscall.node) {
+                       struct lttng_kernel_event_notifier_private *event_notifier_priv =
+                               container_of(event_priv, struct lttng_kernel_event_notifier_private, parent);
+                       struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
+
+                       fptr(event_notifier);
+               }
                break;
        }
        case 1:
@@ -558,8 +610,13 @@ void syscall_entry_event_notifier_call_func(struct hlist_head *dispatch_list,
                unsigned long args[LTTNG_SYSCALL_NR_ARGS];
 
                lttng_syscall_get_arguments(current, regs, args);
-               lttng_hlist_for_each_entry_rcu(notifier, dispatch_list, u.syscall.node)
-                       fptr(notifier, args[0]);
+               lttng_hlist_for_each_entry_rcu(event_priv, dispatch_list, u.syscall.node) {
+                       struct lttng_kernel_event_notifier_private *event_notifier_priv =
+                               container_of(event_priv, struct lttng_kernel_event_notifier_private, parent);
+                       struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
+
+                       fptr(event_notifier, args[0]);
+               }
                break;
        }
        case 2:
@@ -570,8 +627,13 @@ void syscall_entry_event_notifier_call_func(struct hlist_head *dispatch_list,
                unsigned long args[LTTNG_SYSCALL_NR_ARGS];
 
                lttng_syscall_get_arguments(current, regs, args);
-               lttng_hlist_for_each_entry_rcu(notifier, dispatch_list, u.syscall.node)
-                       fptr(notifier, args[0], args[1]);
+               lttng_hlist_for_each_entry_rcu(event_priv, dispatch_list, u.syscall.node) {
+                       struct lttng_kernel_event_notifier_private *event_notifier_priv =
+                               container_of(event_priv, struct lttng_kernel_event_notifier_private, parent);
+                       struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
+
+                       fptr(event_notifier, args[0], args[1]);
+               }
                break;
        }
        case 3:
@@ -583,8 +645,13 @@ void syscall_entry_event_notifier_call_func(struct hlist_head *dispatch_list,
                unsigned long args[LTTNG_SYSCALL_NR_ARGS];
 
                lttng_syscall_get_arguments(current, regs, args);
-               lttng_hlist_for_each_entry_rcu(notifier, dispatch_list, u.syscall.node)
-                       fptr(notifier, args[0], args[1], args[2]);
+               lttng_hlist_for_each_entry_rcu(event_priv, dispatch_list, u.syscall.node) {
+                       struct lttng_kernel_event_notifier_private *event_notifier_priv =
+                               container_of(event_priv, struct lttng_kernel_event_notifier_private, parent);
+                       struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
+
+                       fptr(event_notifier, args[0], args[1], args[2]);
+               }
                break;
        }
        case 4:
@@ -597,8 +664,13 @@ void syscall_entry_event_notifier_call_func(struct hlist_head *dispatch_list,
                unsigned long args[LTTNG_SYSCALL_NR_ARGS];
 
                lttng_syscall_get_arguments(current, regs, args);
-               lttng_hlist_for_each_entry_rcu(notifier, dispatch_list, u.syscall.node)
-                       fptr(notifier, args[0], args[1], args[2], args[3]);
+               lttng_hlist_for_each_entry_rcu(event_priv, dispatch_list, u.syscall.node) {
+                       struct lttng_kernel_event_notifier_private *event_notifier_priv =
+                               container_of(event_priv, struct lttng_kernel_event_notifier_private, parent);
+                       struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
+
+                       fptr(event_notifier, args[0], args[1], args[2], args[3]);
+               }
                break;
        }
        case 5:
@@ -612,8 +684,13 @@ void syscall_entry_event_notifier_call_func(struct hlist_head *dispatch_list,
                unsigned long args[LTTNG_SYSCALL_NR_ARGS];
 
                lttng_syscall_get_arguments(current, regs, args);
-               lttng_hlist_for_each_entry_rcu(notifier, dispatch_list, u.syscall.node)
-                       fptr(notifier, args[0], args[1], args[2], args[3], args[4]);
+               lttng_hlist_for_each_entry_rcu(event_priv, dispatch_list, u.syscall.node) {
+                       struct lttng_kernel_event_notifier_private *event_notifier_priv =
+                               container_of(event_priv, struct lttng_kernel_event_notifier_private, parent);
+                       struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
+
+                       fptr(event_notifier, args[0], args[1], args[2], args[3], args[4]);
+               }
                break;
        }
        case 6:
@@ -628,8 +705,13 @@ void syscall_entry_event_notifier_call_func(struct hlist_head *dispatch_list,
                unsigned long args[LTTNG_SYSCALL_NR_ARGS];
 
                lttng_syscall_get_arguments(current, regs, args);
-               lttng_hlist_for_each_entry_rcu(notifier, dispatch_list, u.syscall.node)
-                       fptr(notifier, args[0], args[1], args[2], args[3], args[4], args[5]);
+               lttng_hlist_for_each_entry_rcu(event_priv, dispatch_list, u.syscall.node) {
+                       struct lttng_kernel_event_notifier_private *event_notifier_priv =
+                               container_of(event_priv, struct lttng_kernel_event_notifier_private, parent);
+                       struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
+
+                       fptr(event_notifier, args[0], args[1], args[2], args[3], args[4], args[5]);
+               }
                break;
        }
        default:
@@ -752,15 +834,19 @@ static void syscall_exit_event_unknown(struct hlist_head *unknown_action_list_he
        struct pt_regs *regs, long id, long ret)
 {
        unsigned long args[LTTNG_SYSCALL_NR_ARGS];
-       struct lttng_event *event;
+       struct lttng_kernel_event_common_private *event_priv;
 
        lttng_syscall_get_arguments(current, regs, args);
-       lttng_hlist_for_each_entry_rcu(event, unknown_action_list_head, u.syscall.node) {
+       lttng_hlist_for_each_entry_rcu(event_priv, unknown_action_list_head, u.syscall.node) {
+               struct lttng_kernel_event_recorder_private *event_recorder_priv =
+                       container_of(event_priv, struct lttng_kernel_event_recorder_private, parent);
+               struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
+
                if (unlikely(in_compat_syscall()))
-                       __event_probe__compat_syscall_exit_unknown(event, id, ret,
+                       __event_probe__compat_syscall_exit_unknown(event_recorder, id, ret,
                                args);
                else
-                       __event_probe__syscall_exit_unknown(event, id, ret, args);
+                       __event_probe__syscall_exit_unknown(event_recorder, id, ret, args);
        }
 }
 
@@ -769,15 +855,20 @@ void syscall_exit_call_func(struct hlist_head *action_list,
                void *func, unsigned int nrargs,
                struct pt_regs *regs, long ret)
 {
-       struct lttng_event *event;
+       struct lttng_kernel_event_common_private *event_priv;
 
        switch (nrargs) {
        case 0:
        {
                void (*fptr)(void *__data, long ret) = func;
 
-               lttng_hlist_for_each_entry_rcu(event, action_list, u.syscall.node)
-                       fptr(event, ret);
+               lttng_hlist_for_each_entry_rcu(event_priv, action_list, u.syscall.node) {
+                       struct lttng_kernel_event_recorder_private *event_recorder_priv =
+                               container_of(event_priv, struct lttng_kernel_event_recorder_private, parent);
+                       struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
+
+                       fptr(event_recorder, ret);
+               }
                break;
        }
        case 1:
@@ -788,8 +879,13 @@ void syscall_exit_call_func(struct hlist_head *action_list,
                unsigned long args[LTTNG_SYSCALL_NR_ARGS];
 
                lttng_syscall_get_arguments(current, regs, args);
-               lttng_hlist_for_each_entry_rcu(event, action_list, u.syscall.node)
-                       fptr(event, ret, args[0]);
+               lttng_hlist_for_each_entry_rcu(event_priv, action_list, u.syscall.node) {
+                       struct lttng_kernel_event_recorder_private *event_recorder_priv =
+                               container_of(event_priv, struct lttng_kernel_event_recorder_private, parent);
+                       struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
+
+                       fptr(event_recorder, ret, args[0]);
+               }
                break;
        }
        case 2:
@@ -801,8 +897,13 @@ void syscall_exit_call_func(struct hlist_head *action_list,
                unsigned long args[LTTNG_SYSCALL_NR_ARGS];
 
                lttng_syscall_get_arguments(current, regs, args);
-               lttng_hlist_for_each_entry_rcu(event, action_list, u.syscall.node)
-                       fptr(event, ret, args[0], args[1]);
+               lttng_hlist_for_each_entry_rcu(event_priv, action_list, u.syscall.node) {
+                       struct lttng_kernel_event_recorder_private *event_recorder_priv =
+                               container_of(event_priv, struct lttng_kernel_event_recorder_private, parent);
+                       struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
+
+                       fptr(event_recorder, ret, args[0], args[1]);
+               }
                break;
        }
        case 3:
@@ -815,8 +916,13 @@ void syscall_exit_call_func(struct hlist_head *action_list,
                unsigned long args[LTTNG_SYSCALL_NR_ARGS];
 
                lttng_syscall_get_arguments(current, regs, args);
-               lttng_hlist_for_each_entry_rcu(event, action_list, u.syscall.node)
-                       fptr(event, ret, args[0], args[1], args[2]);
+               lttng_hlist_for_each_entry_rcu(event_priv, action_list, u.syscall.node) {
+                       struct lttng_kernel_event_recorder_private *event_recorder_priv =
+                               container_of(event_priv, struct lttng_kernel_event_recorder_private, parent);
+                       struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
+
+                       fptr(event_recorder, ret, args[0], args[1], args[2]);
+               }
                break;
        }
        case 4:
@@ -830,8 +936,13 @@ void syscall_exit_call_func(struct hlist_head *action_list,
                unsigned long args[LTTNG_SYSCALL_NR_ARGS];
 
                lttng_syscall_get_arguments(current, regs, args);
-               lttng_hlist_for_each_entry_rcu(event, action_list, u.syscall.node)
-                       fptr(event, ret, args[0], args[1], args[2], args[3]);
+               lttng_hlist_for_each_entry_rcu(event_priv, action_list, u.syscall.node) {
+                       struct lttng_kernel_event_recorder_private *event_recorder_priv =
+                               container_of(event_priv, struct lttng_kernel_event_recorder_private, parent);
+                       struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
+
+                       fptr(event_recorder, ret, args[0], args[1], args[2], args[3]);
+               }
                break;
        }
        case 5:
@@ -846,8 +957,13 @@ void syscall_exit_call_func(struct hlist_head *action_list,
                unsigned long args[LTTNG_SYSCALL_NR_ARGS];
 
                lttng_syscall_get_arguments(current, regs, args);
-               lttng_hlist_for_each_entry_rcu(event, action_list, u.syscall.node)
-                       fptr(event, ret, args[0], args[1], args[2], args[3], args[4]);
+               lttng_hlist_for_each_entry_rcu(event_priv, action_list, u.syscall.node) {
+                       struct lttng_kernel_event_recorder_private *event_recorder_priv =
+                               container_of(event_priv, struct lttng_kernel_event_recorder_private, parent);
+                       struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
+
+                       fptr(event_recorder, ret, args[0], args[1], args[2], args[3], args[4]);
+               }
                break;
        }
        case 6:
@@ -863,9 +979,14 @@ void syscall_exit_call_func(struct hlist_head *action_list,
                unsigned long args[LTTNG_SYSCALL_NR_ARGS];
 
                lttng_syscall_get_arguments(current, regs, args);
-               lttng_hlist_for_each_entry_rcu(event, action_list, u.syscall.node)
-                       fptr(event, ret, args[0], args[1], args[2],
+               lttng_hlist_for_each_entry_rcu(event_priv, action_list, u.syscall.node) {
+                       struct lttng_kernel_event_recorder_private *event_recorder_priv =
+                               container_of(event_priv, struct lttng_kernel_event_recorder_private, parent);
+                       struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
+
+                       fptr(event_recorder, ret, args[0], args[1], args[2],
                             args[3], args[4], args[5]);
+               }
                break;
        }
        default:
@@ -933,15 +1054,20 @@ static __always_inline
 void syscall_exit_event_notifier_call_func(struct hlist_head *dispatch_list,
                void *func, unsigned int nrargs, struct pt_regs *regs, long ret)
 {
-       struct lttng_event_notifier *notifier;
+       struct lttng_kernel_event_common_private *event_priv;
 
        switch (nrargs) {
        case 0:
        {
                void (*fptr)(void *__data, long ret) = func;
 
-               lttng_hlist_for_each_entry_rcu(notifier, dispatch_list, u.syscall.node)
-                       fptr(notifier, ret);
+               lttng_hlist_for_each_entry_rcu(event_priv, dispatch_list, u.syscall.node) {
+                       struct lttng_kernel_event_notifier_private *event_notifier_priv =
+                               container_of(event_priv, struct lttng_kernel_event_notifier_private, parent);
+                       struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
+
+                       fptr(event_notifier, ret);
+               }
                break;
        }
        case 1:
@@ -950,8 +1076,13 @@ void syscall_exit_event_notifier_call_func(struct hlist_head *dispatch_list,
                unsigned long args[LTTNG_SYSCALL_NR_ARGS];
 
                lttng_syscall_get_arguments(current, regs, args);
-               lttng_hlist_for_each_entry_rcu(notifier, dispatch_list, u.syscall.node)
-                       fptr(notifier, ret, args[0]);
+               lttng_hlist_for_each_entry_rcu(event_priv, dispatch_list, u.syscall.node) {
+                       struct lttng_kernel_event_notifier_private *event_notifier_priv =
+                               container_of(event_priv, struct lttng_kernel_event_notifier_private, parent);
+                       struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
+
+                       fptr(event_notifier, ret, args[0]);
+               }
                break;
        }
        case 2:
@@ -963,8 +1094,13 @@ void syscall_exit_event_notifier_call_func(struct hlist_head *dispatch_list,
                unsigned long args[LTTNG_SYSCALL_NR_ARGS];
 
                lttng_syscall_get_arguments(current, regs, args);
-               lttng_hlist_for_each_entry_rcu(notifier, dispatch_list, u.syscall.node)
-                       fptr(notifier, ret, args[0], args[1]);
+               lttng_hlist_for_each_entry_rcu(event_priv, dispatch_list, u.syscall.node) {
+                       struct lttng_kernel_event_notifier_private *event_notifier_priv =
+                               container_of(event_priv, struct lttng_kernel_event_notifier_private, parent);
+                       struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
+
+                       fptr(event_notifier, ret, args[0], args[1]);
+               }
                break;
        }
        case 3:
@@ -977,8 +1113,13 @@ void syscall_exit_event_notifier_call_func(struct hlist_head *dispatch_list,
                unsigned long args[LTTNG_SYSCALL_NR_ARGS];
 
                lttng_syscall_get_arguments(current, regs, args);
-               lttng_hlist_for_each_entry_rcu(notifier, dispatch_list, u.syscall.node)
-                       fptr(notifier, ret, args[0], args[1], args[2]);
+               lttng_hlist_for_each_entry_rcu(event_priv, dispatch_list, u.syscall.node) {
+                       struct lttng_kernel_event_notifier_private *event_notifier_priv =
+                               container_of(event_priv, struct lttng_kernel_event_notifier_private, parent);
+                       struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
+
+                       fptr(event_notifier, ret, args[0], args[1], args[2]);
+               }
                break;
        }
        case 4:
@@ -992,8 +1133,13 @@ void syscall_exit_event_notifier_call_func(struct hlist_head *dispatch_list,
                unsigned long args[LTTNG_SYSCALL_NR_ARGS];
 
                lttng_syscall_get_arguments(current, regs, args);
-               lttng_hlist_for_each_entry_rcu(notifier, dispatch_list, u.syscall.node)
-                       fptr(notifier, ret, args[0], args[1], args[2], args[3]);
+               lttng_hlist_for_each_entry_rcu(event_priv, dispatch_list, u.syscall.node) {
+                       struct lttng_kernel_event_notifier_private *event_notifier_priv =
+                               container_of(event_priv, struct lttng_kernel_event_notifier_private, parent);
+                       struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
+
+                       fptr(event_notifier, ret, args[0], args[1], args[2], args[3]);
+               }
                break;
        }
        case 5:
@@ -1008,8 +1154,13 @@ void syscall_exit_event_notifier_call_func(struct hlist_head *dispatch_list,
                unsigned long args[LTTNG_SYSCALL_NR_ARGS];
 
                lttng_syscall_get_arguments(current, regs, args);
-               lttng_hlist_for_each_entry_rcu(notifier, dispatch_list, u.syscall.node)
-                       fptr(notifier, ret, args[0], args[1], args[2], args[3], args[4]);
+               lttng_hlist_for_each_entry_rcu(event_priv, dispatch_list, u.syscall.node) {
+                       struct lttng_kernel_event_notifier_private *event_notifier_priv =
+                               container_of(event_priv, struct lttng_kernel_event_notifier_private, parent);
+                       struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
+
+                       fptr(event_notifier, ret, args[0], args[1], args[2], args[3], args[4]);
+               }
                break;
        }
        case 6:
@@ -1025,8 +1176,13 @@ void syscall_exit_event_notifier_call_func(struct hlist_head *dispatch_list,
                unsigned long args[LTTNG_SYSCALL_NR_ARGS];
 
                lttng_syscall_get_arguments(current, regs, args);
-               lttng_hlist_for_each_entry_rcu(notifier, dispatch_list, u.syscall.node)
-                       fptr(notifier, ret, args[0], args[1], args[2], args[3], args[4], args[5]);
+               lttng_hlist_for_each_entry_rcu(event_priv, dispatch_list, u.syscall.node) {
+                       struct lttng_kernel_event_notifier_private *event_notifier_priv =
+                               container_of(event_priv, struct lttng_kernel_event_notifier_private, parent);
+                       struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
+
+                       fptr(event_notifier, ret, args[0], args[1], args[2], args[3], args[4], args[5]);
+               }
                break;
        }
        default:
@@ -1103,7 +1259,7 @@ void syscall_exit_event_notifier_probe(void *__data, struct pt_regs *regs,
 static
 int lttng_create_syscall_event_if_missing(const struct trace_syscall_entry *table, size_t table_len,
        struct hlist_head *chan_table, struct lttng_event_enabler *event_enabler,
-       void *filter, enum sc_type type)
+       enum sc_type type)
 {
        struct lttng_channel *chan = event_enabler->chan;
        struct lttng_session *session = chan->session;
@@ -1113,7 +1269,8 @@ int lttng_create_syscall_event_if_missing(const struct trace_syscall_entry *tabl
        for (i = 0; i < table_len; i++) {
                const struct lttng_kernel_event_desc *desc = table[i].desc;
                struct lttng_kernel_abi_event ev;
-               struct lttng_event *event;
+               struct lttng_kernel_event_recorder_private *event_recorder_priv;
+               struct lttng_kernel_event_recorder *event_recorder;
                struct hlist_head *head;
                bool found = false;
 
@@ -1130,9 +1287,9 @@ int lttng_create_syscall_event_if_missing(const struct trace_syscall_entry *tabl
                head = utils_borrow_hash_table_bucket(
                        session->events_ht.table, LTTNG_EVENT_HT_SIZE,
                        desc->event_name);
-               lttng_hlist_for_each_entry(event, head, hlist) {
-                       if (event->desc == desc
-                               && event->chan == event_enabler->chan)
+               lttng_hlist_for_each_entry(event_recorder_priv, head, hlist) {
+                       if (event_recorder_priv->parent.desc == desc
+                               && event_recorder_priv->pub->chan == event_enabler->chan)
                                found = true;
                }
                if (found)
@@ -1161,19 +1318,18 @@ int lttng_create_syscall_event_if_missing(const struct trace_syscall_entry *tabl
                strncpy(ev.name, desc->event_name, LTTNG_KERNEL_ABI_SYM_NAME_LEN - 1);
                ev.name[LTTNG_KERNEL_ABI_SYM_NAME_LEN - 1] = '\0';
                ev.instrumentation = LTTNG_KERNEL_ABI_SYSCALL;
-               event = _lttng_event_create(chan, &ev, filter,
-                                           desc, ev.instrumentation);
-               WARN_ON_ONCE(!event);
-               if (IS_ERR(event)) {
+               event_recorder = _lttng_kernel_event_recorder_create(chan, &ev, desc, ev.instrumentation);
+               WARN_ON_ONCE(!event_recorder);
+               if (IS_ERR(event_recorder)) {
                        /*
                         * If something goes wrong in event registration
                         * after the first one, we have no choice but to
                         * leave the previous events in there, until
                         * deleted by session teardown.
                         */
-                       return PTR_ERR(event);
+                       return PTR_ERR(event_recorder);
                }
-               hlist_add_head(&event->u.syscall.node, &chan_table[i]);
+               hlist_add_head(&event_recorder->priv->parent.u.syscall.node, &chan_table[i]);
        }
        return 0;
 }
@@ -1181,7 +1337,7 @@ int lttng_create_syscall_event_if_missing(const struct trace_syscall_entry *tabl
 /*
  * Should be called with sessions lock held.
  */
-int lttng_syscalls_register_event(struct lttng_event_enabler *event_enabler, void *filter)
+int lttng_syscalls_register_event(struct lttng_event_enabler *event_enabler)
 {
        struct lttng_channel *chan = event_enabler->chan;
        struct lttng_kernel_abi_event ev;
@@ -1191,14 +1347,14 @@ int lttng_syscalls_register_event(struct lttng_event_enabler *event_enabler, voi
 
        if (!chan->sc_table) {
                /* create syscall table mapping syscall to events */
-               chan->sc_table = kzalloc(sizeof(struct lttng_event *)
+               chan->sc_table = kzalloc(sizeof(struct lttng_kernel_event_recorder *)
                                        * ARRAY_SIZE(sc_table), GFP_KERNEL);
                if (!chan->sc_table)
                        return -ENOMEM;
        }
        if (!chan->sc_exit_table) {
                /* create syscall table mapping syscall to events */
-               chan->sc_exit_table = kzalloc(sizeof(struct lttng_event *)
+               chan->sc_exit_table = kzalloc(sizeof(struct lttng_kernel_event_recorder *)
                                        * ARRAY_SIZE(sc_exit_table), GFP_KERNEL);
                if (!chan->sc_exit_table)
                        return -ENOMEM;
@@ -1208,7 +1364,7 @@ int lttng_syscalls_register_event(struct lttng_event_enabler *event_enabler, voi
 #ifdef CONFIG_COMPAT
        if (!chan->compat_sc_table) {
                /* create syscall table mapping compat syscall to events */
-               chan->compat_sc_table = kzalloc(sizeof(struct lttng_event *)
+               chan->compat_sc_table = kzalloc(sizeof(struct lttng_kernel_event_recorder *)
                                        * ARRAY_SIZE(compat_sc_table), GFP_KERNEL);
                if (!chan->compat_sc_table)
                        return -ENOMEM;
@@ -1216,7 +1372,7 @@ int lttng_syscalls_register_event(struct lttng_event_enabler *event_enabler, voi
 
        if (!chan->compat_sc_exit_table) {
                /* create syscall table mapping compat syscall to events */
-               chan->compat_sc_exit_table = kzalloc(sizeof(struct lttng_event *)
+               chan->compat_sc_exit_table = kzalloc(sizeof(struct lttng_kernel_event_recorder *)
                                        * ARRAY_SIZE(compat_sc_exit_table), GFP_KERNEL);
                if (!chan->compat_sc_exit_table)
                        return -ENOMEM;
@@ -1225,7 +1381,7 @@ int lttng_syscalls_register_event(struct lttng_event_enabler *event_enabler, voi
        if (hlist_empty(&chan->sc_unknown)) {
                const struct lttng_kernel_event_desc *desc =
                        &__event_desc___syscall_entry_unknown;
-               struct lttng_event *event;
+               struct lttng_kernel_event_recorder *event_recorder;
 
                memset(&ev, 0, sizeof(ev));
                strncpy(ev.name, desc->event_name, LTTNG_KERNEL_ABI_SYM_NAME_LEN);
@@ -1233,19 +1389,19 @@ int lttng_syscalls_register_event(struct lttng_event_enabler *event_enabler, voi
                ev.instrumentation = LTTNG_KERNEL_ABI_SYSCALL;
                ev.u.syscall.entryexit = LTTNG_KERNEL_ABI_SYSCALL_ENTRY;
                ev.u.syscall.abi = LTTNG_KERNEL_ABI_SYSCALL_ABI_NATIVE;
-               event = _lttng_event_create(chan, &ev, filter, desc,
+               event_recorder = _lttng_kernel_event_recorder_create(chan, &ev, desc,
                                            ev.instrumentation);
-               WARN_ON_ONCE(!event);
-               if (IS_ERR(event)) {
-                       return PTR_ERR(event);
+               WARN_ON_ONCE(!event_recorder);
+               if (IS_ERR(event_recorder)) {
+                       return PTR_ERR(event_recorder);
                }
-               hlist_add_head(&event->u.syscall.node, &chan->sc_unknown);
+               hlist_add_head(&event_recorder->priv->parent.u.syscall.node, &chan->sc_unknown);
        }
 
        if (hlist_empty(&chan->sc_compat_unknown)) {
                const struct lttng_kernel_event_desc *desc =
                        &__event_desc___compat_syscall_entry_unknown;
-               struct lttng_event *event;
+               struct lttng_kernel_event_recorder *event_recorder;
 
                memset(&ev, 0, sizeof(ev));
                strncpy(ev.name, desc->event_name, LTTNG_KERNEL_ABI_SYM_NAME_LEN);
@@ -1253,19 +1409,19 @@ int lttng_syscalls_register_event(struct lttng_event_enabler *event_enabler, voi
                ev.instrumentation = LTTNG_KERNEL_ABI_SYSCALL;
                ev.u.syscall.entryexit = LTTNG_KERNEL_ABI_SYSCALL_ENTRY;
                ev.u.syscall.abi = LTTNG_KERNEL_ABI_SYSCALL_ABI_COMPAT;
-               event = _lttng_event_create(chan, &ev, filter, desc,
+               event_recorder = _lttng_kernel_event_recorder_create(chan, &ev, desc,
                                            ev.instrumentation);
-               WARN_ON_ONCE(!event);
-               if (IS_ERR(event)) {
-                       return PTR_ERR(event);
+               WARN_ON_ONCE(!event_recorder);
+               if (IS_ERR(event_recorder)) {
+                       return PTR_ERR(event_recorder);
                }
-               hlist_add_head(&event->u.syscall.node, &chan->sc_compat_unknown);
+               hlist_add_head(&event_recorder->priv->parent.u.syscall.node, &chan->sc_compat_unknown);
        }
 
        if (hlist_empty(&chan->compat_sc_exit_unknown)) {
                const struct lttng_kernel_event_desc *desc =
                        &__event_desc___compat_syscall_exit_unknown;
-               struct lttng_event *event;
+               struct lttng_kernel_event_recorder *event_recorder;
 
                memset(&ev, 0, sizeof(ev));
                strncpy(ev.name, desc->event_name, LTTNG_KERNEL_ABI_SYM_NAME_LEN);
@@ -1273,19 +1429,19 @@ int lttng_syscalls_register_event(struct lttng_event_enabler *event_enabler, voi
                ev.instrumentation = LTTNG_KERNEL_ABI_SYSCALL;
                ev.u.syscall.entryexit = LTTNG_KERNEL_ABI_SYSCALL_EXIT;
                ev.u.syscall.abi = LTTNG_KERNEL_ABI_SYSCALL_ABI_COMPAT;
-               event = _lttng_event_create(chan, &ev, filter, desc,
+               event_recorder = _lttng_kernel_event_recorder_create(chan, &ev, desc,
                                            ev.instrumentation);
-               WARN_ON_ONCE(!event);
-               if (IS_ERR(event)) {
-                       return PTR_ERR(event);
+               WARN_ON_ONCE(!event_recorder);
+               if (IS_ERR(event_recorder)) {
+                       return PTR_ERR(event_recorder);
                }
-               hlist_add_head(&event->u.syscall.node, &chan->compat_sc_exit_unknown);
+               hlist_add_head(&event_recorder->priv->parent.u.syscall.node, &chan->compat_sc_exit_unknown);
        }
 
        if (hlist_empty(&chan->sc_exit_unknown)) {
                const struct lttng_kernel_event_desc *desc =
                        &__event_desc___syscall_exit_unknown;
-               struct lttng_event *event;
+               struct lttng_kernel_event_recorder *event_recorder;
 
                memset(&ev, 0, sizeof(ev));
                strncpy(ev.name, desc->event_name, LTTNG_KERNEL_ABI_SYM_NAME_LEN);
@@ -1293,33 +1449,31 @@ int lttng_syscalls_register_event(struct lttng_event_enabler *event_enabler, voi
                ev.instrumentation = LTTNG_KERNEL_ABI_SYSCALL;
                ev.u.syscall.entryexit = LTTNG_KERNEL_ABI_SYSCALL_EXIT;
                ev.u.syscall.abi = LTTNG_KERNEL_ABI_SYSCALL_ABI_NATIVE;
-               event = _lttng_event_create(chan, &ev, filter, desc,
+               event_recorder = _lttng_kernel_event_recorder_create(chan, &ev, desc,
                                            ev.instrumentation);
-               WARN_ON_ONCE(!event);
-               if (IS_ERR(event)) {
-                       return PTR_ERR(event);
+               WARN_ON_ONCE(!event_recorder);
+               if (IS_ERR(event_recorder)) {
+                       return PTR_ERR(event_recorder);
                }
-               hlist_add_head(&event->u.syscall.node, &chan->sc_exit_unknown);
+               hlist_add_head(&event_recorder->priv->parent.u.syscall.node, &chan->sc_exit_unknown);
        }
 
        ret = lttng_create_syscall_event_if_missing(sc_table, ARRAY_SIZE(sc_table),
-                       chan->sc_table, event_enabler, filter, SC_TYPE_ENTRY);
+                       chan->sc_table, event_enabler, SC_TYPE_ENTRY);
        if (ret)
                return ret;
        ret = lttng_create_syscall_event_if_missing(sc_exit_table, ARRAY_SIZE(sc_exit_table),
-                       chan->sc_exit_table, event_enabler, filter, SC_TYPE_EXIT);
+                       chan->sc_exit_table, event_enabler, SC_TYPE_EXIT);
        if (ret)
                return ret;
 
 #ifdef CONFIG_COMPAT
        ret = lttng_create_syscall_event_if_missing(compat_sc_table, ARRAY_SIZE(compat_sc_table),
-                       chan->compat_sc_table, event_enabler, filter,
-                       SC_TYPE_COMPAT_ENTRY);
+                       chan->compat_sc_table, event_enabler, SC_TYPE_COMPAT_ENTRY);
        if (ret)
                return ret;
        ret = lttng_create_syscall_event_if_missing(compat_sc_exit_table, ARRAY_SIZE(compat_sc_exit_table),
-                       chan->compat_sc_exit_table, event_enabler, filter,
-                       SC_TYPE_COMPAT_EXIT);
+                       chan->compat_sc_exit_table, event_enabler, SC_TYPE_COMPAT_EXIT);
        if (ret)
                return ret;
 #endif
@@ -1359,8 +1513,7 @@ int lttng_syscalls_register_event(struct lttng_event_enabler *event_enabler, voi
  * Should be called with sessions lock held.
  */
 int lttng_syscalls_register_event_notifier(
-               struct lttng_event_notifier_enabler *event_notifier_enabler,
-               void *filter)
+               struct lttng_event_notifier_enabler *event_notifier_enabler)
 {
        struct lttng_event_notifier_group *group = event_notifier_enabler->group;
        unsigned int i;
@@ -1464,7 +1617,8 @@ int create_unknown_event_notifier(
                struct lttng_event_notifier_enabler *event_notifier_enabler,
                enum sc_type type)
 {
-       struct lttng_event_notifier *notifier;
+       struct lttng_kernel_event_notifier_private *event_notifier_priv;
+       struct lttng_kernel_event_notifier *event_notifier;
        const struct lttng_kernel_event_desc *desc;
        struct lttng_event_notifier_group *group = event_notifier_enabler->group;
        struct lttng_kernel_abi_event_notifier event_notifier_param;
@@ -1513,9 +1667,9 @@ int create_unknown_event_notifier(
         */
        head = utils_borrow_hash_table_bucket(group->event_notifiers_ht.table,
                LTTNG_EVENT_NOTIFIER_HT_SIZE, desc->event_name);
-       lttng_hlist_for_each_entry(notifier, head, hlist) {
-               if (notifier->desc == desc &&
-                               notifier->user_token == base_enabler->user_token)
+       lttng_hlist_for_each_entry(event_notifier_priv, head, hlist) {
+               if (event_notifier_priv->parent.desc == desc &&
+                               event_notifier_priv->parent.user_token == base_enabler->user_token)
                        found = true;
        }
        if (found)
@@ -1531,17 +1685,17 @@ int create_unknown_event_notifier(
        event_notifier_param.event.u.syscall.abi = abi;
        event_notifier_param.event.u.syscall.entryexit = entryexit;
 
-       notifier = _lttng_event_notifier_create(desc, user_token,
-               error_counter_index, group, &event_notifier_param, NULL,
+       event_notifier = _lttng_event_notifier_create(desc, user_token,
+               error_counter_index, group, &event_notifier_param,
                event_notifier_param.event.instrumentation);
-       if (IS_ERR(notifier)) {
+       if (IS_ERR(event_notifier)) {
                printk(KERN_INFO "Unable to create unknown notifier %s\n",
                        desc->event_name);
                ret = -ENOMEM;
                goto end;
        }
 
-       hlist_add_head_rcu(&notifier->u.syscall.node, unknown_dispatch_list);
+       hlist_add_head_rcu(&event_notifier->priv->parent.u.syscall.node, unknown_dispatch_list);
 
 end:
        return ret;
@@ -1549,7 +1703,7 @@ end:
 
 static int create_matching_event_notifiers(
                struct lttng_event_notifier_enabler *event_notifier_enabler,
-               void *filter, const struct trace_syscall_entry *table,
+               const struct trace_syscall_entry *table,
                size_t table_len, enum sc_type type)
 {
        struct lttng_event_notifier_group *group = event_notifier_enabler->group;
@@ -1561,7 +1715,8 @@ static int create_matching_event_notifiers(
 
        /* iterate over all syscall and create event_notifier that match */
        for (i = 0; i < table_len; i++) {
-               struct lttng_event_notifier *event_notifier;
+               struct lttng_kernel_event_notifier_private *event_notifier_priv;
+               struct lttng_kernel_event_notifier *event_notifier;
                struct lttng_kernel_abi_event_notifier event_notifier_param;
                struct hlist_head *head;
                int found = 0;
@@ -1581,9 +1736,9 @@ static int create_matching_event_notifiers(
                 */
                head = utils_borrow_hash_table_bucket(group->event_notifiers_ht.table,
                        LTTNG_EVENT_NOTIFIER_HT_SIZE, desc->event_name);
-               lttng_hlist_for_each_entry(event_notifier, head, hlist) {
-                       if (event_notifier->desc == desc
-                               && event_notifier->user_token == event_notifier_enabler->base.user_token)
+               lttng_hlist_for_each_entry(event_notifier_priv, head, hlist) {
+                       if (event_notifier_priv->parent.desc == desc
+                               && event_notifier_priv->parent.user_token == event_notifier_enabler->base.user_token)
                                found = 1;
                }
                if (found)
@@ -1615,7 +1770,7 @@ static int create_matching_event_notifiers(
 
                event_notifier = _lttng_event_notifier_create(desc, user_token,
                        error_counter_index, group, &event_notifier_param,
-                       filter, event_notifier_param.event.instrumentation);
+                       event_notifier_param.event.instrumentation);
                if (IS_ERR(event_notifier)) {
                        printk(KERN_INFO "Unable to create event_notifier %s\n",
                                desc->event_name);
@@ -1623,7 +1778,7 @@ static int create_matching_event_notifiers(
                        goto end;
                }
 
-               event_notifier->u.syscall.syscall_id = i;
+               event_notifier->priv->parent.u.syscall.syscall_id = i;
        }
 
 end:
@@ -1631,9 +1786,8 @@ end:
 
 }
 
-int lttng_syscals_create_matching_event_notifiers(
-               struct lttng_event_notifier_enabler *event_notifier_enabler,
-               void *filter)
+int lttng_syscalls_create_matching_event_notifiers(
+               struct lttng_event_notifier_enabler *event_notifier_enabler)
 {
        int ret;
        struct lttng_enabler *base_enabler =
@@ -1643,12 +1797,12 @@ int lttng_syscals_create_matching_event_notifiers(
 
        if (entryexit == LTTNG_KERNEL_ABI_SYSCALL_ENTRY || entryexit == LTTNG_KERNEL_ABI_SYSCALL_ENTRYEXIT) {
                ret = create_matching_event_notifiers(event_notifier_enabler,
-                       filter, sc_table, ARRAY_SIZE(sc_table), SC_TYPE_ENTRY);
+                       sc_table, ARRAY_SIZE(sc_table), SC_TYPE_ENTRY);
                if (ret)
                        goto end;
 
                ret = create_matching_event_notifiers(event_notifier_enabler,
-                       filter, compat_sc_table, ARRAY_SIZE(compat_sc_table),
+                       compat_sc_table, ARRAY_SIZE(compat_sc_table),
                        SC_TYPE_COMPAT_ENTRY);
                if (ret)
                        goto end;
@@ -1666,7 +1820,7 @@ int lttng_syscals_create_matching_event_notifiers(
 
        if (entryexit == LTTNG_KERNEL_ABI_SYSCALL_EXIT || entryexit == LTTNG_KERNEL_ABI_SYSCALL_ENTRYEXIT) {
                ret = create_matching_event_notifiers(event_notifier_enabler,
-                       filter, sc_exit_table, ARRAY_SIZE(sc_exit_table),
+                       sc_exit_table, ARRAY_SIZE(sc_exit_table),
                        SC_TYPE_EXIT);
                if (ret)
                        goto end;
@@ -1677,7 +1831,7 @@ int lttng_syscals_create_matching_event_notifiers(
                        goto end;
 
                ret = create_matching_event_notifiers(event_notifier_enabler,
-                       filter, compat_sc_exit_table, ARRAY_SIZE(compat_sc_exit_table),
+                       compat_sc_exit_table, ARRAY_SIZE(compat_sc_exit_table),
                        SC_TYPE_COMPAT_EXIT);
                if (ret)
                        goto end;
@@ -1910,25 +2064,26 @@ int lttng_syscall_filter_enable(
 }
 
 int lttng_syscall_filter_enable_event_notifier(
-               struct lttng_event_notifier *notifier)
+               struct lttng_kernel_event_notifier *event_notifier)
 {
-       struct lttng_event_notifier_group *group = notifier->group;
-       unsigned int syscall_id = notifier->u.syscall.syscall_id;
+       struct lttng_event_notifier_group *group = event_notifier->priv->group;
+       unsigned int syscall_id = event_notifier->priv->parent.u.syscall.syscall_id;
        struct hlist_head *dispatch_list;
        int ret = 0;
 
-       WARN_ON_ONCE(notifier->instrumentation != LTTNG_KERNEL_ABI_SYSCALL);
+       WARN_ON_ONCE(event_notifier->priv->parent.instrumentation != LTTNG_KERNEL_ABI_SYSCALL);
 
        ret = lttng_syscall_filter_enable(group->sc_filter,
-               notifier->desc->event_name, notifier->u.syscall.abi,
-               notifier->u.syscall.entryexit);
+               event_notifier->priv->parent.desc->event_name,
+               event_notifier->priv->parent.u.syscall.abi,
+               event_notifier->priv->parent.u.syscall.entryexit);
        if (ret) {
                goto end;
        }
 
-       switch (notifier->u.syscall.entryexit) {
+       switch (event_notifier->priv->parent.u.syscall.entryexit) {
        case LTTNG_SYSCALL_ENTRY:
-               switch (notifier->u.syscall.abi) {
+               switch (event_notifier->priv->parent.u.syscall.abi) {
                case LTTNG_SYSCALL_ABI_NATIVE:
                        dispatch_list = &group->event_notifier_syscall_dispatch[syscall_id];
                        break;
@@ -1941,7 +2096,7 @@ int lttng_syscall_filter_enable_event_notifier(
                }
                break;
        case LTTNG_SYSCALL_EXIT:
-               switch (notifier->u.syscall.abi) {
+               switch (event_notifier->priv->parent.u.syscall.abi) {
                case LTTNG_SYSCALL_ABI_NATIVE:
                        dispatch_list = &group->event_notifier_exit_syscall_dispatch[syscall_id];
                        break;
@@ -1958,7 +2113,7 @@ int lttng_syscall_filter_enable_event_notifier(
                goto end;
        }
 
-       hlist_add_head_rcu(&notifier->u.syscall.node, dispatch_list);
+       hlist_add_head_rcu(&event_notifier->priv->parent.u.syscall.node, dispatch_list);
 
 end:
        return ret ;
@@ -1966,13 +2121,14 @@ end:
 
 int lttng_syscall_filter_enable_event(
                struct lttng_channel *channel,
-               struct lttng_event *event)
+               struct lttng_kernel_event_recorder *event_recorder)
 {
-       WARN_ON_ONCE(event->instrumentation != LTTNG_KERNEL_ABI_SYSCALL);
+       WARN_ON_ONCE(event_recorder->priv->parent.instrumentation != LTTNG_KERNEL_ABI_SYSCALL);
 
        return lttng_syscall_filter_enable(channel->sc_filter,
-               event->desc->event_name, event->u.syscall.abi,
-               event->u.syscall.entryexit);
+               event_recorder->priv->parent.desc->event_name,
+               event_recorder->priv->parent.u.syscall.abi,
+               event_recorder->priv->parent.u.syscall.entryexit);
 }
 
 static
@@ -2036,29 +2192,31 @@ int lttng_syscall_filter_disable(
 }
 
 int lttng_syscall_filter_disable_event_notifier(
-               struct lttng_event_notifier *notifier)
+               struct lttng_kernel_event_notifier *event_notifier)
 {
-       struct lttng_event_notifier_group *group = notifier->group;
+       struct lttng_event_notifier_group *group = event_notifier->priv->group;
        int ret;
 
-       WARN_ON_ONCE(notifier->instrumentation != LTTNG_KERNEL_ABI_SYSCALL);
+       WARN_ON_ONCE(event_notifier->priv->parent.instrumentation != LTTNG_KERNEL_ABI_SYSCALL);
 
        ret = lttng_syscall_filter_disable(group->sc_filter,
-               notifier->desc->event_name, notifier->u.syscall.abi,
-               notifier->u.syscall.entryexit);
+               event_notifier->priv->parent.desc->event_name,
+               event_notifier->priv->parent.u.syscall.abi,
+               event_notifier->priv->parent.u.syscall.entryexit);
        WARN_ON_ONCE(ret != 0);
 
-       hlist_del_rcu(&notifier->u.syscall.node);
+       hlist_del_rcu(&event_notifier->priv->parent.u.syscall.node);
        return 0;
 }
 
 int lttng_syscall_filter_disable_event(
                struct lttng_channel *channel,
-               struct lttng_event *event)
+               struct lttng_kernel_event_recorder *event_recorder)
 {
        return lttng_syscall_filter_disable(channel->sc_filter,
-               event->desc->event_name, event->u.syscall.abi,
-               event->u.syscall.entryexit);
+               event_recorder->priv->parent.desc->event_name,
+               event_recorder->priv->parent.u.syscall.abi,
+               event_recorder->priv->parent.u.syscall.entryexit);
 }
 
 static
index 5d22169d3ffa196396fdb5aded83241be6ef53f5..ecb08fc8fd65f9f9dcb474d4e959baadca50b7d2 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/kprobes.h>
 #include <linux/slab.h>
 #include <lttng/events.h>
+#include <lttng/events-internal.h>
 #include <ringbuffer/frontend_types.h>
 #include <wrapper/vmalloc.h>
 #include <wrapper/irqflags.h>
 static
 int lttng_kprobes_event_handler_pre(struct kprobe *p, struct pt_regs *regs)
 {
-       struct lttng_event *event =
-               container_of(p, struct lttng_event, u.kprobe.kp);
+       struct lttng_kernel_event_common_private *event_priv =
+               container_of(p, struct lttng_kernel_event_common_private, u.kprobe.kp);
+       struct lttng_kernel_event_recorder_private *event_recorder_priv =
+               container_of(event_priv, struct lttng_kernel_event_recorder_private, parent);
+       struct lttng_kernel_event_recorder *event_recorder =
+               event_recorder_priv->pub;
        struct lttng_probe_ctx lttng_probe_ctx = {
-               .event = event,
+               .event = event_recorder,
                .interruptible = !lttng_regs_irqs_disabled(regs),
        };
-       struct lttng_channel *chan = event->chan;
+       struct lttng_channel *chan = event_recorder->chan;
        struct lib_ring_buffer_ctx ctx;
        int ret;
        unsigned long data = (unsigned long) p->addr;
@@ -35,12 +40,12 @@ int lttng_kprobes_event_handler_pre(struct kprobe *p, struct pt_regs *regs)
                return 0;
        if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
                return 0;
-       if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
+       if (unlikely(!LTTNG_READ_ONCE(event_recorder->parent.enabled)))
                return 0;
 
        lib_ring_buffer_ctx_init(&ctx, chan->chan, &lttng_probe_ctx, sizeof(data),
                                 lttng_alignof(data), -1);
-       ret = chan->ops->event_reserve(&ctx, event->id);
+       ret = chan->ops->event_reserve(&ctx, event_recorder->priv->id);
        if (ret < 0)
                return 0;
        lib_ring_buffer_align_ctx(&ctx, lttng_alignof(data));
@@ -52,15 +57,19 @@ int lttng_kprobes_event_handler_pre(struct kprobe *p, struct pt_regs *regs)
 static
 int lttng_kprobes_event_notifier_handler_pre(struct kprobe *p, struct pt_regs *regs)
 {
-       struct lttng_event_notifier *event_notifier =
-               container_of(p, struct lttng_event_notifier, u.kprobe.kp);
-       struct lttng_kernel_notifier_ctx notif_ctx;
-
-       if (unlikely(!READ_ONCE(event_notifier->enabled)))
+       struct lttng_kernel_event_common_private *event_priv =
+               container_of(p, struct lttng_kernel_event_common_private, u.kprobe.kp);
+       struct lttng_kernel_event_notifier_private *event_notifier_priv =
+               container_of(event_priv, struct lttng_kernel_event_notifier_private, parent);
+       struct lttng_kernel_event_notifier *event_notifier =
+               event_notifier_priv->pub;
+       struct lttng_kernel_notification_ctx notif_ctx;
+
+       if (unlikely(!READ_ONCE(event_notifier->parent.enabled)))
                return 0;
 
        notif_ctx.eval_capture = LTTNG_READ_ONCE(event_notifier->eval_capture);
-       event_notifier->send_notification(event_notifier, NULL, NULL, &notif_ctx);
+       event_notifier->notification_send(event_notifier, NULL, NULL, &notif_ctx);
 
        return 0;
 }
@@ -72,7 +81,7 @@ static const struct lttng_kernel_type_common *event_type =
  * Create event description
  */
 static
-int lttng_create_kprobe_event(const char *name, struct lttng_event *event)
+int lttng_create_kprobe_event(const char *name, struct lttng_kernel_event_recorder *event_recorder)
 {
        const struct lttng_kernel_event_field **fieldp_array;
        struct lttng_kernel_event_field *field;
@@ -103,7 +112,7 @@ int lttng_create_kprobe_event(const char *name, struct lttng_event *event)
        field->name = "ip";
        field->type = event_type;
        desc->owner = THIS_MODULE;
-       event->desc = desc;
+       event_recorder->priv->parent.desc = desc;
 
        return 0;
 
@@ -120,7 +129,7 @@ error_str:
  * Create event_notifier description
  */
 static
-int lttng_create_kprobe_event_notifier(const char *name, struct lttng_event_notifier *event_notifier)
+int lttng_create_kprobe_event_notifier(const char *name, struct lttng_kernel_event_notifier *event_notifier)
 {
        struct lttng_kernel_event_desc *desc;
        int ret;
@@ -136,7 +145,7 @@ int lttng_create_kprobe_event_notifier(const char *name, struct lttng_event_noti
        desc->nr_fields = 0;
 
        desc->owner = THIS_MODULE;
-       event_notifier->desc = desc;
+       event_notifier->priv->parent.desc = desc;
 
        return 0;
 
@@ -200,25 +209,25 @@ int lttng_kprobes_register_event(const char *name,
                           const char *symbol_name,
                           uint64_t offset,
                           uint64_t addr,
-                          struct lttng_event *event)
+                          struct lttng_kernel_event_recorder *event_recorder)
 {
        int ret;
 
-       ret = lttng_create_kprobe_event(name, event);
+       ret = lttng_create_kprobe_event(name, event_recorder);
        if (ret)
                goto error;
 
        ret = _lttng_kprobes_register(symbol_name, offset, addr,
-               &event->u.kprobe, lttng_kprobes_event_handler_pre);
+               &event_recorder->priv->parent.u.kprobe, lttng_kprobes_event_handler_pre);
        if (ret)
                goto register_error;
 
        return 0;
 
 register_error:
-       kfree(event->desc->fields);
-       kfree(event->desc->event_name);
-       kfree(event->desc);
+       kfree(event_recorder->priv->parent.desc->fields);
+       kfree(event_recorder->priv->parent.desc->event_name);
+       kfree(event_recorder->priv->parent.desc);
 error:
        return ret;
 }
@@ -227,7 +236,7 @@ EXPORT_SYMBOL_GPL(lttng_kprobes_register_event);
 int lttng_kprobes_register_event_notifier(const char *symbol_name,
                           uint64_t offset,
                           uint64_t addr,
-                          struct lttng_event_notifier *event_notifier)
+                          struct lttng_kernel_event_notifier *event_notifier)
 {
        int ret;
        ret = lttng_create_kprobe_event_notifier(symbol_name, event_notifier);
@@ -235,47 +244,47 @@ int lttng_kprobes_register_event_notifier(const char *symbol_name,
                goto error;
 
        ret = _lttng_kprobes_register(symbol_name, offset, addr,
-               &event_notifier->u.kprobe, lttng_kprobes_event_notifier_handler_pre);
+               &event_notifier->priv->parent.u.kprobe, lttng_kprobes_event_notifier_handler_pre);
        if (ret)
                goto register_error;
 
        return 0;
 
 register_error:
-       kfree(event_notifier->desc->event_name);
-       kfree(event_notifier->desc);
+       kfree(event_notifier->priv->parent.desc->event_name);
+       kfree(event_notifier->priv->parent.desc);
 error:
        return ret;
 }
 EXPORT_SYMBOL_GPL(lttng_kprobes_register_event_notifier);
 
-void lttng_kprobes_unregister_event(struct lttng_event *event)
+void lttng_kprobes_unregister_event(struct lttng_kernel_event_recorder *event_recorder)
 {
-       unregister_kprobe(&event->u.kprobe.kp);
+       unregister_kprobe(&event_recorder->priv->parent.u.kprobe.kp);
 }
 EXPORT_SYMBOL_GPL(lttng_kprobes_unregister_event);
 
-void lttng_kprobes_unregister_event_notifier(struct lttng_event_notifier *event_notifier)
+void lttng_kprobes_unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier)
 {
-       unregister_kprobe(&event_notifier->u.kprobe.kp);
+       unregister_kprobe(&event_notifier->priv->parent.u.kprobe.kp);
 }
 EXPORT_SYMBOL_GPL(lttng_kprobes_unregister_event_notifier);
 
-void lttng_kprobes_destroy_event_private(struct lttng_event *event)
+void lttng_kprobes_destroy_event_private(struct lttng_kernel_event_recorder *event_recorder)
 {
-       kfree(event->u.kprobe.symbol_name);
-       kfree(event->desc->fields[0]);
-       kfree(event->desc->fields);
-       kfree(event->desc->event_name);
-       kfree(event->desc);
+       kfree(event_recorder->priv->parent.u.kprobe.symbol_name);
+       kfree(event_recorder->priv->parent.desc->fields[0]);
+       kfree(event_recorder->priv->parent.desc->fields);
+       kfree(event_recorder->priv->parent.desc->event_name);
+       kfree(event_recorder->priv->parent.desc);
 }
 EXPORT_SYMBOL_GPL(lttng_kprobes_destroy_event_private);
 
-void lttng_kprobes_destroy_event_notifier_private(struct lttng_event_notifier *event_notifier)
+void lttng_kprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier)
 {
-       kfree(event_notifier->u.kprobe.symbol_name);
-       kfree(event_notifier->desc->event_name);
-       kfree(event_notifier->desc);
+       kfree(event_notifier->priv->parent.u.kprobe.symbol_name);
+       kfree(event_notifier->priv->parent.desc->event_name);
+       kfree(event_notifier->priv->parent.desc);
 }
 EXPORT_SYMBOL_GPL(lttng_kprobes_destroy_event_notifier_private);
 
index 79add9863298d0600c9c69557b9875a89d309ff7..3084aedfd41d162ba0389065870e9aadd5954148 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/slab.h>
 #include <linux/kref.h>
 #include <lttng/events.h>
+#include <lttng/events-internal.h>
 #include <ringbuffer/frontend_types.h>
 #include <wrapper/vmalloc.h>
 #include <wrapper/irqflags.h>
@@ -25,7 +26,7 @@ enum lttng_kretprobe_type {
 
 struct lttng_krp {
        struct kretprobe krp;
-       struct lttng_event *event[2];   /* ENTRY and EXIT */
+       struct lttng_kernel_event_recorder *event[2];   /* ENTRY and EXIT */
        struct kref kref_register;
        struct kref kref_alloc;
 };
@@ -37,13 +38,13 @@ int _lttng_kretprobes_handler(struct kretprobe_instance *krpi,
 {
        struct lttng_krp *lttng_krp =
                container_of(lttng_get_kretprobe(krpi), struct lttng_krp, krp);
-       struct lttng_event *event =
+       struct lttng_kernel_event_recorder *event_recorder =
                lttng_krp->event[type];
        struct lttng_probe_ctx lttng_probe_ctx = {
-               .event = event,
+               .event = event_recorder,
                .interruptible = !lttng_regs_irqs_disabled(regs),
        };
-       struct lttng_channel *chan = event->chan;
+       struct lttng_channel *chan = event_recorder->chan;
        struct lib_ring_buffer_ctx ctx;
        int ret;
        struct {
@@ -55,7 +56,7 @@ int _lttng_kretprobes_handler(struct kretprobe_instance *krpi,
                return 0;
        if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
                return 0;
-       if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
+       if (unlikely(!LTTNG_READ_ONCE(event_recorder->parent.enabled)))
                return 0;
 
        payload.ip = (unsigned long) lttng_get_kretprobe(krpi)->kp.addr;
@@ -63,7 +64,7 @@ int _lttng_kretprobes_handler(struct kretprobe_instance *krpi,
 
        lib_ring_buffer_ctx_init(&ctx, chan->chan, &lttng_probe_ctx, sizeof(payload),
                                 lttng_alignof(payload), -1);
-       ret = chan->ops->event_reserve(&ctx, event->id);
+       ret = chan->ops->event_reserve(&ctx, event_recorder->priv->id);
        if (ret < 0)
                return 0;
        lib_ring_buffer_align_ctx(&ctx, lttng_alignof(payload));
@@ -93,7 +94,7 @@ static const struct lttng_kernel_type_common *event_type =
  * Create event description
  */
 static
-int lttng_create_kprobe_event(const char *name, struct lttng_event *event,
+int lttng_create_kprobe_event(const char *name, struct lttng_kernel_event_recorder *event_recorder,
                              enum lttng_kretprobe_type type)
 {
        const struct lttng_kernel_event_field **fieldp_array;
@@ -152,7 +153,7 @@ int lttng_create_kprobe_event(const char *name, struct lttng_event *event,
        desc->fields[1] = field;
 
        desc->owner = THIS_MODULE;
-       event->desc = desc;
+       event_recorder->priv->parent.desc = desc;
 
        return 0;
 
@@ -171,8 +172,8 @@ int lttng_kretprobes_register(const char *name,
                           const char *symbol_name,
                           uint64_t offset,
                           uint64_t addr,
-                          struct lttng_event *event_entry,
-                          struct lttng_event *event_exit)
+                          struct lttng_kernel_event_recorder *event_recorder_entry,
+                          struct lttng_kernel_event_recorder *event_recorder_exit)
 {
        int ret;
        struct lttng_krp *lttng_krp;
@@ -181,10 +182,10 @@ int lttng_kretprobes_register(const char *name,
        if (symbol_name[0] == '\0')
                symbol_name = NULL;
 
-       ret = lttng_create_kprobe_event(name, event_entry, EVENT_ENTRY);
+       ret = lttng_create_kprobe_event(name, event_recorder_entry, EVENT_ENTRY);
        if (ret)
                goto error;
-       ret = lttng_create_kprobe_event(name, event_exit, EVENT_EXIT);
+       ret = lttng_create_kprobe_event(name, event_recorder_exit, EVENT_EXIT);
        if (ret)
                goto event_exit_error;
        lttng_krp = kzalloc(sizeof(*lttng_krp), GFP_KERNEL);
@@ -202,19 +203,19 @@ int lttng_kretprobes_register(const char *name,
                }
                lttng_krp->krp.kp.symbol_name =
                        alloc_symbol;
-               event_entry->u.kretprobe.symbol_name =
+               event_recorder_entry->priv->parent.u.kretprobe.symbol_name =
                        alloc_symbol;
-               event_exit->u.kretprobe.symbol_name =
+               event_recorder_exit->priv->parent.u.kretprobe.symbol_name =
                        alloc_symbol;
        }
        lttng_krp->krp.kp.offset = offset;
        lttng_krp->krp.kp.addr = (void *) (unsigned long) addr;
 
        /* Allow probe handler to find event structures */
-       lttng_krp->event[EVENT_ENTRY] = event_entry;
-       lttng_krp->event[EVENT_EXIT] = event_exit;
-       event_entry->u.kretprobe.lttng_krp = lttng_krp;
-       event_exit->u.kretprobe.lttng_krp = lttng_krp;
+       lttng_krp->event[EVENT_ENTRY] = event_recorder_entry;
+       lttng_krp->event[EVENT_EXIT] = event_recorder_exit;
+       event_recorder_entry->priv->parent.u.kretprobe.lttng_krp = lttng_krp;
+       event_recorder_exit->priv->parent.u.kretprobe.lttng_krp = lttng_krp;
 
        /*
         * Both events must be unregistered before the kretprobe is
@@ -242,17 +243,17 @@ register_error:
 name_error:
        kfree(lttng_krp);
 krp_error:
-       kfree(event_exit->desc->fields[0]);
-       kfree(event_exit->desc->fields[1]);
-       kfree(event_exit->desc->fields);
-       kfree(event_exit->desc->event_name);
-       kfree(event_exit->desc);
+       kfree(event_recorder_exit->priv->parent.desc->fields[0]);
+       kfree(event_recorder_exit->priv->parent.desc->fields[1]);
+       kfree(event_recorder_exit->priv->parent.desc->fields);
+       kfree(event_recorder_exit->priv->parent.desc->event_name);
+       kfree(event_recorder_exit->priv->parent.desc);
 event_exit_error:
-       kfree(event_entry->desc->fields[0]);
-       kfree(event_entry->desc->fields[1]);
-       kfree(event_entry->desc->fields);
-       kfree(event_entry->desc->event_name);
-       kfree(event_entry->desc);
+       kfree(event_recorder_entry->priv->parent.desc->fields[0]);
+       kfree(event_recorder_entry->priv->parent.desc->fields[1]);
+       kfree(event_recorder_entry->priv->parent.desc->fields);
+       kfree(event_recorder_entry->priv->parent.desc->event_name);
+       kfree(event_recorder_entry->priv->parent.desc);
 error:
        return ret;
 }
@@ -266,9 +267,9 @@ void _lttng_kretprobes_unregister_release(struct kref *kref)
        unregister_kretprobe(&lttng_krp->krp);
 }
 
-void lttng_kretprobes_unregister(struct lttng_event *event)
+void lttng_kretprobes_unregister(struct lttng_kernel_event_recorder *event_recorder)
 {
-       kref_put(&event->u.kretprobe.lttng_krp->kref_register,
+       kref_put(&event_recorder->priv->parent.u.kretprobe.lttng_krp->kref_register,
                _lttng_kretprobes_unregister_release);
 }
 EXPORT_SYMBOL_GPL(lttng_kretprobes_unregister);
@@ -281,34 +282,34 @@ void _lttng_kretprobes_release(struct kref *kref)
        kfree(lttng_krp->krp.kp.symbol_name);
 }
 
-void lttng_kretprobes_destroy_private(struct lttng_event *event)
+void lttng_kretprobes_destroy_private(struct lttng_kernel_event_recorder *event_recorder)
 {
-       kfree(event->desc->fields[0]);
-       kfree(event->desc->fields[1]);
-       kfree(event->desc->fields);
-       kfree(event->desc->event_name);
-       kfree(event->desc);
-       kref_put(&event->u.kretprobe.lttng_krp->kref_alloc,
+       kfree(event_recorder->priv->parent.desc->fields[0]);
+       kfree(event_recorder->priv->parent.desc->fields[1]);
+       kfree(event_recorder->priv->parent.desc->fields);
+       kfree(event_recorder->priv->parent.desc->event_name);
+       kfree(event_recorder->priv->parent.desc);
+       kref_put(&event_recorder->priv->parent.u.kretprobe.lttng_krp->kref_alloc,
                _lttng_kretprobes_release);
 }
 EXPORT_SYMBOL_GPL(lttng_kretprobes_destroy_private);
 
-int lttng_kretprobes_event_enable_state(struct lttng_event *event,
+int lttng_kretprobes_event_enable_state(struct lttng_kernel_event_recorder *event_recorder,
                int enable)
 {
-       struct lttng_event *event_exit;
+       struct lttng_kernel_event_recorder *event_recorder_exit;
        struct lttng_krp *lttng_krp;
 
-       if (event->instrumentation != LTTNG_KERNEL_ABI_KRETPROBE) {
+       if (event_recorder->priv->parent.instrumentation != LTTNG_KERNEL_ABI_KRETPROBE) {
                return -EINVAL;
        }
-       if (event->enabled == enable) {
+       if (event_recorder->parent.enabled == enable) {
                return -EBUSY;
        }
-       lttng_krp = event->u.kretprobe.lttng_krp;
-       event_exit = lttng_krp->event[EVENT_EXIT];
-       WRITE_ONCE(event->enabled, enable);
-       WRITE_ONCE(event_exit->enabled, enable);
+       lttng_krp = event_recorder->priv->parent.u.kretprobe.lttng_krp;
+       event_recorder_exit = lttng_krp->event[EVENT_EXIT];
+       WRITE_ONCE(event_recorder->parent.enabled, enable);
+       WRITE_ONCE(event_recorder_exit->parent.enabled, enable);
        return 0;
 }
 EXPORT_SYMBOL_GPL(lttng_kretprobes_event_enable_state);
index 74616203285a95b4963e5bfe0754de5cb56c81ac..58a5b35ee909186907255c66253c359ccd47e362 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/slab.h>
 #include <linux/uaccess.h>
 #include <lttng/events.h>
+#include <lttng/events-internal.h>
 #include <lttng/tracer.h>
 #include <wrapper/irqflags.h>
 #include <ringbuffer/frontend_types.h>
@@ -27,12 +28,12 @@ int lttng_uprobes_event_handler_pre(struct uprobe_consumer *uc, struct pt_regs *
 {
        struct lttng_uprobe_handler *uprobe_handler =
                container_of(uc, struct lttng_uprobe_handler, up_consumer);
-       struct lttng_event *event = uprobe_handler->u.event;
+       struct lttng_kernel_event_recorder *event_recorder = uprobe_handler->u.event;
        struct lttng_probe_ctx lttng_probe_ctx = {
-               .event = event,
+               .event = event_recorder,
                .interruptible = !lttng_regs_irqs_disabled(regs),
        };
-       struct lttng_channel *chan = event->chan;
+       struct lttng_channel *chan = event_recorder->chan;
        struct lib_ring_buffer_ctx ctx;
        int ret;
 
@@ -44,13 +45,13 @@ int lttng_uprobes_event_handler_pre(struct uprobe_consumer *uc, struct pt_regs *
                return 0;
        if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
                return 0;
-       if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
+       if (unlikely(!LTTNG_READ_ONCE(event_recorder->parent.enabled)))
                return 0;
 
        lib_ring_buffer_ctx_init(&ctx, chan->chan, &lttng_probe_ctx,
                sizeof(payload), lttng_alignof(payload), -1);
 
-       ret = chan->ops->event_reserve(&ctx, event->id);
+       ret = chan->ops->event_reserve(&ctx, event_recorder->priv->id);
        if (ret < 0)
                return 0;
 
@@ -68,14 +69,14 @@ int lttng_uprobes_event_notifier_handler_pre(struct uprobe_consumer *uc, struct
 {
        struct lttng_uprobe_handler *uprobe_handler =
                container_of(uc, struct lttng_uprobe_handler, up_consumer);
-       struct lttng_event_notifier *event_notifier = uprobe_handler->u.event_notifier;
-       struct lttng_kernel_notifier_ctx notif_ctx;
+       struct lttng_kernel_event_notifier *event_notifier = uprobe_handler->u.event_notifier;
+       struct lttng_kernel_notification_ctx notif_ctx;
 
-       if (unlikely(!READ_ONCE(event_notifier->enabled)))
+       if (unlikely(!READ_ONCE(event_notifier->parent.enabled)))
                return 0;
 
        notif_ctx.eval_capture = LTTNG_READ_ONCE(event_notifier->eval_capture);
-       event_notifier->send_notification(event_notifier, NULL, NULL, &notif_ctx);
+       event_notifier->notification_send(event_notifier, NULL, NULL, &notif_ctx);
        return 0;
 }
 
@@ -86,7 +87,7 @@ static const struct lttng_kernel_type_common *event_type =
  * Create event description.
  */
 static
-int lttng_create_uprobe_event(const char *name, struct lttng_event *event)
+int lttng_create_uprobe_event(const char *name, struct lttng_kernel_event_recorder *event_recorder)
 {
        const struct lttng_kernel_event_field **fieldp_array;
        struct lttng_kernel_event_field *field;
@@ -117,7 +118,7 @@ int lttng_create_uprobe_event(const char *name, struct lttng_event *event)
        field->name = "ip";
        field->type = event_type;
        desc->owner = THIS_MODULE;
-       event->desc = desc;
+       event_recorder->priv->parent.desc = desc;
 
        return 0;
 
@@ -134,7 +135,7 @@ error_str:
  * Create event_notifier description.
  */
 static
-int lttng_create_uprobe_event_notifier(const char *name, struct lttng_event_notifier *event_notifier)
+int lttng_create_uprobe_event_notifier(const char *name, struct lttng_kernel_event_notifier *event_notifier)
 {
        struct lttng_kernel_event_desc *desc;
        int ret;
@@ -151,7 +152,7 @@ int lttng_create_uprobe_event_notifier(const char *name, struct lttng_event_noti
        desc->nr_fields = 0;
 
        desc->owner = THIS_MODULE;
-       event_notifier->desc = desc;
+       event_notifier->priv->parent.desc = desc;
 
        return 0;
 
@@ -244,18 +245,18 @@ end:
        return ret;
 }
 
-int lttng_uprobes_event_add_callsite(struct lttng_event *event,
+int lttng_uprobes_event_add_callsite(struct lttng_kernel_event_recorder *event_recorder,
        struct lttng_kernel_abi_event_callsite __user *callsite)
 {
-       return lttng_uprobes_add_callsite(&event->u.uprobe, callsite,
-               lttng_uprobes_event_handler_pre, event);
+       return lttng_uprobes_add_callsite(&event_recorder->priv->parent.u.uprobe, callsite,
+               lttng_uprobes_event_handler_pre, event_recorder);
 }
 EXPORT_SYMBOL_GPL(lttng_uprobes_event_add_callsite);
 
-int lttng_uprobes_event_notifier_add_callsite(struct lttng_event_notifier *event_notifier,
+int lttng_uprobes_event_notifier_add_callsite(struct lttng_kernel_event_notifier *event_notifier,
        struct lttng_kernel_abi_event_callsite __user *callsite)
 {
-       return lttng_uprobes_add_callsite(&event_notifier->u.uprobe, callsite,
+       return lttng_uprobes_add_callsite(&event_notifier->priv->parent.u.uprobe, callsite,
                lttng_uprobes_event_notifier_handler_pre, event_notifier);
 }
 EXPORT_SYMBOL_GPL(lttng_uprobes_event_notifier_add_callsite);
@@ -279,30 +280,30 @@ inode_error:
        return ret;
 }
 
-int lttng_uprobes_register_event(const char *name, int fd, struct lttng_event *event)
+int lttng_uprobes_register_event(const char *name, int fd, struct lttng_kernel_event_recorder *event_recorder)
 {
        int ret = 0;
 
-       ret = lttng_create_uprobe_event(name, event);
+       ret = lttng_create_uprobe_event(name, event_recorder);
        if (ret)
                goto error;
 
-       ret = lttng_uprobes_register(&event->u.uprobe, fd);
+       ret = lttng_uprobes_register(&event_recorder->priv->parent.u.uprobe, fd);
        if (ret)
                goto register_error;
 
        return 0;
 
 register_error:
-       kfree(event->desc->event_name);
-       kfree(event->desc);
+       kfree(event_recorder->priv->parent.desc->event_name);
+       kfree(event_recorder->priv->parent.desc);
 error:
        return ret;
 }
 EXPORT_SYMBOL_GPL(lttng_uprobes_register_event);
 
 int lttng_uprobes_register_event_notifier(const char *name, int fd,
-               struct lttng_event_notifier *event_notifier)
+               struct lttng_kernel_event_notifier *event_notifier)
 {
        int ret = 0;
 
@@ -310,15 +311,15 @@ int lttng_uprobes_register_event_notifier(const char *name, int fd,
        if (ret)
                goto error;
 
-       ret = lttng_uprobes_register(&event_notifier->u.uprobe, fd);
+       ret = lttng_uprobes_register(&event_notifier->priv->parent.u.uprobe, fd);
        if (ret)
                goto register_error;
 
        return 0;
 
 register_error:
-       kfree(event_notifier->desc->event_name);
-       kfree(event_notifier->desc);
+       kfree(event_notifier->priv->parent.desc->event_name);
+       kfree(event_notifier->priv->parent.desc);
 error:
        return ret;
 }
@@ -341,33 +342,33 @@ void lttng_uprobes_unregister(struct inode *inode, struct list_head *head)
 
 }
 
-void lttng_uprobes_unregister_event(struct lttng_event *event)
+void lttng_uprobes_unregister_event(struct lttng_kernel_event_recorder *event_recorder)
 {
-       lttng_uprobes_unregister(event->u.uprobe.inode, &event->u.uprobe.head);
+       lttng_uprobes_unregister(event_recorder->priv->parent.u.uprobe.inode, &event_recorder->priv->parent.u.uprobe.head);
 }
 EXPORT_SYMBOL_GPL(lttng_uprobes_unregister_event);
 
-void lttng_uprobes_unregister_event_notifier(struct lttng_event_notifier *event_notifier)
+void lttng_uprobes_unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier)
 {
-       lttng_uprobes_unregister(event_notifier->u.uprobe.inode, &event_notifier->u.uprobe.head);
+       lttng_uprobes_unregister(event_notifier->priv->parent.u.uprobe.inode, &event_notifier->priv->parent.u.uprobe.head);
 }
 EXPORT_SYMBOL_GPL(lttng_uprobes_unregister_event_notifier);
 
-void lttng_uprobes_destroy_event_private(struct lttng_event *event)
+void lttng_uprobes_destroy_event_private(struct lttng_kernel_event_recorder *event_recorder)
 {
-       iput(event->u.uprobe.inode);
-       kfree(event->desc->fields[0]);
-       kfree(event->desc->fields);
-       kfree(event->desc->event_name);
-       kfree(event->desc);
+       iput(event_recorder->priv->parent.u.uprobe.inode);
+       kfree(event_recorder->priv->parent.desc->fields[0]);
+       kfree(event_recorder->priv->parent.desc->fields);
+       kfree(event_recorder->priv->parent.desc->event_name);
+       kfree(event_recorder->priv->parent.desc);
 }
 EXPORT_SYMBOL_GPL(lttng_uprobes_destroy_event_private);
 
-void lttng_uprobes_destroy_event_notifier_private(struct lttng_event_notifier *event_notifier)
+void lttng_uprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier)
 {
-       iput(event_notifier->u.uprobe.inode);
-       kfree(event_notifier->desc->event_name);
-       kfree(event_notifier->desc);
+       iput(event_notifier->priv->parent.u.uprobe.inode);
+       kfree(event_notifier->priv->parent.desc->event_name);
+       kfree(event_notifier->priv->parent.desc);
 }
 EXPORT_SYMBOL_GPL(lttng_uprobes_destroy_event_notifier_private);
 
This page took 0.102501 seconds and 4 git commands to generate.