X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=liblttng-ust%2Flttng-events.c;h=16d75da95b0c265d4785ca61de0513caa29476eb;hb=f52e590232f939bd6b5c88a483765c03e37fc733;hp=6a089122c8d1a2afee87f1a77e353aa4d7467736;hpb=ebabbf580131acd1fe246c4d31fc5c044d36a038;p=deliverable%2Flttng-ust.git diff --git a/liblttng-ust/lttng-events.c b/liblttng-ust/lttng-events.c index 6a089122..16d75da9 100644 --- a/liblttng-ust/lttng-events.c +++ b/liblttng-ust/lttng-events.c @@ -34,9 +34,9 @@ #include #include #include +#include #include -#include #include #include #include @@ -143,11 +143,6 @@ int lttng_loglevel_match(int loglevel, } } -void synchronize_trace(void) -{ - synchronize_rcu(); -} - struct lttng_session *lttng_session_create(void) { struct lttng_session *session; @@ -350,7 +345,7 @@ void lttng_session_destroy(struct lttng_session *session) cds_list_for_each_entry(event, &session->events_head, node) { _lttng_event_unregister(event); } - synchronize_trace(); /* Wait for in-flight events to complete */ + lttng_ust_synchronize_trace(); /* Wait for in-flight events to complete */ __tracepoint_probe_prune_release_queue(); cds_list_for_each_entry_safe(event_enabler, event_tmpenabler, &session->enablers_head, node) @@ -383,7 +378,7 @@ void lttng_event_notifier_group_destroy( &event_notifier_group->event_notifiers_head, node) _lttng_event_notifier_unregister(notifier); - synchronize_trace(); + lttng_ust_synchronize_trace(); cds_list_for_each_entry_safe(notifier_enabler, tmpnotifier_enabler, &event_notifier_group->enablers_head, node) @@ -841,7 +836,7 @@ socket_error: static int lttng_event_notifier_create(const struct lttng_event_desc *desc, - uint64_t token, + uint64_t token, uint64_t error_counter_index, struct lttng_event_notifier_group *event_notifier_group) { struct lttng_event_notifier *event_notifier; @@ -864,6 +859,7 @@ int lttng_event_notifier_create(const struct lttng_event_desc *desc, event_notifier->group = event_notifier_group; event_notifier->user_token = token; + event_notifier->error_counter_index = error_counter_index; /* Event notifier will be enabled by enabler sync. */ event_notifier->enabled = 0; @@ -873,6 +869,7 @@ int lttng_event_notifier_create(const struct lttng_event_desc *desc, CDS_INIT_LIST_HEAD(&event_notifier->capture_bytecode_runtime_head); CDS_INIT_LIST_HEAD(&event_notifier->enablers_ref_head); event_notifier->desc = desc; + event_notifier->notification_send = lttng_event_notifier_notification_send; cds_list_add(&event_notifier->node, &event_notifier_group->event_notifiers_head); @@ -1218,7 +1215,7 @@ void lttng_probe_provider_unregister_events( _lttng_event_notifier_unregister); /* Wait for grace period. */ - synchronize_trace(); + lttng_ust_synchronize_trace(); /* Prune the unregistration queue. */ __tracepoint_probe_prune_release_queue(); @@ -1417,6 +1414,7 @@ struct lttng_event_notifier_enabler *lttng_event_notifier_enabler_create( CDS_INIT_LIST_HEAD(&event_notifier_enabler->base.excluder_head); event_notifier_enabler->user_token = event_notifier_param->event.token; + event_notifier_enabler->error_counter_index = event_notifier_param->error_counter_index; event_notifier_enabler->num_captures = 0; memcpy(&event_notifier_enabler->base.event_param.name, @@ -1710,6 +1708,13 @@ void lttng_session_sync_event_enablers(struct lttng_session *session) __tracepoint_probe_prune_release_queue(); } +/* Support for event notifier is introduced by probe provider major version 2. */ +static +bool lttng_ust_probe_supports_event_notifier(struct lttng_probe_desc *probe_desc) +{ + return probe_desc->major >= 2; +} + static void lttng_create_event_notifier_if_missing( struct lttng_event_notifier_enabler *event_notifier_enabler) @@ -1761,11 +1766,24 @@ void lttng_create_event_notifier_if_missing( if (found) continue; + /* Check that the probe supports event notifiers, else report the error. */ + if (!lttng_ust_probe_supports_event_notifier(probe_desc)) { + ERR("Probe \"%s\" contains event \"%s\" which matches an enabled event notifier, " + "but its version (%u.%u) is too old and does not implement event notifiers. " + "It needs to be recompiled against a newer version of LTTng-UST, otherwise " + "this event will not generate any notification.", + probe_desc->provider, + desc->name, + probe_desc->major, + probe_desc->minor); + continue; + } /* * We need to create a event_notifier for this event probe. */ ret = lttng_event_notifier_create(desc, event_notifier_enabler->user_token, + event_notifier_enabler->error_counter_index, event_notifier_group); if (ret) { DBG("Unable to create event_notifier %s, error %d\n",