From 5b675300cd432c3dff378ac5b78eb6b56d4294e6 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Wed, 5 May 2021 15:04:38 -0400 Subject: [PATCH] Refactoring: tracepoint: allow explicit tracepoint instance provider name Add a template_provider argument to LTTNG_UST_TRACEPOINT_EVENT_INSTANCE to allow a tracepoint instance to refer to a tracepoint class from another provider within the same compile unit. Also introduce struct lttng_ust_tracepoint_class to clearly split the event instance from the class, thus allowing the event instance to refer to the class through a single symbol. This removes the need to rely on LTTNG_UST__TP_ARRAY_SIZE() to calculate the size of the event field array (part of the class) from within the event instance. This refactoring opens the door to have event class and instance not only in different providers, but also in providers emitted within different compile units and shared objects in the future. For instance, if a .c includes the following headers: #define LTTNG_UST_TRACEPOINT_CREATE_PROBES #include "a.h" #include "b.h" where a.h contains: LTTNG_UST_TRACEPOINT_EVENT_CLASS(a, myclass, LTTNG_UST_TP_ARGS(int, anint), LTTNG_UST_TP_FIELDS( lttng_ust_field_integer(int, intfield, anint) ) ) and b.h contains: LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(a, myclass, b, myeventinstance, LTTNG_UST_TP_ARGS(int, anint) ) This is a localized API-breaking change introduced very early in the 2.13-rc cycle. This changes the ABI exposed by the probe providers, so bump the probe provider major version, and make newer lttng-ust reject old incompatible major. We can do this because it is very early in the 2.13-rc cycle. Signed-off-by: Mathieu Desnoyers Change-Id: Icf25dc950e483719a26785cd17be9f3d113f7237 --- include/lttng/tp/lttng-ust-tracelog.h | 3 +- include/lttng/tracepoint-event.h | 7 +- include/lttng/tracepoint.h | 7 +- include/lttng/ust-events.h | 34 +++++- include/lttng/ust-tracepoint-event-reset.h | 2 +- include/lttng/ust-tracepoint-event.h | 112 +++++++++--------- .../lttng-ust-cyg-profile.h | 4 +- src/lib/lttng-ust/lttng-bytecode-specialize.c | 4 +- src/lib/lttng-ust/lttng-bytecode.c | 4 +- src/lib/lttng-ust/lttng-events.c | 18 +-- src/lib/lttng-ust/lttng-probes.c | 9 +- 11 files changed, 119 insertions(+), 85 deletions(-) diff --git a/include/lttng/tp/lttng-ust-tracelog.h b/include/lttng/tp/lttng-ust-tracelog.h index 5e8d9f0d..673c9abc 100644 --- a/include/lttng/tp/lttng-ust-tracelog.h +++ b/include/lttng/tp/lttng-ust-tracelog.h @@ -20,7 +20,8 @@ LTTNG_UST_TRACEPOINT_EVENT_CLASS(lttng_ust_tracelog, tlclass, ) #define LTTNG_UST_TP_TRACELOG_TEMPLATE(_level_enum) \ - LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(lttng_ust_tracelog, tlclass, _level_enum, \ + LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(lttng_ust_tracelog, tlclass, \ + lttng_ust_tracelog, _level_enum, \ LTTNG_UST_TP_ARGS(const char *, file, int, line, const char *, func, \ const char *, msg, unsigned int, len, void *, ip) \ ) \ diff --git a/include/lttng/tracepoint-event.h b/include/lttng/tracepoint-event.h index 24b387d3..4c072ca2 100644 --- a/include/lttng/tracepoint-event.h +++ b/include/lttng/tracepoint-event.h @@ -19,13 +19,14 @@ #define lttng_ust__tp_stringify(x) lttng_ust__tp_stringify1(x) #undef LTTNG_UST_TRACEPOINT_EVENT_INSTANCE -#define LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) +#define LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(_template_provider, _template_name, \ + _provider, _name, _args) #undef LTTNG_UST_TRACEPOINT_EVENT #define LTTNG_UST_TRACEPOINT_EVENT(_provider, _name, _args, _fields) \ LTTNG_UST_TRACEPOINT_EVENT_CLASS(_provider, _name, LTTNG_UST__TP_PARAMS(_args), \ LTTNG_UST__TP_PARAMS(_fields)) \ - LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(_provider, _name, _name, \ + LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(_provider, _name, _provider, _name, \ LTTNG_UST__TP_PARAMS(_args)) @@ -95,7 +96,7 @@ #define LTTNG_UST_TRACEPOINT_EVENT_CLASS(provider, name, args, fields) #undef LTTNG_UST_TRACEPOINT_EVENT_INSTANCE -#define LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(provider, _template, name, args) \ +#define LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(template_provider, template_name, provider, name, args) \ LTTNG_UST__DECLARE_TRACEPOINT(provider, name, LTTNG_UST__TP_PARAMS(args)) \ LTTNG_UST__DEFINE_TRACEPOINT(provider, name, LTTNG_UST__TP_PARAMS(args)) diff --git a/include/lttng/tracepoint.h b/include/lttng/tracepoint.h index c59a96c9..1f8b9209 100644 --- a/include/lttng/tracepoint.h +++ b/include/lttng/tracepoint.h @@ -783,14 +783,17 @@ lttng_ust__tracepoints__ptrs_destroy(void) #define LTTNG_UST_TRACEPOINT_EVENT_CLASS(provider, name, args, fields) -#define LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(provider, _template, name, args) \ +#define LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(template_provider, template_name, provider, name, args) \ LTTNG_UST__DECLARE_TRACEPOINT(provider, name, LTTNG_UST__TP_PARAMS(args)) \ LTTNG_UST__DEFINE_TRACEPOINT(provider, name, LTTNG_UST__TP_PARAMS(args)) #if LTTNG_UST_COMPAT_API(0) #define TRACEPOINT_EVENT LTTNG_UST_TRACEPOINT_EVENT #define TRACEPOINT_EVENT_CLASS LTTNG_UST_TRACEPOINT_EVENT_CLASS -#define TRACEPOINT_EVENT_INSTANCE LTTNG_UST_TRACEPOINT_EVENT_INSTANCE +#define TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, args) \ + LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(_provider, _template, \ + _provider, _name, LTTNG_UST__TP_PARAMS(args)) + #endif /* #if LTTNG_UST_COMPAT_API(0) */ #endif /* #ifndef LTTNG_UST_TRACEPOINT_EVENT */ diff --git a/include/lttng/ust-events.h b/include/lttng/ust-events.h index 69203068..b09a6718 100644 --- a/include/lttng/ust-events.h +++ b/include/lttng/ust-events.h @@ -31,8 +31,13 @@ extern "C" { * Older tracepoint providers can always register to newer lttng-ust * library, but the opposite is rejected: a newer tracepoint provider is * rejected by an older lttng-ust library. + * + * LTTNG_UST_PROVIDER_MAJOR_OLDEST_COMPATIBLE is the floor value of + * oldest provider major version currently allowed, typically increased + * when LTTng-UST has an ABI-breaking soname bump. */ -#define LTTNG_UST_PROVIDER_MAJOR 2 +#define LTTNG_UST_PROVIDER_MAJOR 3 +#define LTTNG_UST_PROVIDER_MAJOR_OLDEST_COMPATIBLE 3 #define LTTNG_UST_PROVIDER_MINOR 0 struct lttng_ust_channel_buffer; @@ -252,6 +257,28 @@ struct lttng_ust_event_field { /* End of base ABI. Fields below should be used after checking struct_size. */ }; +/* + * Tracepoint class description + * + * IMPORTANT: this structure is part of the ABI between the probe and + * UST. Fields need to be only added at the end, never reordered, never + * removed. + * + * The field @struct_size should be used to determine the size of the + * structure. It should be queried before using additional fields added + * at the end of the structure. + */ + +struct lttng_ust_tracepoint_class { + uint32_t struct_size; + + const struct lttng_ust_event_field * const *fields; + size_t nr_fields; + void (*probe_callback)(void); + const char *signature; /* Argument types/names received */ + + /* End of base ABI. Fields below should be used after checking struct_size. */ +}; /* * IMPORTANT: this structure is part of the ABI between the probe and @@ -267,11 +294,8 @@ struct lttng_ust_event_desc { const char *event_name; const struct lttng_ust_probe_desc *probe_desc; - void (*probe_callback)(void); - const struct lttng_ust_event_field * const *fields; /* event payload */ - unsigned int nr_fields; + const struct lttng_ust_tracepoint_class *tp_class; const int **loglevel; - const char *signature; /* Argument types/names received */ const char **model_emf_uri; /* End of base ABI. Fields below should be used after checking struct_size. */ diff --git a/include/lttng/ust-tracepoint-event-reset.h b/include/lttng/ust-tracepoint-event-reset.h index 2bc255fa..10c288fe 100644 --- a/include/lttng/ust-tracepoint-event-reset.h +++ b/include/lttng/ust-tracepoint-event-reset.h @@ -10,7 +10,7 @@ #define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) #undef LTTNG_UST__TRACEPOINT_EVENT_INSTANCE -#define LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) +#define LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_template_provider, _template_name, _provider, _name, _args) #undef LTTNG_UST_TRACEPOINT_ENUM #define LTTNG_UST_TRACEPOINT_ENUM(_provider, _name, _values) diff --git a/include/lttng/ust-tracepoint-event.h b/include/lttng/ust-tracepoint-event.h index 586f59f9..c6dfed7d 100644 --- a/include/lttng/ust-tracepoint-event.h +++ b/include/lttng/ust-tracepoint-event.h @@ -84,7 +84,7 @@ LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, \ LTTNG_UST__TP_PARAMS(_args), \ LTTNG_UST__TP_PARAMS(_fields)) \ - LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_provider, _name, _name, \ + LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_provider, _name, _provider, _name, \ LTTNG_UST__TP_PARAMS(_args)) #undef LTTNG_UST_TRACEPOINT_EVENT_CLASS @@ -92,8 +92,8 @@ LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, LTTNG_UST__TP_PARAMS(_args), LTTNG_UST__TP_PARAMS(_fields)) #undef LTTNG_UST_TRACEPOINT_EVENT_INSTANCE -#define LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) \ - LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, LTTNG_UST__TP_PARAMS(_args)) +#define LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(_template_provider, _template_name, _provider, _name, _args) \ + LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_template_provider, _template_name, _provider, _name, LTTNG_UST__TP_PARAMS(_args)) /* Helpers */ #define LTTNG_UST__TP_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) @@ -128,7 +128,7 @@ void LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust_tracepoint_provider_mismatch_, LTTNG lttng_ust_tracepoint_provider_mismatch_##_provider(); #undef LTTNG_UST__TRACEPOINT_EVENT_INSTANCE -#define LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) \ +#define LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_template_provider, _template_name, _provider, _name, _args) \ lttng_ust_tracepoint_provider_mismatch_##_provider(); static inline @@ -151,7 +151,7 @@ void LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust_tracepoint_provider_check_, LTTNG_US #include #undef LTTNG_UST__TRACEPOINT_EVENT_INSTANCE -#define LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) \ +#define LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_template_provider, _template_name, _provider, _name, _args) \ lttng_ust_tracepoint_validate_name_len(_provider, _name); #include LTTNG_UST_TRACEPOINT_INCLUDE @@ -171,8 +171,8 @@ void LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust_tracepoint_provider_check_, LTTNG_US #define LTTNG_UST_TP_ARGS(...) __VA_ARGS__ #undef LTTNG_UST__TRACEPOINT_EVENT_INSTANCE -#define LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) \ -void lttng_ust__event_template_proto___##_provider##___##_template(LTTNG_UST__TP_ARGS_DATA_PROTO(_args)); +#define LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_template_provider, _template_name, _provider, _name, _args) \ +void lttng_ust__event_template_proto___##_template_provider##___##_template_name(LTTNG_UST__TP_ARGS_DATA_PROTO(_args)); #undef LTTNG_UST__TRACEPOINT_EVENT_CLASS #define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ @@ -288,9 +288,50 @@ void lttng_ust__event_template_proto___##_provider##___##_name(LTTNG_UST__TP_ARG #include LTTNG_UST_TRACEPOINT_INCLUDE +/* + * Stage 0.9.2 of tracepoint event generation. + * + * Create probe signature + */ + +/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */ +#include + +#undef LTTNG_UST_TP_ARGS +#define LTTNG_UST_TP_ARGS(...) __VA_ARGS__ + +#define LTTNG_UST__TP_EXTRACT_STRING2(...) #__VA_ARGS__ + +#undef LTTNG_UST__TRACEPOINT_EVENT_CLASS +#define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ +static const char __tp_event_signature___##_provider##___##_name[] = \ + LTTNG_UST__TP_EXTRACT_STRING2(_args); + +#include LTTNG_UST_TRACEPOINT_INCLUDE + +#undef LTTNG_UST__TP_EXTRACT_STRING2 + /* * Stage 1 of tracepoint event generation. * + * Create probe callback prototypes. + */ + +/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */ +#include + +#undef LTTNG_UST_TP_ARGS +#define LTTNG_UST_TP_ARGS(...) __VA_ARGS__ + +#undef LTTNG_UST__TRACEPOINT_EVENT_CLASS +#define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ +static void lttng_ust__event_probe__##_provider##___##_name(LTTNG_UST__TP_ARGS_DATA_PROTO(_args)); + +#include LTTNG_UST_TRACEPOINT_INCLUDE + +/* + * Stage 2 of tracepoint event generation. + * * Create event field type metadata section. * Each event produce an array of fields. */ @@ -413,6 +454,13 @@ void lttng_ust__event_template_proto___##_provider##___##_name(LTTNG_UST__TP_ARG static const struct lttng_ust_event_field * const lttng_ust__event_fields___##_provider##___##_name[] = { \ _fields \ lttng_ust_field_integer(int, dummy, 0) /* Dummy, C99 forbids 0-len array. */ \ + }; \ + static const struct lttng_ust_tracepoint_class lttng_ust__event_class___##_provider##___##_name = { \ + .struct_size = sizeof(struct lttng_ust_tracepoint_class), \ + .fields = lttng_ust__event_fields___##_provider##___##_name, \ + .nr_fields = LTTNG_UST__TP_ARRAY_SIZE(lttng_ust__event_fields___##_provider##___##_name) - 1, \ + .probe_callback = (void (*)(void)) <tng_ust__event_probe__##_provider##___##_name, \ + .signature = __tp_event_signature___##_provider##___##_name, \ }; #undef LTTNG_UST_TRACEPOINT_ENUM @@ -426,24 +474,6 @@ void lttng_ust__event_template_proto___##_provider##___##_name(LTTNG_UST__TP_ARG #include LTTNG_UST_TRACEPOINT_INCLUDE -/* - * Stage 2 of tracepoint event generation. - * - * Create probe callback prototypes. - */ - -/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */ -#include - -#undef LTTNG_UST_TP_ARGS -#define LTTNG_UST_TP_ARGS(...) __VA_ARGS__ - -#undef LTTNG_UST__TRACEPOINT_EVENT_CLASS -#define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ -static void lttng_ust__event_probe__##_provider##___##_name(LTTNG_UST__TP_ARGS_DATA_PROTO(_args)); - -#include LTTNG_UST_TRACEPOINT_INCLUDE - /* * Stage 3.0 of tracepoint event generation. * @@ -977,29 +1007,6 @@ void lttng_ust__event_probe__##_provider##___##_name(LTTNG_UST__TP_ARGS_DATA_PRO #undef lttng_ust__get_dynamic_len -/* - * Stage 5.1 of tracepoint event generation. - * - * Create probe signature - */ - -/* Reset all macros within LTTNG_UST_TRACEPOINT_EVENT */ -#include - -#undef LTTNG_UST_TP_ARGS -#define LTTNG_UST_TP_ARGS(...) __VA_ARGS__ - -#define LTTNG_UST__TP_EXTRACT_STRING2(...) #__VA_ARGS__ - -#undef LTTNG_UST__TRACEPOINT_EVENT_CLASS -#define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \ -static const char __tp_event_signature___##_provider##___##_name[] = \ - LTTNG_UST__TP_EXTRACT_STRING2(_args); - -#include LTTNG_UST_TRACEPOINT_INCLUDE - -#undef LTTNG_UST__TP_EXTRACT_STRING2 - /* * Stage 6 of tracepoint event generation. * @@ -1096,7 +1103,7 @@ extern const struct lttng_ust_probe_desc LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust_ #include #undef LTTNG_UST__TRACEPOINT_EVENT_INSTANCE -#define LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) \ +#define LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_template_provider, _template_name, _provider, _name, _args) \ static const int * \ __ref_loglevel___##_provider##___##_name \ __attribute__((weakref ("_loglevel___" #_provider "___" #_name))); \ @@ -1107,11 +1114,8 @@ static const struct lttng_ust_event_desc lttng_ust__event_desc___##_provider##_# .struct_size = sizeof(struct lttng_ust_event_desc), \ .event_name = #_name, \ .probe_desc = <tng_ust__probe_desc___##_provider, \ - .probe_callback = (void (*)(void)) <tng_ust__event_probe__##_provider##___##_template, \ - .fields = lttng_ust__event_fields___##_provider##___##_template, \ - .nr_fields = LTTNG_UST__TP_ARRAY_SIZE(lttng_ust__event_fields___##_provider##___##_template) - 1, \ + .tp_class = <tng_ust__event_class___##_template_provider##___##_template_name, \ .loglevel = &__ref_loglevel___##_provider##___##_name, \ - .signature = __tp_event_signature___##_provider##___##_template, \ .model_emf_uri = &__ref_model_emf_uri___##_provider##___##_name, \ }; @@ -1127,7 +1131,7 @@ static const struct lttng_ust_event_desc lttng_ust__event_desc___##_provider##_# #include #undef LTTNG_UST__TRACEPOINT_EVENT_INSTANCE -#define LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) \ +#define LTTNG_UST__TRACEPOINT_EVENT_INSTANCE(_template_provider, _template_name, _provider, _name, _args) \ <tng_ust__event_desc___##_provider##_##_name, static const struct lttng_ust_event_desc * const LTTNG_UST__TP_COMBINE_TOKENS(lttng_ust__event_desc___, LTTNG_UST_TRACEPOINT_PROVIDER)[] = { diff --git a/src/lib/lttng-ust-cyg-profile/lttng-ust-cyg-profile.h b/src/lib/lttng-ust-cyg-profile/lttng-ust-cyg-profile.h index 8661163b..c98d555d 100644 --- a/src/lib/lttng-ust-cyg-profile/lttng-ust-cyg-profile.h +++ b/src/lib/lttng-ust-cyg-profile/lttng-ust-cyg-profile.h @@ -27,7 +27,7 @@ LTTNG_UST_TRACEPOINT_EVENT_CLASS(lttng_ust_cyg_profile, func_class, ) LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(lttng_ust_cyg_profile, func_class, - func_entry, + lttng_ust_cyg_profile, func_entry, LTTNG_UST_TP_ARGS(void *, func_addr, void *, call_site) ) @@ -35,7 +35,7 @@ LTTNG_UST_TRACEPOINT_LOGLEVEL(lttng_ust_cyg_profile, func_entry, LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_FUNCTION) LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(lttng_ust_cyg_profile, func_class, - func_exit, + lttng_ust_cyg_profile, func_exit, LTTNG_UST_TP_ARGS(void *, func_addr, void *, call_site) ) diff --git a/src/lib/lttng-ust/lttng-bytecode-specialize.c b/src/lib/lttng-ust/lttng-bytecode-specialize.c index e57892f2..be1d9d71 100644 --- a/src/lib/lttng-ust/lttng-bytecode-specialize.c +++ b/src/lib/lttng-ust/lttng-bytecode-specialize.c @@ -564,11 +564,11 @@ static int specialize_payload_lookup(const struct lttng_ust_event_desc *event_de struct bytecode_get_index_data gid; ssize_t data_offset; - nr_fields = event_desc->nr_fields; + nr_fields = event_desc->tp_class->nr_fields; offset = ((struct get_symbol *) insn->data)->offset; name = runtime->p.bc->bc.data + runtime->p.bc->bc.reloc_offset + offset; for (i = 0; i < nr_fields; i++) { - field = event_desc->fields[i]; + field = event_desc->tp_class->fields[i]; if (field->nofilter) { continue; } diff --git a/src/lib/lttng-ust/lttng-bytecode.c b/src/lib/lttng-ust/lttng-bytecode.c index 33d50db6..099fc5ca 100644 --- a/src/lib/lttng-ust/lttng-bytecode.c +++ b/src/lib/lttng-ust/lttng-bytecode.c @@ -190,10 +190,10 @@ int apply_field_reloc(const struct lttng_ust_event_desc *event_desc, /* Lookup event by name */ if (!event_desc) return -EINVAL; - fields = event_desc->fields; + fields = event_desc->tp_class->fields; if (!fields) return -EINVAL; - nr_fields = event_desc->nr_fields; + nr_fields = event_desc->tp_class->nr_fields; for (i = 0; i < nr_fields; i++) { if (fields[i]->nofilter) { continue; diff --git a/src/lib/lttng-ust/lttng-events.c b/src/lib/lttng-ust/lttng-events.c index 8596b7a0..26071594 100644 --- a/src/lib/lttng-ust/lttng-events.c +++ b/src/lib/lttng-ust/lttng-events.c @@ -270,8 +270,8 @@ void register_event(struct lttng_ust_event_common *event) desc = event->priv->desc; ret = lttng_ust_tp_probe_register_queue_release(desc->probe_desc->provider_name, desc->event_name, - desc->probe_callback, - event, desc->signature); + desc->tp_class->probe_callback, + event, desc->tp_class->signature); WARN_ON_ONCE(ret); if (!ret) event->priv->registered = 1; @@ -287,7 +287,7 @@ void unregister_event(struct lttng_ust_event_common *event) desc = event->priv->desc; ret = lttng_ust_tp_probe_unregister_queue_release(desc->probe_desc->provider_name, desc->event_name, - desc->probe_callback, + desc->tp_class->probe_callback, event); WARN_ON_ONCE(ret); if (!ret) @@ -729,7 +729,7 @@ int lttng_event_recorder_create(const struct lttng_ust_event_desc *desc, goto socket_error; } - ret = lttng_create_all_event_enums(desc->nr_fields, desc->fields, + ret = lttng_create_all_event_enums(desc->tp_class->nr_fields, desc->tp_class->fields, session); if (ret < 0) { DBG("Error (%d) adding enum to session", ret); @@ -793,9 +793,9 @@ int lttng_event_recorder_create(const struct lttng_ust_event_desc *desc, chan->priv->parent.objd, name, loglevel, - desc->signature, - desc->nr_fields, - desc->fields, + desc->tp_class->signature, + desc->tp_class->nr_fields, + desc->tp_class->fields, uri, &event_recorder->priv->id); if (ret < 0) { @@ -1173,12 +1173,12 @@ void _event_enum_destroy(struct lttng_ust_event_common *event) unsigned int i; /* Destroy enums of the current event. */ - for (i = 0; i < event_recorder->parent->priv->desc->nr_fields; i++) { + for (i = 0; i < event_recorder->parent->priv->desc->tp_class->nr_fields; i++) { const struct lttng_ust_enum_desc *enum_desc; const struct lttng_ust_event_field *field; struct lttng_enum *curr_enum; - field = event_recorder->parent->priv->desc->fields[i]; + field = event_recorder->parent->priv->desc->tp_class->fields[i]; switch (field->type->type) { case lttng_ust_type_enum: enum_desc = lttng_ust_get_type_enum(field->type)->desc; diff --git a/src/lib/lttng-ust/lttng-probes.c b/src/lib/lttng-ust/lttng-probes.c index 1e730649..911c2917 100644 --- a/src/lib/lttng-ust/lttng-probes.c +++ b/src/lib/lttng-ust/lttng-probes.c @@ -137,7 +137,8 @@ int check_provider_version(const struct lttng_ust_probe_desc *desc) /* * Check tracepoint provider version compatibility. */ - if (desc->major <= LTTNG_UST_PROVIDER_MAJOR) { + if (desc->major <= LTTNG_UST_PROVIDER_MAJOR && + desc->major >= LTTNG_UST_PROVIDER_MAJOR_OLDEST_COMPATIBLE) { DBG("Provider \"%s\" accepted, version %u.%u is compatible " "with LTTng UST provider version %u.%u.", desc->provider_name, desc->major, desc->minor, @@ -326,7 +327,7 @@ int lttng_probes_get_field_list(struct lttng_ust_field_list *list) probe_desc->event_desc[i]; int j; - if (event_desc->nr_fields == 0) { + if (event_desc->tp_class->nr_fields == 0) { /* Events without fields. */ struct tp_field_list_entry *list_entry; @@ -348,9 +349,9 @@ int lttng_probes_get_field_list(struct lttng_ust_field_list *list) list_entry->field.nowrite = 1; } - for (j = 0; j < event_desc->nr_fields; j++) { + for (j = 0; j < event_desc->tp_class->nr_fields; j++) { const struct lttng_ust_event_field *event_field = - event_desc->fields[j]; + event_desc->tp_class->fields[j]; struct tp_field_list_entry *list_entry; /* Skip event if name is too long. */ -- 2.34.1