projects
/
lttng-modules.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix: block: don't call blk_status_to_errno in blk_update_request (v5.16)
[lttng-modules.git]
/
src
/
lttng-events.c
diff --git
a/src/lttng-events.c
b/src/lttng-events.c
index 78e50c87c67e015b1df7474cc282524be0a1a2f8..e9b5687198a6cfd56cf6bb537086bb2a8360c0a9 100644
(file)
--- a/
src/lttng-events.c
+++ b/
src/lttng-events.c
@@
-28,6
+28,7
@@
#include <linux/vmalloc.h>
#include <linux/dmi.h>
#include <linux/vmalloc.h>
#include <linux/dmi.h>
+#include <wrapper/compiler_attributes.h>
#include <wrapper/uuid.h>
#include <wrapper/vmalloc.h> /* for wrapper_vmalloc_sync_mappings() */
#include <wrapper/random.h>
#include <wrapper/uuid.h>
#include <wrapper/vmalloc.h> /* for wrapper_vmalloc_sync_mappings() */
#include <wrapper/random.h>
@@
-48,6
+49,12
@@
#include <ringbuffer/frontend.h>
#include <wrapper/time.h>
#include <ringbuffer/frontend.h>
#include <wrapper/time.h>
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,16,0))
+#include <linux/stdarg.h>
+#else
+#include <stdarg.h>
+#endif
+
#define METADATA_CACHE_DEFAULT_SIZE 4096
static LIST_HEAD(sessions);
#define METADATA_CACHE_DEFAULT_SIZE 4096
static LIST_HEAD(sessions);
@@
-70,12
+77,12
@@
static void lttng_event_notifier_enabler_destroy(struct lttng_event_notifier_ena
static void lttng_event_notifier_group_sync_enablers(struct lttng_event_notifier_group *event_notifier_group);
static void _lttng_event_destroy(struct lttng_kernel_event_common *event);
static void lttng_event_notifier_group_sync_enablers(struct lttng_event_notifier_group *event_notifier_group);
static void _lttng_event_destroy(struct lttng_kernel_event_common *event);
-static void _lttng_channel_destroy(struct lttng_
channel
*chan);
-static
int
_lttng_event_unregister(struct lttng_kernel_event_recorder *event);
-static
int
_lttng_event_notifier_unregister(struct lttng_kernel_event_notifier *event_notifier);
+static void _lttng_channel_destroy(struct lttng_
kernel_channel_buffer
*chan);
+static
void
_lttng_event_unregister(struct lttng_kernel_event_recorder *event);
+static
void
_lttng_event_notifier_unregister(struct lttng_kernel_event_notifier *event_notifier);
static
int _lttng_event_metadata_statedump(struct lttng_kernel_session *session,
static
int _lttng_event_metadata_statedump(struct lttng_kernel_session *session,
- struct lttng_
channel
*chan,
+ struct lttng_
kernel_channel_buffer
*chan,
struct lttng_kernel_event_recorder *event);
static
int _lttng_session_metadata_statedump(struct lttng_kernel_session *session);
struct lttng_kernel_event_recorder *event);
static
int _lttng_session_metadata_statedump(struct lttng_kernel_session *session);
@@
-93,7
+100,8
@@
int _lttng_field_statedump(struct lttng_kernel_session *session,
void synchronize_trace(void)
{
void synchronize_trace(void)
{
-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,1,0))
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,1,0) || \
+ LTTNG_RHEL_KERNEL_RANGE(4,18,0,193,0,0, 4,19,0,0,0,0))
synchronize_rcu();
#else
synchronize_sched();
synchronize_rcu();
#else
synchronize_sched();
@@
-350,7
+358,7
@@
void metadata_cache_destroy(struct kref *kref)
void lttng_session_destroy(struct lttng_kernel_session *session)
{
void lttng_session_destroy(struct lttng_kernel_session *session)
{
- struct lttng_
channel *chan, *tmpchan
;
+ struct lttng_
kernel_channel_buffer_private *chan_priv, *tmpchan_priv
;
struct lttng_kernel_event_recorder_private *event_recorder_priv, *tmpevent_recorder_priv;
struct lttng_metadata_stream *metadata_stream;
struct lttng_event_enabler *event_enabler, *tmp_event_enabler;
struct lttng_kernel_event_recorder_private *event_recorder_priv, *tmpevent_recorder_priv;
struct lttng_metadata_stream *metadata_stream;
struct lttng_event_enabler *event_enabler, *tmp_event_enabler;
@@
-358,17
+366,15
@@
void lttng_session_destroy(struct lttng_kernel_session *session)
mutex_lock(&sessions_mutex);
WRITE_ONCE(session->active, 0);
mutex_lock(&sessions_mutex);
WRITE_ONCE(session->active, 0);
- list_for_each_entry(chan, &session->priv->chan, list) {
- ret = lttng_syscalls_unregister_channel(chan);
- WARN_ON(ret);
- }
- list_for_each_entry(event_recorder_priv, &session->priv->events, node) {
- ret = _lttng_event_unregister(event_recorder_priv->pub);
+ list_for_each_entry(chan_priv, &session->priv->chan, node) {
+ ret = lttng_syscalls_unregister_channel(chan_priv->pub);
WARN_ON(ret);
}
WARN_ON(ret);
}
+ list_for_each_entry(event_recorder_priv, &session->priv->events, node)
+ _lttng_event_unregister(event_recorder_priv->pub);
synchronize_trace(); /* Wait for in-flight events to complete */
synchronize_trace(); /* Wait for in-flight events to complete */
- list_for_each_entry(chan
, &session->priv->chan, list
) {
- ret = lttng_syscalls_destroy_event(chan);
+ list_for_each_entry(chan
_priv, &session->priv->chan, node
) {
+ ret = lttng_syscalls_destroy_event(chan
_priv->pub
);
WARN_ON(ret);
}
list_for_each_entry_safe(event_enabler, tmp_event_enabler,
WARN_ON(ret);
}
list_for_each_entry_safe(event_enabler, tmp_event_enabler,
@@
-376,9
+382,9
@@
void lttng_session_destroy(struct lttng_kernel_session *session)
lttng_event_enabler_destroy(event_enabler);
list_for_each_entry_safe(event_recorder_priv, tmpevent_recorder_priv, &session->priv->events, node)
_lttng_event_destroy(&event_recorder_priv->pub->parent);
lttng_event_enabler_destroy(event_enabler);
list_for_each_entry_safe(event_recorder_priv, tmpevent_recorder_priv, &session->priv->events, node)
_lttng_event_destroy(&event_recorder_priv->pub->parent);
- list_for_each_entry_safe(chan
, tmpchan, &session->priv->chan, list
) {
- BUG_ON(chan->channel_type == METADATA_CHANNEL);
- _lttng_channel_destroy(chan);
+ list_for_each_entry_safe(chan
_priv, tmpchan_priv, &session->priv->chan, node
) {
+ BUG_ON(chan
_priv
->channel_type == METADATA_CHANNEL);
+ _lttng_channel_destroy(chan
_priv->pub
);
}
mutex_lock(&session->priv->metadata_cache->lock);
list_for_each_entry(metadata_stream, &session->priv->metadata_cache->metadata_stream, list)
}
mutex_lock(&session->priv->metadata_cache->lock);
list_for_each_entry(metadata_stream, &session->priv->metadata_cache->metadata_stream, list)
@@
-413,10
+419,8
@@
void lttng_event_notifier_group_destroy(
WARN_ON(ret);
list_for_each_entry_safe(event_notifier_priv, tmpevent_notifier_priv,
WARN_ON(ret);
list_for_each_entry_safe(event_notifier_priv, tmpevent_notifier_priv,
- &event_notifier_group->event_notifiers_head, node) {
- ret = _lttng_event_notifier_unregister(event_notifier_priv->pub);
- WARN_ON(ret);
- }
+ &event_notifier_group->event_notifiers_head, node)
+ _lttng_event_notifier_unregister(event_notifier_priv->pub);
/* Wait for in-flight event notifier to complete */
synchronize_trace();
/* Wait for in-flight event notifier to complete */
synchronize_trace();
@@
-463,7
+467,7
@@
int lttng_session_statedump(struct lttng_kernel_session *session)
int lttng_session_enable(struct lttng_kernel_session *session)
{
int ret = 0;
int lttng_session_enable(struct lttng_kernel_session *session)
{
int ret = 0;
- struct lttng_
channel *chan
;
+ struct lttng_
kernel_channel_buffer_private *chan_priv
;
mutex_lock(&sessions_mutex);
if (session->active) {
mutex_lock(&sessions_mutex);
if (session->active) {
@@
-481,19
+485,19
@@
int lttng_session_enable(struct lttng_kernel_session *session)
* Snapshot the number of events per channel to know the type of header
* we need to use.
*/
* Snapshot the number of events per channel to know the type of header
* we need to use.
*/
- list_for_each_entry(chan
, &session->priv->chan, list
) {
- if (chan->header_type)
- continue; /* don't change it if session stop/restart */
- if (chan->free_event_id < 31)
- chan
->header_type = 1;
/* compact */
+ list_for_each_entry(chan
_priv, &session->priv->chan, node
) {
+ if (chan
_priv
->header_type)
+ continue;
/* don't change it if session stop/restart */
+ if (chan
_priv
->free_event_id < 31)
+ chan
_priv->header_type = 1;
/* compact */
else
else
- chan
->header_type = 2;
/* large */
+ chan
_priv->header_type = 2;
/* large */
}
/* Clear each stream's quiescent state. */
}
/* Clear each stream's quiescent state. */
- list_for_each_entry(chan
, &session->priv->chan, list
) {
- if (chan->channel_type != METADATA_CHANNEL)
- lib_ring_buffer_clear_quiescent_channel(chan
->
chan);
+ list_for_each_entry(chan
_priv, &session->priv->chan, node
) {
+ if (chan
_priv
->channel_type != METADATA_CHANNEL)
+ lib_ring_buffer_clear_quiescent_channel(chan
_priv->rb_
chan);
}
WRITE_ONCE(session->active, 1);
}
WRITE_ONCE(session->active, 1);
@@
-514,7
+518,7
@@
end:
int lttng_session_disable(struct lttng_kernel_session *session)
{
int ret = 0;
int lttng_session_disable(struct lttng_kernel_session *session)
{
int ret = 0;
- struct lttng_
channel *chan
;
+ struct lttng_
kernel_channel_buffer_private *chan_priv
;
mutex_lock(&sessions_mutex);
if (!session->active) {
mutex_lock(&sessions_mutex);
if (!session->active) {
@@
-528,9
+532,9
@@
int lttng_session_disable(struct lttng_kernel_session *session)
lttng_session_sync_event_enablers(session);
/* Set each stream's quiescent state. */
lttng_session_sync_event_enablers(session);
/* Set each stream's quiescent state. */
- list_for_each_entry(chan
, &session->priv->chan, list
) {
- if (chan->channel_type != METADATA_CHANNEL)
- lib_ring_buffer_set_quiescent_channel(chan
->
chan);
+ list_for_each_entry(chan
_priv, &session->priv->chan, node
) {
+ if (chan
_priv
->channel_type != METADATA_CHANNEL)
+ lib_ring_buffer_set_quiescent_channel(chan
_priv->rb_
chan);
}
end:
mutex_unlock(&sessions_mutex);
}
end:
mutex_unlock(&sessions_mutex);
@@
-540,7
+544,7
@@
end:
int lttng_session_metadata_regenerate(struct lttng_kernel_session *session)
{
int ret = 0;
int lttng_session_metadata_regenerate(struct lttng_kernel_session *session)
{
int ret = 0;
- struct lttng_
channel *chan
;
+ struct lttng_
kernel_channel_buffer_private *chan_priv
;
struct lttng_kernel_event_recorder_private *event_recorder_priv;
struct lttng_metadata_cache *cache = session->priv->metadata_cache;
struct lttng_metadata_stream *stream;
struct lttng_kernel_event_recorder_private *event_recorder_priv;
struct lttng_metadata_cache *cache = session->priv->metadata_cache;
struct lttng_metadata_stream *stream;
@@
-562,8
+566,8
@@
int lttng_session_metadata_regenerate(struct lttng_kernel_session *session)
mutex_unlock(&cache->lock);
session->priv->metadata_dumped = 0;
mutex_unlock(&cache->lock);
session->priv->metadata_dumped = 0;
- list_for_each_entry(chan
, &session->priv->chan, list
) {
- chan->metadata_dumped = 0;
+ list_for_each_entry(chan
_priv, &session->priv->chan, node
) {
+ chan
_priv
->metadata_dumped = 0;
}
list_for_each_entry(event_recorder_priv, &session->priv->events, node) {
}
list_for_each_entry(event_recorder_priv, &session->priv->events, node) {
@@
-577,47
+581,47
@@
end:
return ret;
}
return ret;
}
-int lttng_channel_enable(struct lttng_
channel
*channel)
+int lttng_channel_enable(struct lttng_
kernel_channel_buffer
*channel)
{
int ret = 0;
mutex_lock(&sessions_mutex);
{
int ret = 0;
mutex_lock(&sessions_mutex);
- if (channel->channel_type == METADATA_CHANNEL) {
+ if (channel->
priv->
channel_type == METADATA_CHANNEL) {
ret = -EPERM;
goto end;
}
ret = -EPERM;
goto end;
}
- if (channel->enabled) {
+ if (channel->
parent.
enabled) {
ret = -EEXIST;
goto end;
}
/* Set transient enabler state to "enabled" */
ret = -EEXIST;
goto end;
}
/* Set transient enabler state to "enabled" */
- channel->tstate = 1;
- lttng_session_sync_event_enablers(channel->session);
+ channel->
priv->parent.
tstate = 1;
+ lttng_session_sync_event_enablers(channel->
parent.
session);
/* Set atomically the state to "enabled" */
/* Set atomically the state to "enabled" */
- WRITE_ONCE(channel->enabled, 1);
+ WRITE_ONCE(channel->
parent.
enabled, 1);
end:
mutex_unlock(&sessions_mutex);
return ret;
}
end:
mutex_unlock(&sessions_mutex);
return ret;
}
-int lttng_channel_disable(struct lttng_
channel
*channel)
+int lttng_channel_disable(struct lttng_
kernel_channel_buffer
*channel)
{
int ret = 0;
mutex_lock(&sessions_mutex);
{
int ret = 0;
mutex_lock(&sessions_mutex);
- if (channel->channel_type == METADATA_CHANNEL) {
+ if (channel->
priv->
channel_type == METADATA_CHANNEL) {
ret = -EPERM;
goto end;
}
ret = -EPERM;
goto end;
}
- if (!channel->enabled) {
+ if (!channel->
parent.
enabled) {
ret = -EEXIST;
goto end;
}
/* Set atomically the state to "disabled" */
ret = -EEXIST;
goto end;
}
/* Set atomically the state to "disabled" */
- WRITE_ONCE(channel->enabled, 0);
+ WRITE_ONCE(channel->
parent.
enabled, 0);
/* Set transient enabler state to "enabled" */
/* Set transient enabler state to "enabled" */
- channel->tstate = 0;
- lttng_session_sync_event_enablers(channel->session);
+ channel->
priv->parent.
tstate = 0;
+ lttng_session_sync_event_enablers(channel->
parent.
session);
end:
mutex_unlock(&sessions_mutex);
return ret;
end:
mutex_unlock(&sessions_mutex);
return ret;
@@
-634,7
+638,7
@@
int lttng_event_enable(struct lttng_kernel_event_common *event)
struct lttng_kernel_event_recorder *event_recorder =
container_of(event, struct lttng_kernel_event_recorder, parent);
struct lttng_kernel_event_recorder *event_recorder =
container_of(event, struct lttng_kernel_event_recorder, parent);
- if (event_recorder->chan->channel_type == METADATA_CHANNEL) {
+ if (event_recorder->chan->
priv->
channel_type == METADATA_CHANNEL) {
ret = -EPERM;
goto end;
}
ret = -EPERM;
goto end;
}
@@
-658,12
+662,14
@@
int lttng_event_enable(struct lttng_kernel_event_common *event)
goto end;
}
switch (event->priv->instrumentation) {
goto end;
}
switch (event->priv->instrumentation) {
- case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */
+ case LTTNG_KERNEL_ABI_TRACEPOINT:
+ lttng_fallthrough;
case LTTNG_KERNEL_ABI_SYSCALL:
ret = -EINVAL;
break;
case LTTNG_KERNEL_ABI_SYSCALL:
ret = -EINVAL;
break;
- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */
+ case LTTNG_KERNEL_ABI_KPROBE:
+ lttng_fallthrough;
case LTTNG_KERNEL_ABI_UPROBE:
WRITE_ONCE(event->enabled, 1);
break;
case LTTNG_KERNEL_ABI_UPROBE:
WRITE_ONCE(event->enabled, 1);
break;
@@
-672,8
+678,10
@@
int lttng_event_enable(struct lttng_kernel_event_common *event)
ret = lttng_kretprobes_event_enable_state(event, 1);
break;
ret = lttng_kretprobes_event_enable_state(event, 1);
break;
- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
+ case LTTNG_KERNEL_ABI_FUNCTION:
+ lttng_fallthrough;
+ case LTTNG_KERNEL_ABI_NOOP:
+ lttng_fallthrough;
default:
WARN_ON_ONCE(1);
ret = -EINVAL;
default:
WARN_ON_ONCE(1);
ret = -EINVAL;
@@
-694,7
+702,7
@@
int lttng_event_disable(struct lttng_kernel_event_common *event)
struct lttng_kernel_event_recorder *event_recorder =
container_of(event, struct lttng_kernel_event_recorder, parent);
struct lttng_kernel_event_recorder *event_recorder =
container_of(event, struct lttng_kernel_event_recorder, parent);
- if (event_recorder->chan->channel_type == METADATA_CHANNEL) {
+ if (event_recorder->chan->
priv->
channel_type == METADATA_CHANNEL) {
ret = -EPERM;
goto end;
}
ret = -EPERM;
goto end;
}
@@
-718,12
+726,14
@@
int lttng_event_disable(struct lttng_kernel_event_common *event)
goto end;
}
switch (event->priv->instrumentation) {
goto end;
}
switch (event->priv->instrumentation) {
- case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */
+ case LTTNG_KERNEL_ABI_TRACEPOINT:
+ lttng_fallthrough;
case LTTNG_KERNEL_ABI_SYSCALL:
ret = -EINVAL;
break;
case LTTNG_KERNEL_ABI_SYSCALL:
ret = -EINVAL;
break;
- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */
+ case LTTNG_KERNEL_ABI_KPROBE:
+ lttng_fallthrough;
case LTTNG_KERNEL_ABI_UPROBE:
WRITE_ONCE(event->enabled, 0);
break;
case LTTNG_KERNEL_ABI_UPROBE:
WRITE_ONCE(event->enabled, 0);
break;
@@
-732,8
+742,10
@@
int lttng_event_disable(struct lttng_kernel_event_common *event)
ret = lttng_kretprobes_event_enable_state(event, 0);
break;
ret = lttng_kretprobes_event_enable_state(event, 0);
break;
- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
+ case LTTNG_KERNEL_ABI_FUNCTION:
+ lttng_fallthrough;
+ case LTTNG_KERNEL_ABI_NOOP:
+ lttng_fallthrough;
default:
WARN_ON_ONCE(1);
ret = -EINVAL;
default:
WARN_ON_ONCE(1);
ret = -EINVAL;
@@
-743,7
+755,7
@@
end:
return ret;
}
return ret;
}
-struct lttng_
channel
*lttng_channel_create(struct lttng_kernel_session *session,
+struct lttng_
kernel_channel_buffer
*lttng_channel_create(struct lttng_kernel_session *session,
const char *transport_name,
void *buf_addr,
size_t subbuf_size, size_t num_subbuf,
const char *transport_name,
void *buf_addr,
size_t subbuf_size, size_t num_subbuf,
@@
-751,7
+763,8
@@
struct lttng_channel *lttng_channel_create(struct lttng_kernel_session *session,
unsigned int read_timer_interval,
enum channel_type channel_type)
{
unsigned int read_timer_interval,
enum channel_type channel_type)
{
- struct lttng_channel *chan;
+ struct lttng_kernel_channel_buffer *chan;
+ struct lttng_kernel_channel_buffer_private *chan_priv;
struct lttng_transport *transport = NULL;
mutex_lock(&sessions_mutex);
struct lttng_transport *transport = NULL;
mutex_lock(&sessions_mutex);
@@
-767,31
+780,39
@@
struct lttng_channel *lttng_channel_create(struct lttng_kernel_session *session,
printk(KERN_WARNING "LTTng: Can't lock transport module.\n");
goto notransport;
}
printk(KERN_WARNING "LTTng: Can't lock transport module.\n");
goto notransport;
}
- chan = kzalloc(sizeof(struct lttng_
channel
), GFP_KERNEL);
+ chan = kzalloc(sizeof(struct lttng_
kernel_channel_buffer
), GFP_KERNEL);
if (!chan)
goto nomem;
if (!chan)
goto nomem;
- chan->session = session;
- chan->id = session->priv->free_chan_id++;
+ chan_priv = kzalloc(sizeof(struct lttng_kernel_channel_buffer_private), GFP_KERNEL);
+ if (!chan_priv)
+ goto nomem_priv;
+ chan->priv = chan_priv;
+ chan_priv->pub = chan;
+ chan->parent.type = LTTNG_KERNEL_CHANNEL_TYPE_BUFFER;
+ chan->parent.session = session;
+ chan->priv->id = session->priv->free_chan_id++;
chan->ops = &transport->ops;
/*
* Note: the channel creation op already writes into the packet
* headers. Therefore the "chan" information used as input
* should be already accessible.
*/
chan->ops = &transport->ops;
/*
* Note: the channel creation op already writes into the packet
* headers. Therefore the "chan" information used as input
* should be already accessible.
*/
- chan->chan = transport->ops.priv->channel_create(transport_name,
+ chan->
priv->rb_
chan = transport->ops.priv->channel_create(transport_name,
chan, buf_addr, subbuf_size, num_subbuf,
switch_timer_interval, read_timer_interval);
chan, buf_addr, subbuf_size, num_subbuf,
switch_timer_interval, read_timer_interval);
- if (!chan->chan)
+ if (!chan->
priv->rb_
chan)
goto create_error;
goto create_error;
- chan->tstate = 1;
- chan->enabled = 1;
- chan->transport = transport;
- chan->channel_type = channel_type;
- list_add(&chan->
list
, &session->priv->chan);
+ chan->
priv->parent.
tstate = 1;
+ chan->
parent.
enabled = 1;
+ chan->
priv->
transport = transport;
+ chan->
priv->
channel_type = channel_type;
+ list_add(&chan->
priv->node
, &session->priv->chan);
mutex_unlock(&sessions_mutex);
return chan;
create_error:
mutex_unlock(&sessions_mutex);
return chan;
create_error:
+ kfree(chan_priv);
+nomem_priv:
kfree(chan);
nomem:
if (transport)
kfree(chan);
nomem:
if (transport)
@@
-808,18
+829,19
@@
active:
* Needs to be called with sessions mutex held.
*/
static
* Needs to be called with sessions mutex held.
*/
static
-void _lttng_channel_destroy(struct lttng_
channel
*chan)
+void _lttng_channel_destroy(struct lttng_
kernel_channel_buffer
*chan)
{
{
- chan->ops->priv->channel_destroy(chan->chan);
- module_put(chan->transport->owner);
- list_del(&chan->list);
- lttng_kernel_destroy_context(chan->ctx);
+ chan->ops->priv->channel_destroy(chan->priv->rb_chan);
+ module_put(chan->priv->transport->owner);
+ list_del(&chan->priv->node);
+ lttng_kernel_destroy_context(chan->priv->ctx);
+ kfree(chan->priv);
kfree(chan);
}
kfree(chan);
}
-void lttng_metadata_channel_destroy(struct lttng_
channel
*chan)
+void lttng_metadata_channel_destroy(struct lttng_
kernel_channel_buffer
*chan)
{
{
- BUG_ON(chan->channel_type != METADATA_CHANNEL);
+ BUG_ON(chan->
priv->
channel_type != METADATA_CHANNEL);
/* Protect the metadata cache with the sessions_mutex. */
mutex_lock(&sessions_mutex);
/* Protect the metadata cache with the sessions_mutex. */
mutex_lock(&sessions_mutex);
@@
-840,19
+862,19
@@
void _lttng_metadata_channel_hangup(struct lttng_metadata_stream *stream)
* Supports event creation while tracing session is active.
* Needs to be called with sessions mutex held.
*/
* Supports event creation while tracing session is active.
* Needs to be called with sessions mutex held.
*/
-struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct lttng_
channel
*chan,
+struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct lttng_
kernel_channel_buffer
*chan,
struct lttng_kernel_abi_event *event_param,
const struct lttng_kernel_event_desc *event_desc,
enum lttng_kernel_abi_instrumentation itype)
{
struct lttng_kernel_abi_event *event_param,
const struct lttng_kernel_event_desc *event_desc,
enum lttng_kernel_abi_instrumentation itype)
{
- struct lttng_kernel_session *session = chan->session;
+ struct lttng_kernel_session *session = chan->
parent.
session;
struct lttng_kernel_event_recorder *event_recorder;
struct lttng_kernel_event_recorder_private *event_recorder_priv;
const char *event_name;
struct hlist_head *head;
int ret;
struct lttng_kernel_event_recorder *event_recorder;
struct lttng_kernel_event_recorder_private *event_recorder_priv;
const char *event_name;
struct hlist_head *head;
int ret;
- if (chan->free_event_id == -1U) {
+ if (chan->
priv->
free_event_id == -1U) {
ret = -EMFILE;
goto full;
}
ret = -EMFILE;
goto full;
}
@@
-862,15
+884,20
@@
struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct l
event_name = event_desc->event_name;
break;
event_name = event_desc->event_name;
break;
- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */
- case LTTNG_KERNEL_ABI_UPROBE: /* Fall-through */
- case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */
+ case LTTNG_KERNEL_ABI_KPROBE:
+ lttng_fallthrough;
+ case LTTNG_KERNEL_ABI_UPROBE:
+ lttng_fallthrough;
+ case LTTNG_KERNEL_ABI_KRETPROBE:
+ lttng_fallthrough;
case LTTNG_KERNEL_ABI_SYSCALL:
event_name = event_param->name;
break;
case LTTNG_KERNEL_ABI_SYSCALL:
event_name = event_param->name;
break;
- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
+ case LTTNG_KERNEL_ABI_FUNCTION:
+ lttng_fallthrough;
+ case LTTNG_KERNEL_ABI_NOOP:
+ lttng_fallthrough;
default:
WARN_ON_ONCE(1);
ret = -EINVAL;
default:
WARN_ON_ONCE(1);
ret = -EINVAL;
@@
-907,7
+934,7
@@
struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct l
event_recorder->parent.run_filter = lttng_kernel_interpret_event_filter;
event_recorder->chan = chan;
event_recorder->parent.run_filter = lttng_kernel_interpret_event_filter;
event_recorder->chan = chan;
- event_recorder->priv->id = chan->free_event_id++;
+ event_recorder->priv->id = chan->
priv->
free_event_id++;
event_recorder->priv->parent.instrumentation = itype;
INIT_LIST_HEAD(&event_recorder->priv->parent.filter_bytecode_runtime_head);
INIT_LIST_HEAD(&event_recorder->priv->parent.enablers_ref_head);
event_recorder->priv->parent.instrumentation = itype;
INIT_LIST_HEAD(&event_recorder->priv->parent.filter_bytecode_runtime_head);
INIT_LIST_HEAD(&event_recorder->priv->parent.enablers_ref_head);
@@
-983,7
+1010,7
@@
struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct l
event_recorder_return->parent.run_filter = lttng_kernel_interpret_event_filter;
event_recorder_return->chan = chan;
event_recorder_return->parent.run_filter = lttng_kernel_interpret_event_filter;
event_recorder_return->chan = chan;
- event_recorder_return->priv->id = chan->free_event_id++;
+ event_recorder_return->priv->id = chan->
priv->
free_event_id++;
event_recorder_return->priv->parent.instrumentation = itype;
event_recorder_return->parent.enabled = 0;
event_recorder_return->priv->parent.registered = 1;
event_recorder_return->priv->parent.instrumentation = itype;
event_recorder_return->parent.enabled = 0;
event_recorder_return->priv->parent.registered = 1;
@@
-1009,7
+1036,7
@@
struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct l
WARN_ON_ONCE(!ret);
ret = try_module_get(event_recorder_return->priv->parent.desc->owner);
WARN_ON_ONCE(!ret);
WARN_ON_ONCE(!ret);
ret = try_module_get(event_recorder_return->priv->parent.desc->owner);
WARN_ON_ONCE(!ret);
- ret = _lttng_event_metadata_statedump(chan->session, chan,
+ ret = _lttng_event_metadata_statedump(chan->
parent.
session, chan,
event_recorder_return);
WARN_ON_ONCE(ret > 0);
if (ret) {
event_recorder_return);
WARN_ON_ONCE(ret > 0);
if (ret) {
@@
-1019,7
+1046,7
@@
struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct l
module_put(event_recorder->priv->parent.desc->owner);
goto statedump_error;
}
module_put(event_recorder->priv->parent.desc->owner);
goto statedump_error;
}
- list_add(&event_recorder_return->priv->node, &chan->session->priv->events);
+ list_add(&event_recorder_return->priv->node, &chan->
parent.
session->priv->events);
break;
}
break;
}
@@
-1082,20
+1109,22
@@
struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct l
WARN_ON_ONCE(!ret);
break;
WARN_ON_ONCE(!ret);
break;
- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
+ case LTTNG_KERNEL_ABI_FUNCTION:
+ lttng_fallthrough;
+ case LTTNG_KERNEL_ABI_NOOP:
+ lttng_fallthrough;
default:
WARN_ON_ONCE(1);
ret = -EINVAL;
goto register_error;
}
default:
WARN_ON_ONCE(1);
ret = -EINVAL;
goto register_error;
}
- ret = _lttng_event_metadata_statedump(chan->session, chan, event_recorder);
+ ret = _lttng_event_metadata_statedump(chan->
parent.
session, chan, event_recorder);
WARN_ON_ONCE(ret > 0);
if (ret) {
goto statedump_error;
}
hlist_add_head(&event_recorder->priv->hlist, head);
WARN_ON_ONCE(ret > 0);
if (ret) {
goto statedump_error;
}
hlist_add_head(&event_recorder->priv->hlist, head);
- list_add(&event_recorder->priv->node, &chan->session->priv->events);
+ list_add(&event_recorder->priv->node, &chan->
parent.
session->priv->events);
return event_recorder;
statedump_error:
return event_recorder;
statedump_error:
@@
-1130,15
+1159,20
@@
struct lttng_kernel_event_notifier *_lttng_event_notifier_create(
event_name = event_desc->event_name;
break;
event_name = event_desc->event_name;
break;
- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */
- case LTTNG_KERNEL_ABI_UPROBE: /* Fall-through */
+ case LTTNG_KERNEL_ABI_KPROBE:
+ lttng_fallthrough;
+ case LTTNG_KERNEL_ABI_UPROBE:
+ lttng_fallthrough;
case LTTNG_KERNEL_ABI_SYSCALL:
event_name = event_notifier_param->event.name;
break;
case LTTNG_KERNEL_ABI_SYSCALL:
event_name = event_notifier_param->event.name;
break;
- case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */
- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
+ case LTTNG_KERNEL_ABI_KRETPROBE:
+ lttng_fallthrough;
+ case LTTNG_KERNEL_ABI_FUNCTION:
+ lttng_fallthrough;
+ case LTTNG_KERNEL_ABI_NOOP:
+ lttng_fallthrough;
default:
WARN_ON_ONCE(1);
ret = -EINVAL;
default:
WARN_ON_ONCE(1);
ret = -EINVAL;
@@
-1285,9
+1319,12
@@
struct lttng_kernel_event_notifier *_lttng_event_notifier_create(
WARN_ON_ONCE(!ret);
break;
WARN_ON_ONCE(!ret);
break;
- case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */
- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
+ case LTTNG_KERNEL_ABI_KRETPROBE:
+ lttng_fallthrough;
+ case LTTNG_KERNEL_ABI_FUNCTION:
+ lttng_fallthrough;
+ case LTTNG_KERNEL_ABI_NOOP:
+ lttng_fallthrough;
default:
WARN_ON_ONCE(1);
ret = -EINVAL;
default:
WARN_ON_ONCE(1);
ret = -EINVAL;
@@
-1360,7
+1397,7
@@
int lttng_kernel_counter_clear(struct lttng_counter *counter,
return counter->ops->counter_clear(counter->counter, dim_indexes);
}
return counter->ops->counter_clear(counter->counter, dim_indexes);
}
-struct lttng_kernel_event_recorder *lttng_kernel_event_recorder_create(struct lttng_
channel
*chan,
+struct lttng_kernel_event_recorder *lttng_kernel_event_recorder_create(struct lttng_
kernel_channel_buffer
*chan,
struct lttng_kernel_abi_event *event_param,
const struct lttng_kernel_event_desc *event_desc,
enum lttng_kernel_abi_instrumentation itype)
struct lttng_kernel_abi_event *event_param,
const struct lttng_kernel_event_desc *event_desc,
enum lttng_kernel_abi_instrumentation itype)
@@
-1397,8
+1434,7
@@
void register_event(struct lttng_kernel_event_recorder *event_recorder)
const struct lttng_kernel_event_desc *desc;
int ret = -EINVAL;
const struct lttng_kernel_event_desc *desc;
int ret = -EINVAL;
- if (event_recorder->priv->parent.registered)
- return;
+ WARN_ON_ONCE(event_recorder->priv->parent.registered);
desc = event_recorder->priv->parent.desc;
switch (event_recorder->priv->parent.instrumentation) {
desc = event_recorder->priv->parent.desc;
switch (event_recorder->priv->parent.instrumentation) {
@@
-1412,14
+1448,18
@@
void register_event(struct lttng_kernel_event_recorder *event_recorder)
ret = lttng_syscall_filter_enable_event(event_recorder->chan, event_recorder);
break;
ret = lttng_syscall_filter_enable_event(event_recorder->chan, event_recorder);
break;
- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */
- case LTTNG_KERNEL_ABI_UPROBE: /* Fall-through */
+ case LTTNG_KERNEL_ABI_KPROBE:
+ lttng_fallthrough;
+ case LTTNG_KERNEL_ABI_UPROBE:
+ lttng_fallthrough;
case LTTNG_KERNEL_ABI_KRETPROBE:
ret = 0;
break;
case LTTNG_KERNEL_ABI_KRETPROBE:
ret = 0;
break;
- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
+ case LTTNG_KERNEL_ABI_FUNCTION:
+ lttng_fallthrough;
+ case LTTNG_KERNEL_ABI_NOOP:
+ lttng_fallthrough;
default:
WARN_ON_ONCE(1);
}
default:
WARN_ON_ONCE(1);
}
@@
-1430,14
+1470,14
@@
void register_event(struct lttng_kernel_event_recorder *event_recorder)
/*
* Only used internally at session destruction.
*/
/*
* Only used internally at session destruction.
*/
-int _lttng_event_unregister(struct lttng_kernel_event_recorder *event_recorder)
+static
+void unregister_event(struct lttng_kernel_event_recorder *event_recorder)
{
struct lttng_kernel_event_common_private *event_priv = &event_recorder->priv->parent;
const struct lttng_kernel_event_desc *desc;
int ret = -EINVAL;
{
struct lttng_kernel_event_common_private *event_priv = &event_recorder->priv->parent;
const struct lttng_kernel_event_desc *desc;
int ret = -EINVAL;
- if (!event_priv->registered)
- return 0;
+ WARN_ON_ONCE(!event_priv->registered);
desc = event_priv->desc;
switch (event_priv->instrumentation) {
desc = event_priv->desc;
switch (event_priv->instrumentation) {
@@
-1470,13
+1510,21
@@
int _lttng_event_unregister(struct lttng_kernel_event_recorder *event_recorder)
ret = 0;
break;
ret = 0;
break;
- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
+ case LTTNG_KERNEL_ABI_FUNCTION:
+ lttng_fallthrough;
default:
WARN_ON_ONCE(1);
}
default:
WARN_ON_ONCE(1);
}
+ WARN_ON_ONCE(ret);
if (!ret)
event_priv->registered = 0;
if (!ret)
event_priv->registered = 0;
- return ret;
+}
+
+static
+void _lttng_event_unregister(struct lttng_kernel_event_recorder *event_recorder)
+{
+ if (event_recorder->priv->parent.registered)
+ unregister_event(event_recorder);
}
/* Only used for tracepoints for now. */
}
/* Only used for tracepoints for now. */
@@
-1486,8
+1534,7
@@
void register_event_notifier(struct lttng_kernel_event_notifier *event_notifier)
const struct lttng_kernel_event_desc *desc;
int ret = -EINVAL;
const struct lttng_kernel_event_desc *desc;
int ret = -EINVAL;
- if (event_notifier->priv->parent.registered)
- return;
+ WARN_ON_ONCE(event_notifier->priv->parent.registered);
desc = event_notifier->priv->parent.desc;
switch (event_notifier->priv->parent.instrumentation) {
desc = event_notifier->priv->parent.desc;
switch (event_notifier->priv->parent.instrumentation) {
@@
-1501,14
+1548,18
@@
void register_event_notifier(struct lttng_kernel_event_notifier *event_notifier)
ret = lttng_syscall_filter_enable_event_notifier(event_notifier);
break;
ret = lttng_syscall_filter_enable_event_notifier(event_notifier);
break;
- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */
+ case LTTNG_KERNEL_ABI_KPROBE:
+ lttng_fallthrough;
case LTTNG_KERNEL_ABI_UPROBE:
ret = 0;
break;
case LTTNG_KERNEL_ABI_UPROBE:
ret = 0;
break;
- case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */
- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
+ case LTTNG_KERNEL_ABI_KRETPROBE:
+ lttng_fallthrough;
+ case LTTNG_KERNEL_ABI_FUNCTION:
+ lttng_fallthrough;
+ case LTTNG_KERNEL_ABI_NOOP:
+ lttng_fallthrough;
default:
WARN_ON_ONCE(1);
}
default:
WARN_ON_ONCE(1);
}
@@
-1517,14
+1568,12
@@
void register_event_notifier(struct lttng_kernel_event_notifier *event_notifier)
}
static
}
static
-int _lttng_event_notifier_unregister(
- struct lttng_kernel_event_notifier *event_notifier)
+int unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier)
{
const struct lttng_kernel_event_desc *desc;
int ret = -EINVAL;
{
const struct lttng_kernel_event_desc *desc;
int ret = -EINVAL;
- if (!event_notifier->priv->parent.registered)
- return 0;
+ WARN_ON_ONCE(!event_notifier->priv->parent.registered);
desc = event_notifier->priv->parent.desc;
switch (event_notifier->priv->parent.instrumentation) {
desc = event_notifier->priv->parent.desc;
switch (event_notifier->priv->parent.instrumentation) {
@@
-1548,9
+1597,12
@@
int _lttng_event_notifier_unregister(
ret = lttng_syscall_filter_disable_event_notifier(event_notifier);
break;
ret = lttng_syscall_filter_disable_event_notifier(event_notifier);
break;
- case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */
- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
+ case LTTNG_KERNEL_ABI_KRETPROBE:
+ lttng_fallthrough;
+ case LTTNG_KERNEL_ABI_FUNCTION:
+ lttng_fallthrough;
+ case LTTNG_KERNEL_ABI_NOOP:
+ lttng_fallthrough;
default:
WARN_ON_ONCE(1);
}
default:
WARN_ON_ONCE(1);
}
@@
-1559,6
+1611,13
@@
int _lttng_event_notifier_unregister(
return ret;
}
return ret;
}
+static
+void _lttng_event_notifier_unregister(struct lttng_kernel_event_notifier *event_notifier)
+{
+ if (event_notifier->priv->parent.registered)
+ unregister_event_notifier(event_notifier);
+}
+
/*
* Only used internally at session destruction.
*/
/*
* Only used internally at session destruction.
*/
@@
-1603,8
+1662,10
@@
void _lttng_event_destroy(struct lttng_kernel_event_common *event)
lttng_uprobes_destroy_event_private(event_recorder);
break;
lttng_uprobes_destroy_event_private(event_recorder);
break;
- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
+ case LTTNG_KERNEL_ABI_FUNCTION:
+ lttng_fallthrough;
+ case LTTNG_KERNEL_ABI_NOOP:
+ lttng_fallthrough;
default:
WARN_ON_ONCE(1);
}
default:
WARN_ON_ONCE(1);
}
@@
-1636,9
+1697,12
@@
void _lttng_event_destroy(struct lttng_kernel_event_common *event)
lttng_uprobes_destroy_event_notifier_private(event_notifier);
break;
lttng_uprobes_destroy_event_notifier_private(event_notifier);
break;
- case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */
- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
+ case LTTNG_KERNEL_ABI_KRETPROBE:
+ lttng_fallthrough;
+ case LTTNG_KERNEL_ABI_FUNCTION:
+ lttng_fallthrough;
+ case LTTNG_KERNEL_ABI_NOOP:
+ lttng_fallthrough;
default:
WARN_ON_ONCE(1);
}
default:
WARN_ON_ONCE(1);
}
@@
-2066,7
+2130,7
@@
struct lttng_enabler_ref *lttng_enabler_ref(
static
void lttng_create_tracepoint_event_if_missing(struct lttng_event_enabler *event_enabler)
{
static
void lttng_create_tracepoint_event_if_missing(struct lttng_event_enabler *event_enabler)
{
- struct lttng_kernel_session *session = event_enabler->chan->session;
+ struct lttng_kernel_session *session = event_enabler->chan->
parent.
session;
struct lttng_kernel_probe_desc *probe_desc;
const struct lttng_kernel_event_desc *desc;
int i;
struct lttng_kernel_probe_desc *probe_desc;
const struct lttng_kernel_event_desc *desc;
int i;
@@
-2226,8
+2290,8
@@
void lttng_create_event_if_missing(struct lttng_event_enabler *event_enabler)
static
int lttng_event_enabler_ref_events(struct lttng_event_enabler *event_enabler)
{
static
int lttng_event_enabler_ref_events(struct lttng_event_enabler *event_enabler)
{
- struct lttng_
channel
*chan = event_enabler->chan;
- struct lttng_kernel_session *session = event_enabler->chan->session;
+ struct lttng_
kernel_channel_buffer
*chan = event_enabler->chan;
+ struct lttng_kernel_session *session = event_enabler->chan->
parent.
session;
struct lttng_enabler *base_enabler = lttng_event_enabler_as_enabler(event_enabler);
struct lttng_kernel_event_recorder_private *event_recorder_priv;
struct lttng_enabler *base_enabler = lttng_event_enabler_as_enabler(event_enabler);
struct lttng_kernel_event_recorder_private *event_recorder_priv;
@@
-2239,10
+2303,10
@@
int lttng_event_enabler_ref_events(struct lttng_event_enabler *event_enabler)
enum lttng_kernel_abi_syscall_entryexit entryexit = base_enabler->event_param.u.syscall.entryexit;
if (entryexit == LTTNG_KERNEL_ABI_SYSCALL_ENTRY || entryexit == LTTNG_KERNEL_ABI_SYSCALL_ENTRYEXIT)
enum lttng_kernel_abi_syscall_entryexit entryexit = base_enabler->event_param.u.syscall.entryexit;
if (entryexit == LTTNG_KERNEL_ABI_SYSCALL_ENTRY || entryexit == LTTNG_KERNEL_ABI_SYSCALL_ENTRYEXIT)
- WRITE_ONCE(chan->syscall_all_entry, enabled);
+ WRITE_ONCE(chan->
priv->parent.
syscall_all_entry, enabled);
if (entryexit == LTTNG_KERNEL_ABI_SYSCALL_EXIT || entryexit == LTTNG_KERNEL_ABI_SYSCALL_ENTRYEXIT)
if (entryexit == LTTNG_KERNEL_ABI_SYSCALL_EXIT || entryexit == LTTNG_KERNEL_ABI_SYSCALL_ENTRYEXIT)
- WRITE_ONCE(chan->syscall_all_exit, enabled);
+ WRITE_ONCE(chan->
priv->parent.
syscall_all_exit, enabled);
}
/* First ensure that probe events are created for this enabler. */
}
/* First ensure that probe events are created for this enabler. */
@@
-2426,7
+2490,7
@@
int lttng_fix_pending_event_notifiers(void)
struct lttng_event_enabler *lttng_event_enabler_create(
enum lttng_enabler_format_type format_type,
struct lttng_kernel_abi_event *event_param,
struct lttng_event_enabler *lttng_event_enabler_create(
enum lttng_enabler_format_type format_type,
struct lttng_kernel_abi_event *event_param,
- struct lttng_
channel
*chan)
+ struct lttng_
kernel_channel_buffer
*chan)
{
struct lttng_event_enabler *event_enabler;
{
struct lttng_event_enabler *event_enabler;
@@
-2441,8
+2505,8
@@
struct lttng_event_enabler *lttng_event_enabler_create(
/* ctx left NULL */
event_enabler->base.enabled = 0;
mutex_lock(&sessions_mutex);
/* ctx left NULL */
event_enabler->base.enabled = 0;
mutex_lock(&sessions_mutex);
- list_add(&event_enabler->node, &event_enabler->chan->session->priv->enablers_head);
- lttng_session_lazy_sync_event_enablers(event_enabler->chan->session);
+ list_add(&event_enabler->node, &event_enabler->chan->
parent.
session->priv->enablers_head);
+ lttng_session_lazy_sync_event_enablers(event_enabler->chan->
parent.
session);
mutex_unlock(&sessions_mutex);
return event_enabler;
}
mutex_unlock(&sessions_mutex);
return event_enabler;
}
@@
-2451,7
+2515,7
@@
int lttng_event_enabler_enable(struct lttng_event_enabler *event_enabler)
{
mutex_lock(&sessions_mutex);
lttng_event_enabler_as_enabler(event_enabler)->enabled = 1;
{
mutex_lock(&sessions_mutex);
lttng_event_enabler_as_enabler(event_enabler)->enabled = 1;
- lttng_session_lazy_sync_event_enablers(event_enabler->chan->session);
+ lttng_session_lazy_sync_event_enablers(event_enabler->chan->
parent.
session);
mutex_unlock(&sessions_mutex);
return 0;
}
mutex_unlock(&sessions_mutex);
return 0;
}
@@
-2460,7
+2524,7
@@
int lttng_event_enabler_disable(struct lttng_event_enabler *event_enabler)
{
mutex_lock(&sessions_mutex);
lttng_event_enabler_as_enabler(event_enabler)->enabled = 0;
{
mutex_lock(&sessions_mutex);
lttng_event_enabler_as_enabler(event_enabler)->enabled = 0;
- lttng_session_lazy_sync_event_enablers(event_enabler->chan->session);
+ lttng_session_lazy_sync_event_enablers(event_enabler->chan->
parent.
session);
mutex_unlock(&sessions_mutex);
return 0;
}
mutex_unlock(&sessions_mutex);
return 0;
}
@@
-2507,7
+2571,7
@@
int lttng_event_enabler_attach_filter_bytecode(struct lttng_event_enabler *event
if (ret)
goto error;
if (ret)
goto error;
- lttng_session_lazy_sync_event_enablers(event_enabler->chan->session);
+ lttng_session_lazy_sync_event_enablers(event_enabler->chan->
parent.
session);
return 0;
error:
return 0;
error:
@@
-2702,7
+2766,8
@@
void lttng_session_sync_event_enablers(struct lttng_kernel_session *session)
int nr_filters = 0;
switch (event_recorder_priv->parent.instrumentation) {
int nr_filters = 0;
switch (event_recorder_priv->parent.instrumentation) {
- case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */
+ case LTTNG_KERNEL_ABI_TRACEPOINT:
+ lttng_fallthrough;
case LTTNG_KERNEL_ABI_SYSCALL:
/* Enable events */
list_for_each_entry(enabler_ref,
case LTTNG_KERNEL_ABI_SYSCALL:
/* Enable events */
list_for_each_entry(enabler_ref,
@@
-2723,7
+2788,7
@@
void lttng_session_sync_event_enablers(struct lttng_kernel_session *session)
* intesection of session and channel transient enable
* states.
*/
* intesection of session and channel transient enable
* states.
*/
- enabled = enabled && session->priv->tstate && event_recorder->chan->tstate;
+ enabled = enabled && session->priv->tstate && event_recorder->chan->
priv->parent.
tstate;
WRITE_ONCE(event_recorder->parent.enabled, enabled);
/*
WRITE_ONCE(event_recorder->parent.enabled, enabled);
/*
@@
-2731,9
+2796,11
@@
void lttng_session_sync_event_enablers(struct lttng_kernel_session *session)
* state.
*/
if (enabled) {
* state.
*/
if (enabled) {
- register_event(event_recorder);
+ if (!event_recorder_priv->parent.registered)
+ register_event(event_recorder);
} else {
} else {
- _lttng_event_unregister(event_recorder);
+ if (event_recorder_priv->parent.registered)
+ _lttng_event_unregister(event_recorder);
}
/* Check if has enablers without bytecode enabled */
}
/* Check if has enablers without bytecode enabled */
@@
-2796,7
+2863,8
@@
void lttng_event_notifier_group_sync_enablers(struct lttng_event_notifier_group
int nr_filters = 0, nr_captures = 0;
switch (event_notifier_priv->parent.instrumentation) {
int nr_filters = 0, nr_captures = 0;
switch (event_notifier_priv->parent.instrumentation) {
- case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */
+ case LTTNG_KERNEL_ABI_TRACEPOINT:
+ lttng_fallthrough;
case LTTNG_KERNEL_ABI_SYSCALL:
/* Enable event_notifiers */
list_for_each_entry(enabler_ref,
case LTTNG_KERNEL_ABI_SYSCALL:
/* Enable event_notifiers */
list_for_each_entry(enabler_ref,
@@
-2823,7
+2891,7
@@
void lttng_event_notifier_group_sync_enablers(struct lttng_event_notifier_group
register_event_notifier(event_notifier);
} else {
if (event_notifier_priv->parent.registered)
register_event_notifier(event_notifier);
} else {
if (event_notifier_priv->parent.registered)
-
_lttng_event_notifier_unregist
er(event_notifier);
+
unregister_event_notifi
er(event_notifier);
}
/* Check if has enablers without bytecode enabled */
}
/* Check if has enablers without bytecode enabled */
@@
-2870,7
+2938,7
@@
void lttng_event_notifier_group_sync_enablers(struct lttng_event_notifier_group
* was written and a negative value on error.
*/
int lttng_metadata_output_channel(struct lttng_metadata_stream *stream,
* was written and a negative value on error.
*/
int lttng_metadata_output_channel(struct lttng_metadata_stream *stream,
- struct channel *chan, bool *coherent)
+ struct
lttng_kernel_ring_buffer_
channel *chan, bool *coherent)
{
struct lttng_kernel_ring_buffer_ctx ctx;
int ret = 0;
{
struct lttng_kernel_ring_buffer_ctx ctx;
int ret = 0;
@@
-2914,7
+2982,7
@@
int lttng_metadata_output_channel(struct lttng_metadata_stream *stream,
}
stream->transport->ops.event_write(&ctx,
stream->metadata_cache->data + stream->metadata_in,
}
stream->transport->ops.event_write(&ctx,
stream->metadata_cache->data + stream->metadata_in,
- reserve_len);
+ reserve_len
, 1
);
stream->transport->ops.event_commit(&ctx);
stream->metadata_in += reserve_len;
if (reserve_len < len)
stream->transport->ops.event_commit(&ctx);
stream->metadata_in += reserve_len;
if (reserve_len < len)
@@
-3627,14
+3695,14
@@
int _lttng_fields_metadata_statedump(struct lttng_kernel_session *session,
*/
static
int _lttng_event_metadata_statedump(struct lttng_kernel_session *session,
*/
static
int _lttng_event_metadata_statedump(struct lttng_kernel_session *session,
- struct lttng_
channel
*chan,
+ struct lttng_
kernel_channel_buffer
*chan,
struct lttng_kernel_event_recorder *event_recorder)
{
int ret = 0;
if (event_recorder->priv->metadata_dumped || !LTTNG_READ_ONCE(session->active))
return 0;
struct lttng_kernel_event_recorder *event_recorder)
{
int ret = 0;
if (event_recorder->priv->metadata_dumped || !LTTNG_READ_ONCE(session->active))
return 0;
- if (chan->channel_type == METADATA_CHANNEL)
+ if (chan->
priv->
channel_type == METADATA_CHANNEL)
return 0;
lttng_metadata_begin(session);
return 0;
lttng_metadata_begin(session);
@@
-3646,7
+3714,7
@@
int _lttng_event_metadata_statedump(struct lttng_kernel_session *session,
" stream_id = %u;\n",
event_recorder->priv->parent.desc->event_name,
event_recorder->priv->id,
" stream_id = %u;\n",
event_recorder->priv->parent.desc->event_name,
event_recorder->priv->id,
- event_recorder->chan->id);
+ event_recorder->chan->
priv->
id);
if (ret)
goto end;
if (ret)
goto end;
@@
-3684,40
+3752,40
@@
end:
*/
static
int _lttng_channel_metadata_statedump(struct lttng_kernel_session *session,
*/
static
int _lttng_channel_metadata_statedump(struct lttng_kernel_session *session,
- struct lttng_
channel
*chan)
+ struct lttng_
kernel_channel_buffer
*chan)
{
int ret = 0;
{
int ret = 0;
- if (chan->metadata_dumped || !LTTNG_READ_ONCE(session->active))
+ if (chan->
priv->
metadata_dumped || !LTTNG_READ_ONCE(session->active))
return 0;
return 0;
- if (chan->channel_type == METADATA_CHANNEL)
+ if (chan->
priv->
channel_type == METADATA_CHANNEL)
return 0;
lttng_metadata_begin(session);
return 0;
lttng_metadata_begin(session);
- WARN_ON_ONCE(!chan->header_type);
+ WARN_ON_ONCE(!chan->
priv->
header_type);
ret = lttng_metadata_printf(session,
"stream {\n"
" id = %u;\n"
" event.header := %s;\n"
" packet.context := struct packet_context;\n",
ret = lttng_metadata_printf(session,
"stream {\n"
" id = %u;\n"
" event.header := %s;\n"
" packet.context := struct packet_context;\n",
- chan->id,
- chan->header_type == 1 ? "struct event_header_compact" :
+ chan->
priv->
id,
+ chan->
priv->
header_type == 1 ? "struct event_header_compact" :
"struct event_header_large");
if (ret)
goto end;
"struct event_header_large");
if (ret)
goto end;
- if (chan->ctx) {
+ if (chan->
priv->
ctx) {
ret = lttng_metadata_printf(session,
" event.context := struct {\n");
if (ret)
goto end;
}
ret = lttng_metadata_printf(session,
" event.context := struct {\n");
if (ret)
goto end;
}
- ret = _lttng_context_metadata_statedump(session, chan->ctx);
+ ret = _lttng_context_metadata_statedump(session, chan->
priv->
ctx);
if (ret)
goto end;
if (ret)
goto end;
- if (chan->ctx) {
+ if (chan->
priv->
ctx) {
ret = lttng_metadata_printf(session,
" };\n");
if (ret)
ret = lttng_metadata_printf(session,
" };\n");
if (ret)
@@
-3727,7
+3795,7
@@
int _lttng_channel_metadata_statedump(struct lttng_kernel_session *session,
ret = lttng_metadata_printf(session,
"};\n\n");
ret = lttng_metadata_printf(session,
"};\n\n");
- chan->metadata_dumped = 1;
+ chan->
priv->
metadata_dumped = 1;
end:
lttng_metadata_end(session);
return ret;
end:
lttng_metadata_end(session);
return ret;
@@
-3866,7
+3934,7
@@
int print_escaped_ctf_string(struct lttng_kernel_session *session, const char *s
if (ret)
goto error;
/* We still print the current char */
if (ret)
goto error;
/* We still print the current char */
- /* Fallthrough */
+ lttng_fallthrough;
default:
ret = lttng_metadata_printf(session, "%c", cur);
break;
default:
ret = lttng_metadata_printf(session, "%c", cur);
break;
@@
-3911,7
+3979,7
@@
int _lttng_session_metadata_statedump(struct lttng_kernel_session *session)
unsigned char *uuid_c = session->priv->uuid.b;
unsigned char uuid_s[37], clock_uuid_s[BOOT_ID_LEN];
const char *product_uuid;
unsigned char *uuid_c = session->priv->uuid.b;
unsigned char uuid_s[37], clock_uuid_s[BOOT_ID_LEN];
const char *product_uuid;
- struct lttng_
channel *chan
;
+ struct lttng_
kernel_channel_buffer_private *chan_priv
;
struct lttng_kernel_event_recorder_private *event_recorder_priv;
int ret = 0;
struct lttng_kernel_event_recorder_private *event_recorder_priv;
int ret = 0;
@@
-4079,8
+4147,8
@@
int _lttng_session_metadata_statedump(struct lttng_kernel_session *session)
goto end;
skip_session:
goto end;
skip_session:
- list_for_each_entry(chan
, &session->priv->chan, list
) {
- ret = _lttng_channel_metadata_statedump(session, chan);
+ list_for_each_entry(chan
_priv, &session->priv->chan, node
) {
+ ret = _lttng_channel_metadata_statedump(session, chan
_priv->pub
);
if (ret)
goto end;
}
if (ret)
goto end;
}
@@
-4285,7
+4353,6
@@
static void lttng_exit_cpu_hotplug(void)
}
#endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0)) */
}
#endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0)) */
-
static int __init lttng_events_init(void)
{
int ret;
static int __init lttng_events_init(void)
{
int ret;
@@
-4353,6
+4420,9
@@
static int __init lttng_events_init(void)
#else
"");
#endif
#else
"");
#endif
+#ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM
+ printk(KERN_NOTICE "LTTng: Experimental bitwise enum enabled.\n");
+#endif /* CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM */
return 0;
error_hotplug:
return 0;
error_hotplug:
This page took
0.043561 seconds
and
4
git commands to generate.