projects
/
lttng-modules.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use the memory pool instead of kmalloc
[lttng-modules.git]
/
probes
/
lttng-tracepoint-event-impl.h
diff --git
a/probes/lttng-tracepoint-event-impl.h
b/probes/lttng-tracepoint-event-impl.h
index aa16475d24d181dd3f7c22ce7e786d3759060d1a..0842dcc0e210e491a92eb91a8739748460003d5b 100644
(file)
--- a/
probes/lttng-tracepoint-event-impl.h
+++ b/
probes/lttng-tracepoint-event-impl.h
@@
-34,6
+34,9
@@
#include <wrapper/rcu.h>
#include <lttng-events.h>
#include <lttng-tracer-core.h>
#include <wrapper/rcu.h>
#include <lttng-events.h>
#include <lttng-tracer-core.h>
+#include <lttng-tp-mempool.h>
+
+#define __LTTNG_NULL_STRING "(null)"
/*
* Macro declarations used for all stages.
/*
* Macro declarations used for all stages.
@@
-220,6
+223,24
@@
void __event_template_proto___##_name(void);
.string = (_string), \
},
.string = (_string), \
},
+/* Enumeration entry (automatic value; follows the rules of CTF) */
+#undef ctf_enum_auto
+#define ctf_enum_auto(_string) \
+ { \
+ .start = { \
+ .signedness = -1, \
+ .value = -1, \
+ }, \
+ .end = { \
+ .signedness = -1, \
+ .value = -1, \
+ }, \
+ .string = (_string), \
+ .options = { \
+ .is_auto = 1, \
+ } \
+ },
+
#undef TP_ENUM_VALUES
#define TP_ENUM_VALUES(...) \
__VA_ARGS__
#undef TP_ENUM_VALUES
#define TP_ENUM_VALUES(...) \
__VA_ARGS__
@@
-500,7
+521,7
@@
static void __event_probe__##_name(void *__data);
max_t(size_t, lttng_strlen_user_inatomic(_src), 1); \
} else { \
__event_len += this_cpu_ptr(<tng_dynamic_len_stack)->stack[this_cpu_ptr(<tng_dynamic_len_stack)->offset - 1] = \
max_t(size_t, lttng_strlen_user_inatomic(_src), 1); \
} else { \
__event_len += this_cpu_ptr(<tng_dynamic_len_stack)->stack[this_cpu_ptr(<tng_dynamic_len_stack)->offset - 1] = \
- strlen(
_src) + 1;
\
+ strlen(
(_src) ? (_src) : __LTTNG_NULL_STRING) + 1;
\
}
#undef _ctf_enum
}
#undef _ctf_enum
@@
-713,7
+734,8
@@
error: \
#undef _ctf_string
#define _ctf_string(_item, _src, _user, _nowrite) \
{ \
#undef _ctf_string
#define _ctf_string(_item, _src, _user, _nowrite) \
{ \
- const void *__ctf_tmp_ptr = (_src); \
+ const void *__ctf_tmp_ptr = \
+ ((_src) ? (_src) : __LTTNG_NULL_STRING); \
memcpy(__stack_data, &__ctf_tmp_ptr, sizeof(void *)); \
__stack_data += sizeof(void *); \
}
memcpy(__stack_data, &__ctf_tmp_ptr, sizeof(void *)); \
__stack_data += sizeof(void *); \
}
@@
-1024,12
+1046,16
@@
static inline size_t __event_get_align__##_name(void *__tp_locvar) \
#undef _ctf_string
#define _ctf_string(_item, _src, _user, _nowrite) \
#undef _ctf_string
#define _ctf_string(_item, _src, _user, _nowrite) \
- lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(*(_src))); \
if (_user) { \
if (_user) { \
+ lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(*(_src))); \
__chan->ops->event_strcpy_from_user(&__ctx, _src, \
__get_dynamic_len(dest)); \
} else { \
__chan->ops->event_strcpy_from_user(&__ctx, _src, \
__get_dynamic_len(dest)); \
} else { \
- __chan->ops->event_strcpy(&__ctx, _src, \
+ const char *__ctf_tmp_string = \
+ ((_src) ? (_src) : __LTTNG_NULL_STRING); \
+ lib_ring_buffer_align_ctx(&__ctx, \
+ lttng_alignof(*__ctf_tmp_string)); \
+ __chan->ops->event_strcpy(&__ctx, __ctf_tmp_string, \
__get_dynamic_len(dest)); \
}
__get_dynamic_len(dest)); \
}
@@
-1105,7
+1131,7
@@
static void __event_probe__##_name(void *__data, _proto) \
struct lib_ring_buffer_ctx __ctx; \
ssize_t __event_len; \
size_t __event_align; \
struct lib_ring_buffer_ctx __ctx; \
ssize_t __event_len; \
size_t __event_align; \
- size_t __orig_dynamic_len_offset, __dynamic_len_idx
;
\
+ size_t __orig_dynamic_len_offset, __dynamic_len_idx
__attribute__((unused));
\
union { \
size_t __dynamic_len_removed[ARRAY_SIZE(__event_fields___##_name)]; \
char __filter_stack_data[2 * sizeof(unsigned long) * ARRAY_SIZE(__event_fields___##_name)]; \
union { \
size_t __dynamic_len_removed[ARRAY_SIZE(__event_fields___##_name)]; \
char __filter_stack_data[2 * sizeof(unsigned long) * ARRAY_SIZE(__event_fields___##_name)]; \
@@
-1118,14
+1144,14
@@
static void __event_probe__##_name(void *__data, _proto) \
\
if (!_TP_SESSION_CHECK(session, __session)) \
return; \
\
if (!_TP_SESSION_CHECK(session, __session)) \
return; \
- if (unlikely(!
ACCESS_ONCE(__session->active)))
\
+ if (unlikely(!
READ_ONCE(__session->active)))
\
return; \
return; \
- if (unlikely(!
ACCESS_ONCE(__chan->enabled)))
\
+ if (unlikely(!
READ_ONCE(__chan->enabled)))
\
return; \
return; \
- if (unlikely(!
ACCESS_ONCE(__event->enabled)))
\
+ if (unlikely(!
READ_ONCE(__event->enabled)))
\
return; \
__lpf = lttng_rcu_dereference(__session->pid_tracker); \
return; \
__lpf = lttng_rcu_dereference(__session->pid_tracker); \
- if (__lpf && likely(!lttng_pid_tracker_lookup(__lpf, current->
pid)))
\
+ if (__lpf && likely(!lttng_pid_tracker_lookup(__lpf, current->
tgid)))
\
return; \
__orig_dynamic_len_offset = this_cpu_ptr(<tng_dynamic_len_stack)->offset; \
__dynamic_len_idx = __orig_dynamic_len_offset; \
return; \
__orig_dynamic_len_offset = this_cpu_ptr(<tng_dynamic_len_stack)->offset; \
__dynamic_len_idx = __orig_dynamic_len_offset; \
@@
-1179,7
+1205,7
@@
static void __event_probe__##_name(void *__data) \
struct lib_ring_buffer_ctx __ctx; \
ssize_t __event_len; \
size_t __event_align; \
struct lib_ring_buffer_ctx __ctx; \
ssize_t __event_len; \
size_t __event_align; \
- size_t __orig_dynamic_len_offset, __dynamic_len_idx
;
\
+ size_t __orig_dynamic_len_offset, __dynamic_len_idx
__attribute__((unused));
\
union { \
size_t __dynamic_len_removed[ARRAY_SIZE(__event_fields___##_name)]; \
char __filter_stack_data[2 * sizeof(unsigned long) * ARRAY_SIZE(__event_fields___##_name)]; \
union { \
size_t __dynamic_len_removed[ARRAY_SIZE(__event_fields___##_name)]; \
char __filter_stack_data[2 * sizeof(unsigned long) * ARRAY_SIZE(__event_fields___##_name)]; \
@@
-1192,11
+1218,11
@@
static void __event_probe__##_name(void *__data) \
\
if (!_TP_SESSION_CHECK(session, __session)) \
return; \
\
if (!_TP_SESSION_CHECK(session, __session)) \
return; \
- if (unlikely(!
ACCESS_ONCE(__session->active)))
\
+ if (unlikely(!
READ_ONCE(__session->active)))
\
return; \
return; \
- if (unlikely(!
ACCESS_ONCE(__chan->enabled)))
\
+ if (unlikely(!
READ_ONCE(__chan->enabled)))
\
return; \
return; \
- if (unlikely(!
ACCESS_ONCE(__event->enabled)))
\
+ if (unlikely(!
READ_ONCE(__event->enabled)))
\
return; \
__lpf = lttng_rcu_dereference(__session->pid_tracker); \
if (__lpf && likely(!lttng_pid_tracker_lookup(__lpf, current->pid))) \
return; \
__lpf = lttng_rcu_dereference(__session->pid_tracker); \
if (__lpf && likely(!lttng_pid_tracker_lookup(__lpf, current->pid))) \
This page took
0.02686 seconds
and
4
git commands to generate.