4 * Copyright 2010 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 * Holds LTTng per-session event registry.
8 * Dual LGPL v2.1/GPL v2 license.
11 #include <linux/module.h>
12 #include <linux/list.h>
13 #include <linux/mutex.h>
14 #include <linux/sched.h>
15 #include <linux/slab.h>
16 #include <linux/jiffies.h>
17 #include "wrapper/uuid.h"
18 #include "wrapper/vmalloc.h" /* for wrapper_vmalloc_sync_all() */
19 #include "ltt-events.h"
20 #include "ltt-tracer.h"
22 static LIST_HEAD(sessions
);
23 static LIST_HEAD(ltt_transport_list
);
24 static DEFINE_MUTEX(sessions_mutex
);
25 static struct kmem_cache
*event_cache
;
27 static void _ltt_event_destroy(struct ltt_event
*event
);
28 static void _ltt_channel_destroy(struct ltt_channel
*chan
);
29 static int _ltt_event_unregister(struct ltt_event
*event
);
31 int _ltt_event_metadata_statedump(struct ltt_session
*session
,
32 struct ltt_channel
*chan
,
33 struct ltt_event
*event
);
35 int _ltt_session_metadata_statedump(struct ltt_session
*session
);
37 void synchronize_trace(void)
40 #ifdef CONFIG_PREEMPT_RT
45 struct ltt_session
*ltt_session_create(void)
47 struct ltt_session
*session
;
49 mutex_lock(&sessions_mutex
);
50 session
= kzalloc(sizeof(struct ltt_session
), GFP_KERNEL
);
53 INIT_LIST_HEAD(&session
->chan
);
54 INIT_LIST_HEAD(&session
->events
);
55 uuid_le_gen(&session
->uuid
);
56 list_add(&session
->list
, &sessions
);
57 mutex_unlock(&sessions_mutex
);
61 void ltt_session_destroy(struct ltt_session
*session
)
63 struct ltt_channel
*chan
, *tmpchan
;
64 struct ltt_event
*event
, *tmpevent
;
67 mutex_lock(&sessions_mutex
);
68 ACCESS_ONCE(session
->active
) = 0;
69 list_for_each_entry(event
, &session
->events
, list
) {
70 ret
= _ltt_event_unregister(event
);
73 synchronize_trace(); /* Wait for in-flight events to complete */
74 list_for_each_entry_safe(event
, tmpevent
, &session
->events
, list
)
75 _ltt_event_destroy(event
);
76 list_for_each_entry_safe(chan
, tmpchan
, &session
->chan
, list
)
77 _ltt_channel_destroy(chan
);
78 list_del(&session
->list
);
79 mutex_unlock(&sessions_mutex
);
83 int ltt_session_enable(struct ltt_session
*session
)
86 struct ltt_channel
*chan
;
88 mutex_lock(&sessions_mutex
);
89 if (session
->active
) {
95 * Snapshot the number of events per channel to know the type of header
98 list_for_each_entry(chan
, &session
->chan
, list
) {
99 if (chan
->header_type
)
100 continue; /* don't change it if session stop/restart */
101 if (chan
->free_event_id
< 31)
102 chan
->header_type
= 1; /* compact */
104 chan
->header_type
= 2; /* large */
107 ACCESS_ONCE(session
->active
) = 1;
108 ACCESS_ONCE(session
->been_active
) = 1;
109 ret
= _ltt_session_metadata_statedump(session
);
111 ACCESS_ONCE(session
->active
) = 0;
113 mutex_unlock(&sessions_mutex
);
117 int ltt_session_disable(struct ltt_session
*session
)
121 mutex_lock(&sessions_mutex
);
122 if (!session
->active
) {
126 ACCESS_ONCE(session
->active
) = 0;
128 mutex_unlock(&sessions_mutex
);
132 int ltt_channel_enable(struct ltt_channel
*channel
)
136 if (channel
== channel
->session
->metadata
)
138 old
= xchg(&channel
->enabled
, 1);
144 int ltt_channel_disable(struct ltt_channel
*channel
)
148 if (channel
== channel
->session
->metadata
)
150 old
= xchg(&channel
->enabled
, 0);
156 int ltt_event_enable(struct ltt_event
*event
)
160 if (event
->chan
== event
->chan
->session
->metadata
)
162 old
= xchg(&event
->enabled
, 1);
168 int ltt_event_disable(struct ltt_event
*event
)
172 if (event
->chan
== event
->chan
->session
->metadata
)
174 old
= xchg(&event
->enabled
, 0);
180 static struct ltt_transport
*ltt_transport_find(const char *name
)
182 struct ltt_transport
*transport
;
184 list_for_each_entry(transport
, <t_transport_list
, node
) {
185 if (!strcmp(transport
->name
, name
))
191 struct ltt_channel
*ltt_channel_create(struct ltt_session
*session
,
192 const char *transport_name
,
194 size_t subbuf_size
, size_t num_subbuf
,
195 unsigned int switch_timer_interval
,
196 unsigned int read_timer_interval
)
198 struct ltt_channel
*chan
;
199 struct ltt_transport
*transport
= NULL
;
201 mutex_lock(&sessions_mutex
);
202 if (session
->been_active
)
203 goto active
; /* Refuse to add channel to active session */
204 transport
= ltt_transport_find(transport_name
);
206 printk(KERN_WARNING
"LTTng transport %s not found\n",
210 if (!try_module_get(transport
->owner
)) {
211 printk(KERN_WARNING
"LTT : Can't lock transport module.\n");
214 chan
= kzalloc(sizeof(struct ltt_channel
), GFP_KERNEL
);
217 chan
->session
= session
;
218 chan
->id
= session
->free_chan_id
++;
220 * Note: the channel creation op already writes into the packet
221 * headers. Therefore the "chan" information used as input
222 * should be already accessible.
224 chan
->chan
= transport
->ops
.channel_create("[lttng]", chan
, buf_addr
,
225 subbuf_size
, num_subbuf
, switch_timer_interval
,
226 read_timer_interval
);
230 chan
->ops
= &transport
->ops
;
231 chan
->transport
= transport
;
232 list_add(&chan
->list
, &session
->chan
);
233 mutex_unlock(&sessions_mutex
);
240 module_put(transport
->owner
);
243 mutex_unlock(&sessions_mutex
);
248 * Only used internally at session destruction.
251 void _ltt_channel_destroy(struct ltt_channel
*chan
)
253 chan
->ops
->channel_destroy(chan
->chan
);
254 module_put(chan
->transport
->owner
);
255 list_del(&chan
->list
);
256 lttng_destroy_context(chan
->ctx
);
261 * Supports event creation while tracing session is active.
263 struct ltt_event
*ltt_event_create(struct ltt_channel
*chan
,
264 struct lttng_kernel_event
*event_param
,
267 struct ltt_event
*event
;
270 mutex_lock(&sessions_mutex
);
271 if (chan
->free_event_id
== -1UL)
274 * This is O(n^2) (for each event, the loop is called at event
275 * creation). Might require a hash if we have lots of events.
277 list_for_each_entry(event
, &chan
->session
->events
, list
)
278 if (!strcmp(event
->desc
->name
, event_param
->name
))
280 event
= kmem_cache_zalloc(event_cache
, GFP_KERNEL
);
284 event
->filter
= filter
;
285 event
->id
= chan
->free_event_id
++;
287 event
->instrumentation
= event_param
->instrumentation
;
288 /* Populate ltt_event structure before tracepoint registration. */
290 switch (event_param
->instrumentation
) {
291 case LTTNG_KERNEL_TRACEPOINT
:
292 event
->desc
= ltt_event_get(event_param
->name
);
295 ret
= tracepoint_probe_register(event_param
->name
,
296 event
->desc
->probe_callback
,
301 case LTTNG_KERNEL_KPROBE
:
302 ret
= lttng_kprobes_register(event_param
->name
,
303 event_param
->u
.kprobe
.symbol_name
,
304 event_param
->u
.kprobe
.offset
,
305 event_param
->u
.kprobe
.addr
,
309 ret
= try_module_get(event
->desc
->owner
);
312 case LTTNG_KERNEL_KRETPROBE
:
314 struct ltt_event
*event_return
;
316 /* kretprobe defines 2 events */
318 kmem_cache_zalloc(event_cache
, GFP_KERNEL
);
321 event_return
->chan
= chan
;
322 event_return
->filter
= filter
;
323 event_return
->id
= chan
->free_event_id
++;
324 event_return
->enabled
= 1;
325 event_return
->instrumentation
= event_param
->instrumentation
;
327 * Populate ltt_event structure before kretprobe registration.
330 ret
= lttng_kretprobes_register(event_param
->name
,
331 event_param
->u
.kretprobe
.symbol_name
,
332 event_param
->u
.kretprobe
.offset
,
333 event_param
->u
.kretprobe
.addr
,
334 event
, event_return
);
336 kmem_cache_free(event_cache
, event_return
);
339 /* Take 2 refs on the module: one per event. */
340 ret
= try_module_get(event
->desc
->owner
);
342 ret
= try_module_get(event
->desc
->owner
);
344 ret
= _ltt_event_metadata_statedump(chan
->session
, chan
,
347 kmem_cache_free(event_cache
, event_return
);
348 module_put(event
->desc
->owner
);
349 module_put(event
->desc
->owner
);
350 goto statedump_error
;
352 list_add(&event_return
->list
, &chan
->session
->events
);
355 case LTTNG_KERNEL_FUNCTION
:
356 ret
= lttng_ftrace_register(event_param
->name
,
357 event_param
->u
.ftrace
.symbol_name
,
361 ret
= try_module_get(event
->desc
->owner
);
367 ret
= _ltt_event_metadata_statedump(chan
->session
, chan
, event
);
369 goto statedump_error
;
370 list_add(&event
->list
, &chan
->session
->events
);
371 mutex_unlock(&sessions_mutex
);
375 WARN_ON_ONCE(tracepoint_probe_unregister(event_param
->name
,
376 event
->desc
->probe_callback
,
378 ltt_event_put(event
->desc
);
380 kmem_cache_free(event_cache
, event
);
384 mutex_unlock(&sessions_mutex
);
389 * Only used internally at session destruction.
391 int _ltt_event_unregister(struct ltt_event
*event
)
395 switch (event
->instrumentation
) {
396 case LTTNG_KERNEL_TRACEPOINT
:
397 ret
= tracepoint_probe_unregister(event
->desc
->name
,
398 event
->desc
->probe_callback
,
403 case LTTNG_KERNEL_KPROBE
:
404 lttng_kprobes_unregister(event
);
407 case LTTNG_KERNEL_KRETPROBE
:
408 lttng_kretprobes_unregister(event
);
411 case LTTNG_KERNEL_FUNCTION
:
412 lttng_ftrace_unregister(event
);
422 * Only used internally at session destruction.
425 void _ltt_event_destroy(struct ltt_event
*event
)
427 switch (event
->instrumentation
) {
428 case LTTNG_KERNEL_TRACEPOINT
:
429 ltt_event_put(event
->desc
);
431 case LTTNG_KERNEL_KPROBE
:
432 module_put(event
->desc
->owner
);
433 lttng_kprobes_destroy_private(event
);
435 case LTTNG_KERNEL_KRETPROBE
:
436 module_put(event
->desc
->owner
);
437 lttng_kretprobes_destroy_private(event
);
439 case LTTNG_KERNEL_FUNCTION
:
440 module_put(event
->desc
->owner
);
441 lttng_ftrace_destroy_private(event
);
446 list_del(&event
->list
);
447 lttng_destroy_context(event
->ctx
);
448 kmem_cache_free(event_cache
, event
);
452 * We have exclusive access to our metadata buffer (protected by the
453 * sessions_mutex), so we can do racy operations such as looking for
454 * remaining space left in packet and write, since mutual exclusion
455 * protects us from concurrent writes.
457 int lttng_metadata_printf(struct ltt_session
*session
,
458 const char *fmt
, ...)
460 struct lib_ring_buffer_ctx ctx
;
461 struct ltt_channel
*chan
= session
->metadata
;
463 int ret
= 0, waitret
;
464 size_t len
, reserve_len
, pos
;
467 WARN_ON_ONCE(!ACCESS_ONCE(session
->active
));
470 str
= kvasprintf(GFP_KERNEL
, fmt
, ap
);
478 for (pos
= 0; pos
< len
; pos
+= reserve_len
) {
479 reserve_len
= min_t(size_t,
480 chan
->ops
->packet_avail_size(chan
->chan
),
482 lib_ring_buffer_ctx_init(&ctx
, chan
->chan
, NULL
, reserve_len
,
485 * We don't care about metadata buffer's records lost
486 * count, because we always retry here. Report error if
487 * we need to bail out after timeout or being
490 waitret
= wait_event_interruptible_timeout(*chan
->ops
->get_writer_buf_wait_queue(chan
->chan
, -1),
492 ret
= chan
->ops
->event_reserve(&ctx
, 0);
493 ret
!= -ENOBUFS
|| !ret
;
495 msecs_to_jiffies(LTTNG_METADATA_TIMEOUT_MSEC
));
496 if (!waitret
|| waitret
== -ERESTARTSYS
|| ret
) {
497 printk(KERN_WARNING
"LTTng: Failure to write metadata to buffers (%s)\n",
498 waitret
== -ERESTARTSYS
? "interrupted" :
499 (ret
== -ENOBUFS
? "timeout" : "I/O error"));
500 if (waitret
== -ERESTARTSYS
)
504 chan
->ops
->event_write(&ctx
, &str
[pos
], reserve_len
);
505 chan
->ops
->event_commit(&ctx
);
513 int _ltt_field_statedump(struct ltt_session
*session
,
514 const struct lttng_event_field
*field
)
518 switch (field
->type
.atype
) {
520 ret
= lttng_metadata_printf(session
,
521 " integer { size = %u; align = %u; signed = %u; encoding = %s; base = %u;%s } %s;\n",
522 field
->type
.u
.basic
.integer
.size
,
523 field
->type
.u
.basic
.integer
.alignment
,
524 field
->type
.u
.basic
.integer
.signedness
,
525 (field
->type
.u
.basic
.integer
.encoding
== lttng_encode_none
)
527 : (field
->type
.u
.basic
.integer
.encoding
== lttng_encode_UTF8
)
530 field
->type
.u
.basic
.integer
.base
,
532 field
->type
.u
.basic
.integer
.reverse_byte_order
? " byte_order = le;" : "",
534 field
->type
.u
.basic
.integer
.reverse_byte_order
? " byte_order = be;" : "",
539 ret
= lttng_metadata_printf(session
,
541 field
->type
.u
.basic
.enumeration
.name
,
546 const struct lttng_basic_type
*elem_type
;
548 elem_type
= &field
->type
.u
.array
.elem_type
;
549 ret
= lttng_metadata_printf(session
,
550 " integer { size = %u; align = %u; signed = %u; encoding = %s; base = %u;%s } %s[%u];\n",
551 elem_type
->u
.basic
.integer
.size
,
552 elem_type
->u
.basic
.integer
.alignment
,
553 elem_type
->u
.basic
.integer
.signedness
,
554 (elem_type
->u
.basic
.integer
.encoding
== lttng_encode_none
)
556 : (elem_type
->u
.basic
.integer
.encoding
== lttng_encode_UTF8
)
559 elem_type
->u
.basic
.integer
.base
,
561 elem_type
->u
.basic
.integer
.reverse_byte_order
? " byte_order = le;" : "",
563 elem_type
->u
.basic
.integer
.reverse_byte_order
? " byte_order = be;" : "",
565 field
->name
, field
->type
.u
.array
.length
);
570 const struct lttng_basic_type
*elem_type
;
571 const struct lttng_basic_type
*length_type
;
573 elem_type
= &field
->type
.u
.sequence
.elem_type
;
574 length_type
= &field
->type
.u
.sequence
.length_type
;
575 ret
= lttng_metadata_printf(session
,
576 " integer { size = %u; align = %u; signed = %u; encoding = %s; base = %u;%s } __%s_length;\n",
577 length_type
->u
.basic
.integer
.size
,
578 (unsigned int) length_type
->u
.basic
.integer
.alignment
,
579 length_type
->u
.basic
.integer
.signedness
,
580 (length_type
->u
.basic
.integer
.encoding
== lttng_encode_none
)
582 : ((length_type
->u
.basic
.integer
.encoding
== lttng_encode_UTF8
)
585 length_type
->u
.basic
.integer
.base
,
587 length_type
->u
.basic
.integer
.reverse_byte_order
? " byte_order = le;" : "",
589 length_type
->u
.basic
.integer
.reverse_byte_order
? " byte_order = be;" : "",
595 ret
= lttng_metadata_printf(session
,
596 " integer { size = %u; align = %u; signed = %u; encoding = %s; base = %u;%s } %s[ __%s_length ];\n",
597 elem_type
->u
.basic
.integer
.size
,
598 (unsigned int) elem_type
->u
.basic
.integer
.alignment
,
599 elem_type
->u
.basic
.integer
.signedness
,
600 (elem_type
->u
.basic
.integer
.encoding
== lttng_encode_none
)
602 : ((elem_type
->u
.basic
.integer
.encoding
== lttng_encode_UTF8
)
605 elem_type
->u
.basic
.integer
.base
,
607 elem_type
->u
.basic
.integer
.reverse_byte_order
? " byte_order = le;" : "",
609 elem_type
->u
.basic
.integer
.reverse_byte_order
? " byte_order = be;" : "",
617 /* Default encoding is UTF8 */
618 ret
= lttng_metadata_printf(session
,
620 field
->type
.u
.basic
.string
.encoding
== lttng_encode_ASCII
?
621 " { encoding = ASCII; }" : "",
632 int _ltt_context_metadata_statedump(struct ltt_session
*session
,
633 struct lttng_ctx
*ctx
)
640 for (i
= 0; i
< ctx
->nr_fields
; i
++) {
641 const struct lttng_ctx_field
*field
= &ctx
->fields
[i
];
643 ret
= _ltt_field_statedump(session
, &field
->event_field
);
651 int _ltt_fields_metadata_statedump(struct ltt_session
*session
,
652 struct ltt_event
*event
)
654 const struct lttng_event_desc
*desc
= event
->desc
;
658 for (i
= 0; i
< desc
->nr_fields
; i
++) {
659 const struct lttng_event_field
*field
= &desc
->fields
[i
];
661 ret
= _ltt_field_statedump(session
, field
);
669 int _ltt_event_metadata_statedump(struct ltt_session
*session
,
670 struct ltt_channel
*chan
,
671 struct ltt_event
*event
)
675 if (event
->metadata_dumped
|| !ACCESS_ONCE(session
->active
))
677 if (chan
== session
->metadata
)
680 ret
= lttng_metadata_printf(session
,
684 " stream_id = %u;\n",
692 ret
= lttng_metadata_printf(session
,
693 " context := struct {\n");
697 ret
= _ltt_context_metadata_statedump(session
, event
->ctx
);
701 ret
= lttng_metadata_printf(session
,
707 ret
= lttng_metadata_printf(session
,
708 " fields := struct {\n"
713 ret
= _ltt_fields_metadata_statedump(session
, event
);
718 * LTTng space reservation can only reserve multiples of the
721 ret
= lttng_metadata_printf(session
,
727 event
->metadata_dumped
= 1;
734 int _ltt_channel_metadata_statedump(struct ltt_session
*session
,
735 struct ltt_channel
*chan
)
739 if (chan
->metadata_dumped
|| !ACCESS_ONCE(session
->active
))
741 if (chan
== session
->metadata
)
744 WARN_ON_ONCE(!chan
->header_type
);
745 ret
= lttng_metadata_printf(session
,
748 " event.header := %s;\n"
749 " packet.context := struct packet_context;\n",
751 chan
->header_type
== 1 ? "struct event_header_compact" :
752 "struct event_header_large");
757 ret
= lttng_metadata_printf(session
,
758 " event.context := struct {\n");
762 ret
= _ltt_context_metadata_statedump(session
, chan
->ctx
);
766 ret
= lttng_metadata_printf(session
,
772 ret
= lttng_metadata_printf(session
,
775 chan
->metadata_dumped
= 1;
781 int _ltt_stream_packet_context_declare(struct ltt_session
*session
)
783 return lttng_metadata_printf(session
,
784 "struct packet_context {\n"
785 " uint64_t timestamp_begin;\n"
786 " uint64_t timestamp_end;\n"
787 " uint32_t events_discarded;\n"
788 " uint32_t content_size;\n"
789 " uint32_t packet_size;\n"
790 " uint32_t cpu_id;\n"
798 * id 31 is reserved to indicate an extended header.
801 * id: range: 0 - 65534.
802 * id 65535 is reserved to indicate an extended header.
805 int _ltt_event_header_declare(struct ltt_session
*session
)
807 return lttng_metadata_printf(session
,
808 "struct event_header_compact {\n"
809 " enum : uint5_t { compact = 0 ... 30, extended = 31 } id;\n"
812 " uint27_t timestamp;\n"
816 " uint64_t timestamp;\n"
821 "struct event_header_large {\n"
822 " enum : uint16_t { compact = 0 ... 65534, extended = 65535 } id;\n"
825 " uint32_t timestamp;\n"
829 " uint64_t timestamp;\n"
833 ltt_alignof(uint32_t) * CHAR_BIT
,
834 ltt_alignof(uint16_t) * CHAR_BIT
839 * Output metadata into this session's metadata buffers.
842 int _ltt_session_metadata_statedump(struct ltt_session
*session
)
844 unsigned char *uuid_c
= session
->uuid
.b
;
845 unsigned char uuid_s
[37];
846 struct ltt_channel
*chan
;
847 struct ltt_event
*event
;
850 if (!ACCESS_ONCE(session
->active
))
852 if (session
->metadata_dumped
)
854 if (!session
->metadata
) {
855 printk(KERN_WARNING
"LTTng: attempt to start tracing, but metadata channel is not found. Operation abort.\n");
859 snprintf(uuid_s
, sizeof(uuid_s
),
860 "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
861 uuid_c
[0], uuid_c
[1], uuid_c
[2], uuid_c
[3],
862 uuid_c
[4], uuid_c
[5], uuid_c
[6], uuid_c
[7],
863 uuid_c
[8], uuid_c
[9], uuid_c
[10], uuid_c
[11],
864 uuid_c
[12], uuid_c
[13], uuid_c
[14], uuid_c
[15]);
866 ret
= lttng_metadata_printf(session
,
867 "typealias integer { size = 8; align = %u; signed = false; } := uint8_t;\n"
868 "typealias integer { size = 16; align = %u; signed = false; } := uint16_t;\n"
869 "typealias integer { size = 32; align = %u; signed = false; } := uint32_t;\n"
870 "typealias integer { size = 64; align = %u; signed = false; } := uint64_t;\n"
871 "typealias integer { size = 5; align = 1; signed = false; } := uint5_t;\n"
872 "typealias integer { size = 27; align = 1; signed = false; } := uint27_t;\n"
878 " byte_order = %s;\n"
879 " packet.header := struct {\n"
881 " uint8_t uuid[16];\n"
882 " uint32_t stream_id;\n"
885 ltt_alignof(uint8_t) * CHAR_BIT
,
886 ltt_alignof(uint16_t) * CHAR_BIT
,
887 ltt_alignof(uint32_t) * CHAR_BIT
,
888 ltt_alignof(uint64_t) * CHAR_BIT
,
901 ret
= _ltt_stream_packet_context_declare(session
);
905 ret
= _ltt_event_header_declare(session
);
910 list_for_each_entry(chan
, &session
->chan
, list
) {
911 ret
= _ltt_channel_metadata_statedump(session
, chan
);
916 list_for_each_entry(event
, &session
->events
, list
) {
917 ret
= _ltt_event_metadata_statedump(session
, event
->chan
, event
);
921 session
->metadata_dumped
= 1;
927 * ltt_transport_register - LTT transport registration
928 * @transport: transport structure
930 * Registers a transport which can be used as output to extract the data out of
931 * LTTng. The module calling this registration function must ensure that no
932 * trap-inducing code will be executed by the transport functions. E.g.
933 * vmalloc_sync_all() must be called between a vmalloc and the moment the memory
934 * is made visible to the transport function. This registration acts as a
935 * vmalloc_sync_all. Therefore, only if the module allocates virtual memory
936 * after its registration must it synchronize the TLBs.
938 void ltt_transport_register(struct ltt_transport
*transport
)
941 * Make sure no page fault can be triggered by the module about to be
942 * registered. We deal with this here so we don't have to call
943 * vmalloc_sync_all() in each module's init.
945 wrapper_vmalloc_sync_all();
947 mutex_lock(&sessions_mutex
);
948 list_add_tail(&transport
->node
, <t_transport_list
);
949 mutex_unlock(&sessions_mutex
);
951 EXPORT_SYMBOL_GPL(ltt_transport_register
);
954 * ltt_transport_unregister - LTT transport unregistration
955 * @transport: transport structure
957 void ltt_transport_unregister(struct ltt_transport
*transport
)
959 mutex_lock(&sessions_mutex
);
960 list_del(&transport
->node
);
961 mutex_unlock(&sessions_mutex
);
963 EXPORT_SYMBOL_GPL(ltt_transport_unregister
);
965 static int __init
ltt_events_init(void)
969 event_cache
= KMEM_CACHE(ltt_event
, 0);
972 ret
= ltt_debugfs_abi_init();
977 kmem_cache_destroy(event_cache
);
981 module_init(ltt_events_init
);
983 static void __exit
ltt_events_exit(void)
985 struct ltt_session
*session
, *tmpsession
;
987 ltt_debugfs_abi_exit();
988 list_for_each_entry_safe(session
, tmpsession
, &sessions
, list
)
989 ltt_session_destroy(session
);
990 kmem_cache_destroy(event_cache
);
993 module_exit(ltt_events_exit
);
995 MODULE_LICENSE("GPL and additional rights");
996 MODULE_AUTHOR("Mathieu Desnoyers <mathieu.desnoyers@efficios.com>");
997 MODULE_DESCRIPTION("LTTng Events");