callstack context: use delimiter when stack is incomplete
[lttng-modules.git] / lttng-events.c
index 6bfe710f57ea24b9d2da90fc4de04f96347da325..ec44502318d8ec132eb3835e8bdc828112010724 100644 (file)
@@ -46,6 +46,7 @@
 #include <wrapper/random.h>
 #include <wrapper/tracepoint.h>
 #include <wrapper/list.h>
+#include <wrapper/types.h>
 #include <lttng-kernel-version.h>
 #include <lttng-events.h>
 #include <lttng-tracer.h>
@@ -131,7 +132,7 @@ struct lttng_session *lttng_session_create(void)
        int i;
 
        mutex_lock(&sessions_mutex);
-       session = kzalloc(sizeof(struct lttng_session), GFP_KERNEL);
+       session = lttng_kvzalloc(sizeof(struct lttng_session), GFP_KERNEL);
        if (!session)
                goto err;
        INIT_LIST_HEAD(&session->chan);
@@ -162,7 +163,7 @@ struct lttng_session *lttng_session_create(void)
 err_free_cache:
        kfree(metadata_cache);
 err_free_session:
-       kfree(session);
+       lttng_kvfree(session);
 err:
        mutex_unlock(&sessions_mutex);
        return NULL;
@@ -185,7 +186,7 @@ void lttng_session_destroy(struct lttng_session *session)
        int ret;
 
        mutex_lock(&sessions_mutex);
-       ACCESS_ONCE(session->active) = 0;
+       WRITE_ONCE(session->active, 0);
        list_for_each_entry(chan, &session->chan, list) {
                ret = lttng_syscalls_unregister(chan);
                WARN_ON(ret);
@@ -211,7 +212,7 @@ void lttng_session_destroy(struct lttng_session *session)
        kref_put(&session->metadata_cache->refcount, metadata_cache_destroy);
        list_del(&session->list);
        mutex_unlock(&sessions_mutex);
-       kfree(session);
+       lttng_kvfree(session);
 }
 
 int lttng_session_statedump(struct lttng_session *session)
@@ -260,16 +261,16 @@ int lttng_session_enable(struct lttng_session *session)
                        lib_ring_buffer_clear_quiescent_channel(chan->chan);
        }
 
-       ACCESS_ONCE(session->active) = 1;
-       ACCESS_ONCE(session->been_active) = 1;
+       WRITE_ONCE(session->active, 1);
+       WRITE_ONCE(session->been_active, 1);
        ret = _lttng_session_metadata_statedump(session);
        if (ret) {
-               ACCESS_ONCE(session->active) = 0;
+               WRITE_ONCE(session->active, 0);
                goto end;
        }
        ret = lttng_statedump_start(session);
        if (ret)
-               ACCESS_ONCE(session->active) = 0;
+               WRITE_ONCE(session->active, 0);
 end:
        mutex_unlock(&sessions_mutex);
        return ret;
@@ -285,7 +286,7 @@ int lttng_session_disable(struct lttng_session *session)
                ret = -EBUSY;
                goto end;
        }
-       ACCESS_ONCE(session->active) = 0;
+       WRITE_ONCE(session->active, 0);
 
        /* Set transient enabler state to "disabled" */
        session->tstate = 0;
@@ -341,8 +342,6 @@ end:
        return ret;
 }
 
-
-
 int lttng_channel_enable(struct lttng_channel *channel)
 {
        int ret = 0;
@@ -360,7 +359,7 @@ int lttng_channel_enable(struct lttng_channel *channel)
        channel->tstate = 1;
        lttng_session_sync_enablers(channel->session);
        /* Set atomically the state to "enabled" */
-       ACCESS_ONCE(channel->enabled) = 1;
+       WRITE_ONCE(channel->enabled, 1);
 end:
        mutex_unlock(&sessions_mutex);
        return ret;
@@ -380,7 +379,7 @@ int lttng_channel_disable(struct lttng_channel *channel)
                goto end;
        }
        /* Set atomically the state to "disabled" */
-       ACCESS_ONCE(channel->enabled) = 0;
+       WRITE_ONCE(channel->enabled, 0);
        /* Set transient enabler state to "enabled" */
        channel->tstate = 0;
        lttng_session_sync_enablers(channel->session);
@@ -410,7 +409,7 @@ int lttng_event_enable(struct lttng_event *event)
        case LTTNG_KERNEL_KPROBE:
        case LTTNG_KERNEL_FUNCTION:
        case LTTNG_KERNEL_NOOP:
-               ACCESS_ONCE(event->enabled) = 1;
+               WRITE_ONCE(event->enabled, 1);
                break;
        case LTTNG_KERNEL_KRETPROBE:
                ret = lttng_kretprobes_event_enable_state(event, 1);
