X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Ftrace-ust.c;h=4f06f1b06d149635080e99edc616978cca3ae7ba;hb=bd39b88b61f8a17e1ca4c49706fe047d9253fb23;hp=1f6fd52736abe4f8abde125fdc092601d491ec46;hpb=fefd409b002735b415c5f653cdb2587be454f145;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/trace-ust.c b/src/bin/lttng-sessiond/trace-ust.c index 1f6fd5273..4f06f1b06 100644 --- a/src/bin/lttng-sessiond/trace-ust.c +++ b/src/bin/lttng-sessiond/trace-ust.c @@ -16,6 +16,7 @@ */ #define _GNU_SOURCE +#define _LGPL_SOURCE #include #include #include @@ -202,6 +203,9 @@ error: /* * Lookup an agent in the session agents hash table by domain type and return * the object if found else NULL. + * + * RCU read side lock must be acquired before calling and only released + * once the agent is no longer in scope or being used. */ struct agent *trace_ust_find_agent(struct ltt_ust_session *session, enum lttng_domain_type domain_type) @@ -362,6 +366,7 @@ error: /* * Allocate and initialize a ust event. Set name and event type. + * We own filter_expression, filter, and exclusion. * * Return pointer to structure or NULL. */ @@ -437,6 +442,9 @@ struct ltt_ust_event *trace_ust_create_event(struct lttng_event *ev, error_free_event: free(lue); error: + free(filter_expression); + free(filter); + free(exclusion); return NULL; } @@ -462,7 +470,12 @@ int trace_ust_context_type_event_to_ust(enum lttng_event_context_type type) utype = LTTNG_UST_CONTEXT_IP; break; case LTTNG_EVENT_CONTEXT_PERF_THREAD_COUNTER: - utype = LTTNG_UST_CONTEXT_PERF_THREAD_COUNTER; + if (!ustctl_has_perf_counters()) { + utype = -1; + WARN("Perf counters not implemented in UST"); + } else { + utype = LTTNG_UST_CONTEXT_PERF_THREAD_COUNTER; + } break; default: ERR("Invalid UST context"); @@ -749,10 +762,16 @@ void trace_ust_destroy_session(struct ltt_ust_session *session) /* Cleaning up UST domain */ destroy_domain_global(&session->domain_global); + rcu_read_lock(); cds_lfht_for_each_entry(session->agents->ht, &iter.iter, agt, node.node) { - lttng_ht_del(session->agents, &iter); + int ret = lttng_ht_del(session->agents, &iter); + + assert(!ret); agent_destroy(agt); } + rcu_read_unlock(); + + ht_cleanup_push(session->agents); /* Cleanup UID buffer registry object(s). */ cds_list_for_each_entry_safe(reg, sreg, &session->buffer_reg_uid_list,