#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>
#include <lttng-abi-old.h>
#include <lttng-endian.h>
+#include <lttng-string-utils.h>
#include <wrapper/vzalloc.h>
#include <wrapper/ringbuffer/backend.h>
#include <wrapper/ringbuffer/frontend.h>
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);
err_free_cache:
kfree(metadata_cache);
err_free_session:
- kfree(session);
+ lttng_kvfree(session);
err:
mutex_unlock(&sessions_mutex);
return NULL;
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);
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)
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;
ret = -EBUSY;
goto end;
}
- ACCESS_ONCE(session->active) = 0;
+ WRITE_ONCE(session->active, 0);
/* Set transient enabler state to "disabled" */
session->tstate = 0;
return ret;
}
-
-
int lttng_channel_enable(struct lttng_channel *channel)
{
int ret = 0;
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;
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);
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);
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);
* Enabler management.
*/
static
-int lttng_match_enabler_wildcard(const char *desc_name,
- const char *name)
+int lttng_match_enabler_star_glob(const char *desc_name,
+ const char *pattern)
{
- /* Compare excluding final '*' */
- if (strncmp(desc_name, name, strlen(name) - 1))
+ if (!strutils_star_glob_match(pattern, LTTNG_SIZE_MAX,
+ desc_name, LTTNG_SIZE_MAX))
return 0;
return 1;
}
return -EINVAL;
}
switch (enabler->type) {
- case LTTNG_ENABLER_WILDCARD:
- return lttng_match_enabler_wildcard(desc_name, enabler_name);
+ case LTTNG_ENABLER_STAR_GLOB:
+ return lttng_match_enabler_star_glob(desc_name, enabler_name);
case LTTNG_ENABLER_NAME:
return lttng_match_enabler_name(desc_name, enabler_name);
default:
*/
enabled = enabled && session->tstate && event->chan->tstate;
- ACCESS_ONCE(event->enabled) = enabled;
+ WRITE_ONCE(event->enabled, enabled);
/*
* Sync tracepoint registration with event enabled
* state.
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);
ret = _lttng_enum_statedump(session, field, nesting);
break;
case atype_array:
+ case atype_array_bitfield:
{
const struct lttng_basic_type *elem_type;
break;
}
case atype_sequence:
+ case atype_sequence_bitfield:
{
const struct lttng_basic_type *elem_type;
const struct lttng_basic_type *length_type;
{
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;
{
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)
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;
}
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;
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;
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)