X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=include%2Flttng%2Ftracepoint-event-impl.h;h=bc13e56dc77087164b86b0d2d74805c97c7a2019;hb=a28cc5201acb9aa94c2c2308ccd27cb696e4b465;hp=d5bb7ed7acc0e9e9d1549331f72f03a8fbf437b7;hpb=80c2a69a8298768c9010052e6c3668914191b9e7;p=lttng-modules.git diff --git a/include/lttng/tracepoint-event-impl.h b/include/lttng/tracepoint-event-impl.h index d5bb7ed7..bc13e56d 100644 --- a/include/lttng/tracepoint-event-impl.h +++ b/include/lttng/tracepoint-event-impl.h @@ -272,7 +272,7 @@ void __event_notifier_template_proto___##_name(void); #undef LTTNG_TRACEPOINT_ENUM #define LTTNG_TRACEPOINT_ENUM(_name, _values) \ - const struct lttng_enum_entry __enum_values__##_name[] = { \ + const struct lttng_kernel_enum_entry __enum_values__##_name[] = { \ _values \ }; @@ -307,7 +307,7 @@ void __event_notifier_template_proto___##_name(void); .name = #_item, \ .type = \ { \ - .atype = atype_array_nestable, \ + .type = lttng_kernel_type_array_nestable, \ .u = \ { \ .array_nestable = \ @@ -330,7 +330,7 @@ void __event_notifier_template_proto___##_name(void); .name = #_item, \ .type = \ { \ - .atype = atype_array_nestable, \ + .type = lttng_kernel_type_array_nestable, \ .u = \ { \ .array_nestable = \ @@ -362,7 +362,7 @@ void __event_notifier_template_proto___##_name(void); .name = #_item, \ .type = \ { \ - .atype = atype_sequence_nestable, \ + .type = lttng_kernel_type_sequence_nestable, \ .u = \ { \ .sequence_nestable = \ @@ -393,7 +393,7 @@ void __event_notifier_template_proto___##_name(void); .name = #_item, \ .type = \ { \ - .atype = atype_sequence_nestable, \ + .type = lttng_kernel_type_sequence_nestable, \ .u = \ { \ .sequence_nestable = \ @@ -416,10 +416,10 @@ void __event_notifier_template_proto___##_name(void); .name = #_item, \ .type = \ { \ - .atype = atype_string, \ + .type = lttng_kernel_type_string, \ .u = \ { \ - .string = { .encoding = lttng_encode_UTF8 }, \ + .string = { .encoding = lttng_kernel_string_encoding_UTF8 }, \ }, \ }, \ .nowrite = _nowrite, \ @@ -432,7 +432,7 @@ void __event_notifier_template_proto___##_name(void); { \ .name = #_item, \ .type = { \ - .atype = atype_enum_nestable, \ + .type = lttng_kernel_type_enum_nestable, \ .u = { \ .enum_nestable = { \ .desc = &__enum_##_name, \ @@ -822,7 +822,7 @@ error: \ #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code_pre, _fields, _code_post) \ static inline \ -void __event_prepare_filter_stack__##_name(char *__stack_data, \ +void __event_prepare_interpreter_stack__##_name(char *__stack_data, \ void *__tp_locvar) \ { \ struct { _locvar } *tp_locvar __attribute__((unused)) = __tp_locvar; \ @@ -833,7 +833,7 @@ void __event_prepare_filter_stack__##_name(char *__stack_data, \ #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post) \ static inline \ -void __event_prepare_filter_stack__##_name(char *__stack_data, \ +void __event_prepare_interpreter_stack__##_name(char *__stack_data, \ void *__tp_locvar, _proto) \ { \ struct { _locvar } *tp_locvar __attribute__((unused)) = __tp_locvar; \ @@ -1246,10 +1246,10 @@ static void __event_probe__##_name(void *__data, _proto) \ struct lttng_bytecode_runtime *bc_runtime; \ int __filter_record = __event->has_enablers_without_bytecode; \ \ - __event_prepare_filter_stack__##_name(__stackvar.__filter_stack_data, \ + __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) { \ - if (unlikely(bc_runtime->filter(bc_runtime, &__lttng_probe_ctx, \ + if (unlikely(bc_runtime->interpreter_funcs.filter(bc_runtime, &__lttng_probe_ctx, \ __stackvar.__filter_stack_data) & LTTNG_INTERPRETER_RECORD_FLAG)) { \ __filter_record = 1; \ break; \ @@ -1342,10 +1342,10 @@ static void __event_probe__##_name(void *__data) \ struct lttng_bytecode_runtime *bc_runtime; \ int __filter_record = __event->has_enablers_without_bytecode; \ \ - __event_prepare_filter_stack__##_name(__stackvar.__filter_stack_data, \ + __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) { \ - if (unlikely(bc_runtime->filter(bc_runtime, &__lttng_probe_ctx, \ + if (unlikely(bc_runtime->interpreter_funcs.filter(bc_runtime, &__lttng_probe_ctx, \ __stackvar.__filter_stack_data) & LTTNG_INTERPRETER_RECORD_FLAG)) { \ __filter_record = 1; \ break; \ @@ -1425,31 +1425,44 @@ static void __event_notifier_probe__##_name(void *__data, _proto) \ }; \ union { \ size_t __dynamic_len_removed[ARRAY_SIZE(__event_fields___##_name)]; \ - char __filter_stack_data[2 * sizeof(unsigned long) * ARRAY_SIZE(__event_fields___##_name)]; \ + char __interpreter_stack_data[2 * sizeof(unsigned long) * ARRAY_SIZE(__event_fields___##_name)]; \ } __stackvar; \ struct probe_local_vars __tp_locvar; \ struct probe_local_vars *tp_locvar __attribute__((unused)) = \ &__tp_locvar; \ + struct lttng_kernel_notifier_ctx __notif_ctx; \ + bool __interpreter_stack_prepared = false; \ \ if (unlikely(!READ_ONCE(__event_notifier->enabled))) \ return; \ _code_pre \ if (unlikely(!list_empty(&__event_notifier->filter_bytecode_runtime_head))) { \ - struct lttng_bytecode_runtime *bc_runtime; \ + struct lttng_bytecode_runtime *bc_runtime; \ int __filter_record = __event_notifier->has_enablers_without_bytecode; \ - \ - __event_prepare_filter_stack__##_name(__stackvar.__filter_stack_data, \ - tp_locvar, _args); \ + \ + __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) { \ - if (unlikely(bc_runtime->filter(bc_runtime, &__lttng_probe_ctx, \ - __stackvar.__filter_stack_data) & LTTNG_INTERPRETER_RECORD_FLAG)) \ + if (unlikely(bc_runtime->interpreter_funcs.filter(bc_runtime, &__lttng_probe_ctx, \ + __stackvar.__interpreter_stack_data) & LTTNG_INTERPRETER_RECORD_FLAG)) \ __filter_record = 1; \ } \ if (likely(!__filter_record)) \ goto __post; \ } \ \ - __event_notifier->send_notification(__event_notifier); \ + __notif_ctx.eval_capture = LTTNG_READ_ONCE(__event_notifier->eval_capture); \ + if (unlikely(!__interpreter_stack_prepared && __notif_ctx.eval_capture)) \ + __event_prepare_interpreter_stack__##_name( \ + __stackvar.__interpreter_stack_data, \ + tp_locvar, _args); \ + \ + __event_notifier->send_notification(__event_notifier, \ + &__lttng_probe_ctx, \ + __stackvar.__interpreter_stack_data, \ + &__notif_ctx); \ + \ __post: \ _code_post \ return; \ @@ -1468,31 +1481,43 @@ static void __event_notifier_probe__##_name(void *__data) \ }; \ union { \ size_t __dynamic_len_removed[ARRAY_SIZE(__event_fields___##_name)]; \ - char __filter_stack_data[2 * sizeof(unsigned long) * ARRAY_SIZE(__event_fields___##_name)]; \ + char __interpreter_stack_data[2 * sizeof(unsigned long) * ARRAY_SIZE(__event_fields___##_name)]; \ } __stackvar; \ struct probe_local_vars __tp_locvar; \ struct probe_local_vars *tp_locvar __attribute__((unused)) = \ &__tp_locvar; \ + struct lttng_kernel_notifier_ctx __notif_ctx; \ + bool __interpreter_stack_prepared = false; \ \ if (unlikely(!READ_ONCE(__event_notifier->enabled))) \ return; \ _code_pre \ - if (unlikely(!list_empty(&__event_notifier->filter_bytecode_runtime_head))) { \ - struct lttng_bytecode_runtime *bc_runtime; \ - int __filter_record = __event_notifier->has_enablers_without_bytecode; \ - \ - __event_prepare_filter_stack__##_name(__stackvar.__filter_stack_data, \ - tp_locvar); \ + if (unlikely(!list_empty(&__event_notifier->filter_bytecode_runtime_head))) { \ + struct lttng_bytecode_runtime *bc_runtime; \ + int __filter_record = __event_notifier->has_enablers_without_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) { \ - if (unlikely(bc_runtime->filter(bc_runtime, &__lttng_probe_ctx, \ - __stackvar.__filter_stack_data) & LTTNG_INTERPRETER_RECORD_FLAG)) \ + if (unlikely(bc_runtime->interpreter_funcs.filter(bc_runtime, &__lttng_probe_ctx, \ + __stackvar.__interpreter_stack_data) & LTTNG_INTERPRETER_RECORD_FLAG)) \ __filter_record = 1; \ } \ if (likely(!__filter_record)) \ goto __post; \ } \ \ - __event_notifier->send_notification(__event_notifier); \ + __notif_ctx.eval_capture = LTTNG_READ_ONCE(__event_notifier->eval_capture); \ + if (unlikely(!__interpreter_stack_prepared && __notif_ctx.eval_capture)) \ + __event_prepare_interpreter_stack__##_name( \ + __stackvar.__interpreter_stack_data, \ + tp_locvar); \ + \ + __event_notifier->send_notification(__event_notifier, \ + &__lttng_probe_ctx, \ + __stackvar.__interpreter_stack_data, \ + &__notif_ctx); \ __post: \ _code_post \ return; \