@@ -445,7 +444,7 @@ int lttng_event_disable(struct lttng_event *event)
        case LTTNG_KERNEL_KPROBE:
        case LTTNG_KERNEL_FUNCTION:
        case LTTNG_KERNEL_NOOP:
-               ACCESS_ONCE(event->enabled) = 0;
+               WRITE_ONCE(event->enabled, 0);
                break;
        case LTTNG_KERNEL_KRETPROBE:
                ret = lttng_kretprobes_event_enable_state(event, 0);
@@ -1146,7 +1145,8 @@ static
 int lttng_match_enabler_star_glob(const char *desc_name,
                const char *pattern)
 {
-       if (!strutils_star_glob_match(pattern, -1ULL, desc_name, -1ULL))
+       if (!strutils_star_glob_match(pattern, LTTNG_SIZE_MAX,
+                       desc_name, LTTNG_SIZE_MAX))
                return 0;
        return 1;
 }
@@ -1515,7 +1515,7 @@ void lttng_session_sync_enablers(struct lttng_session *session)
                 */
                enabled = enabled && session->tstate && event->chan->tstate;
 
-               ACCESS_ONCE(event->enabled) = enabled;
+               WRITE_ONCE(event->enabled, enabled);
                /*
                 * Sync tracepoint registration with event enabled
                 * state.
@@ -1641,7 +1641,7 @@ int lttng_metadata_printf(struct lttng_session *session,
        va_list ap;
        struct lttng_metadata_stream *stream;
 
-       WARN_ON_ONCE(!ACCESS_ONCE(session->active));
+       WARN_ON_ONCE(!READ_ONCE(session->active));
 
        va_start(ap, fmt);
        str = kvasprintf(GFP_KERNEL, fmt, ap);
@@ -2048,6 +2048,7 @@ int _lttng_field_statedump(struct lttng_session *session,
                ret = _lttng_enum_statedump(session, field, nesting);
                break;
        case atype_array:
+       case atype_array_bitfield:
        {
                const struct lttng_basic_type *elem_type;
 
@@ -2086,6 +2087,7 @@ int _lttng_field_statedump(struct lttng_session *session,
                break;
        }
        case atype_sequence:
+       case atype_sequence_bitfield:
        {
                const struct lttng_basic_type *elem_type;
                const struct lttng_basic_type *length_type;
@@ -2228,7 +2230,7 @@ int _lttng_event_metadata_statedump(struct lttng_session *session,
 {
        int ret = 0;
 
-       if (event->metadata_dumped || !ACCESS_ONCE(session->active))
+       if (event->metadata_dumped || !READ_ONCE(session->active))
                return 0;
        if (chan->channel_type == METADATA_CHANNEL)
                return 0;
@@ -2295,7 +2297,7 @@ int _lttng_channel_metadata_statedump(struct lttng_session *session,
 {
        int ret = 0;
 
-       if (chan->metadata_dumped || !ACCESS_ONCE(session->active))
+       if (chan->metadata_dumped || !READ_ONCE(session->active))
                return 0;
 
        if (chan->channel_type == METADATA_CHANNEL)
@@ -2452,7 +2454,7 @@ int _lttng_session_metadata_statedump(struct lttng_session *session)
        struct lttng_event *event;
        int ret = 0;
 
-       if (!ACCESS_ONCE(session->active))
+       if (!READ_ONCE(session->active))
                return 0;
        if (session->metadata_dumped)
                goto skip_session;
@@ -2644,7 +2646,7 @@ void lttng_transport_unregister(struct lttng_transport *transport)
 }
 EXPORT_SYMBOL_GPL(lttng_transport_unregister);
 
-#if (defined(CONFIG_HOTPLUG_CPU) && (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0))
 
 enum cpuhp_state lttng_hp_prepare;
 enum cpuhp_state lttng_hp_online;
@@ -2760,7 +2762,7 @@ static void __exit lttng_exit_cpu_hotplug(void)
        cpuhp_remove_multi_state(lttng_hp_prepare);
 }
 
-#else /* #if (CONFIG_HOTPLUG_CPU && (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0))) */
+#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) */
 static int lttng_init_cpu_hotplug(void)
 {
        return 0;
@@ -2768,7 +2770,7 @@ static int lttng_init_cpu_hotplug(void)
 static void lttng_exit_cpu_hotplug(void)
 {
 }
-#endif /* #else #if (CONFIG_HOTPLUG_CPU && (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0))) */
+#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) */
 
 
 static int __init lttng_events_init(void)
This page took 0.026448 seconds and 4 git commands to generate.