ed589c73e93160773c135e3ea49548ab3331532f
2 * ltt-type-serializer.c
4 * LTTng specialized type serializer.
6 * Copyright Mathieu Desnoyers, 2008.
8 * Dual LGPL v2.1/GPL v2 license.
10 #include <linux/module.h>
12 #include "ltt-type-serializer.h"
13 #include "ltt-relay-lockless.h"
16 void _ltt_specialized_trace(void *probe_data
,
17 void *serialize_private
, unsigned int data_size
,
18 unsigned int largest_align
)
20 struct ltt_event
*event
= probe_data
;
24 struct ltt_chanbuf
*buf
;
25 struct ltt_channel
*chan
;
26 struct ltt_session
*session
;
32 /* disabled from tracepoints rcu_read_lock_sched_notrace(); */
33 cpu
= smp_processor_id();
34 __get_cpu_var(ltt_nesting
)++;
36 * asm volatile and "memory" clobber prevent the compiler from moving
37 * instructions out of the ltt nesting count. This is required to ensure
38 * that probe side-effects which can cause recursion (e.g. unforeseen
39 * traps, divisions by 0, ...) are triggered within the incremented
40 * nesting count section.
45 session
= chan
->session
;
47 if (unlikely(!session
->active
))
49 if (unlikely(!ltt_run_filter(session
, chan
, event
)))
51 #ifdef LTT_DEBUG_EVENT_SIZE
52 rflags
= LTT_RFLAG_ID_SIZE
;
54 if (unlikely(eID
>= LTT_FREE_EVENTS
))
55 rflags
= LTT_RFLAG_ID
;
59 /* reserve space : header and data */
60 ret
= ltt_reserve_slot(chan
, trace
, data_size
, largest_align
,
61 cpu
, &buf
, &slot_size
, &buf_offset
, &tsc
,
63 if (unlikely(ret
< 0))
64 goto skip
; /* buffer full */
66 /* Out-of-order write : header and data */
67 buf_offset
= ltt_write_event_header(&buf
->a
, &chan
->a
,
68 buf_offset
, eID
, data_size
,
71 buf_offset
+= ltt_align(buf_offset
, largest_align
);
72 ltt_relay_write(&buf
->a
, &chan
->a
, buf_offset
,
73 serialize_private
, data_size
);
74 buf_offset
+= data_size
;
76 /* Out-of-order commit */
77 ltt_commit_slot(buf
, chan
, buf_offset
, data_size
, slot_size
);
80 * asm volatile and "memory" clobber prevent the compiler from moving
81 * instructions out of the ltt nesting count. This is required to ensure
82 * that probe side-effects which can cause recursion (e.g. unforeseen
83 * traps, divisions by 0, ...) are triggered within the incremented
84 * nesting count section.
87 __get_cpu_var(ltt_nesting
)--;
88 /* disabled from tracepoints rcu_read_unlock_sched_notrace(); */
90 EXPORT_SYMBOL_GPL(_ltt_specialized_trace
);
92 MODULE_LICENSE("GPL and additional rights");
93 MODULE_AUTHOR("Mathieu Desnoyers");
94 MODULE_DESCRIPTION("LTT type serializer");
This page took 0.046496 seconds and 3 git commands to generate.