X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=include%2Flttng%2Ftracepoint-event-impl.h;h=5259c596516d4f4fa55841b4408a69d7d70ff18b;hb=12bb2edb6ed3e96d3299a979e49b828f2b17dcb2;hp=d8ad21632a8d8a3012bc7a90f57529cb6af8559b;hpb=3d650c7b255a7aa43cae96904f0c229a129d39be;p=lttng-modules.git diff --git a/include/lttng/tracepoint-event-impl.h b/include/lttng/tracepoint-event-impl.h index d8ad2163..5259c596 100644 --- a/include/lttng/tracepoint-event-impl.h +++ b/include/lttng/tracepoint-event-impl.h @@ -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,7 +416,7 @@ void __event_notifier_template_proto___##_name(void); .name = #_item, \ .type = \ { \ - .atype = atype_string, \ + .type = lttng_kernel_type_string, \ .u = \ { \ .string = { .encoding = lttng_encode_UTF8 }, \ @@ -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,7 +1246,7 @@ 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->interpreter_funcs.filter(bc_runtime, &__lttng_probe_ctx, \ @@ -1342,7 +1342,7 @@ 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->interpreter_funcs.filter(bc_runtime, &__lttng_probe_ctx, \ @@ -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->interpreter_funcs.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->interpreter_funcs.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; \