Remove duplicate provider name checks
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 9 Feb 2018 20:15:20 +0000 (15:15 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 9 Feb 2018 20:39:05 +0000 (15:39 -0500)
It's now possible to register a probe provider with a name that has
already been registered. This is useful when wanting to load a new
version of a shared library on a already running process.

Changes are necessary in the lttng-session daemon to support cases where
the newly register event has a different probe payload.

Taking a simple case where a probe provider is registered twice, the
tracepoint call site will have two probes registered to it and thus will
generate two events in the trace.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/lttng/ust-tracepoint-event.h
liblttng-ust/lttng-events.c
liblttng-ust/lttng-probes.c

index 15399c7c2ea3f067dbe5968291d7fbc6d18cef2c..ec292d24d4e96dbaaec8d111cbef69da50067634 100644 (file)
@@ -1007,7 +1007,7 @@ _TP_COMBINE_TOKENS(__lttng_events_init__, TRACEPOINT_PROVIDER)(void)
        _TP_COMBINE_TOKENS(__tracepoint_provider_check_, TRACEPOINT_PROVIDER)();
        ret = lttng_probe_register(&_TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PROVIDER));
        if (ret) {
-               fprintf(stderr, "LTTng-UST: Error (%d) while registering tracepoint probe. Duplicate registration of tracepoint probes having the same name is not allowed.\n", ret);
+               fprintf(stderr, "LTTng-UST: Error (%d) while registering tracepoint probe.\n", ret);
                abort();
        }
 }
index bfdae4fff1967d35c1286fd955bff8f4b11bd489..f4a7cccda1db82df02f5e7ae432caf0053a1bb7d 100644 (file)
@@ -537,7 +537,6 @@ int lttng_event_create(const struct lttng_event_desc *desc,
        struct lttng_event *event;
        struct lttng_session *session = chan->session;
        struct cds_hlist_head *head;
-       struct cds_hlist_node *node;
        int ret = 0;
        size_t name_len = strlen(event_name);
        uint32_t hash;
@@ -546,15 +545,6 @@ int lttng_event_create(const struct lttng_event_desc *desc,
 
        hash = jhash(event_name, name_len, 0);
        head = &chan->session->events_ht.table[hash & (LTTNG_UST_EVENT_HT_SIZE - 1)];
-       cds_hlist_for_each_entry(event, node, head, hlist) {
-               assert(event->desc);
-               if (!strncmp(event->desc->name, desc->name,
-                                       LTTNG_UST_SYM_NAME_LEN - 1)
-                               && chan == event->chan) {
-                       ret = -EEXIST;
-                       goto exist;
-               }
-       }
 
        notify_socket = lttng_get_notify_socket(session->owner);
        if (notify_socket < 0) {
@@ -623,7 +613,6 @@ sessiond_register_error:
 cache_error:
 create_enum_error:
 socket_error:
-exist:
        return ret;
 }
 
index 390265add0d22feb4936ac09962aa05a9c342434..a09497f87ba444adc58a1765d0757a04fda7a809 100644 (file)
@@ -147,20 +147,6 @@ struct cds_list_head *lttng_get_probe_list_head(void)
        return &_probe_list;
 }
 
-static
-const struct lttng_probe_desc *find_provider(const char *provider)
-{
-       struct lttng_probe_desc *iter;
-       struct cds_list_head *probe_list;
-
-       probe_list = lttng_get_probe_list_head();
-       cds_list_for_each_entry(iter, probe_list, head) {
-               if (!strcmp(iter->provider, provider))
-                       return iter;
-       }
-       return NULL;
-}
-
 static
 int check_provider_version(struct lttng_probe_desc *desc)
 {
@@ -206,13 +192,6 @@ int lttng_probe_register(struct lttng_probe_desc *desc)
 
        ust_lock_nocheck();
 
-       /*
-        * Check if the provider has already been registered.
-        */
-       if (find_provider(desc->provider)) {
-               ret = -EEXIST;
-               goto end;
-       }
        cds_list_add(&desc->lazy_init_head, &lazy_probe_init);
        desc->lazy = 1;
        DBG("adding probe %s containing %u events to lazy registration list",
@@ -224,7 +203,7 @@ int lttng_probe_register(struct lttng_probe_desc *desc)
         */
        if (lttng_session_active())
                fixup_lazy_probes();
-end:
+
        ust_unlock();
        return ret;
 }
This page took 0.028128 seconds and 4 git commands to generate.