#endif
LTTNG_TRACEPOINT_EVENT(lttng_statedump_start,
- TP_PROTO(struct lttng_session *session),
+ TP_PROTO(struct lttng_kernel_session *session),
TP_ARGS(session),
TP_FIELDS()
)
LTTNG_TRACEPOINT_EVENT(lttng_statedump_end,
- TP_PROTO(struct lttng_session *session),
+ TP_PROTO(struct lttng_kernel_session *session),
TP_ARGS(session),
TP_FIELDS()
)
LTTNG_TRACEPOINT_EVENT(lttng_statedump_process_state,
- TP_PROTO(struct lttng_session *session,
+ TP_PROTO(struct lttng_kernel_session *session,
struct task_struct *p,
int type, int mode, int submode, int status,
struct files_struct *files),
#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,6,0))
LTTNG_TRACEPOINT_EVENT(lttng_statedump_process_cgroup_ns,
- TP_PROTO(struct lttng_session *session,
+ TP_PROTO(struct lttng_kernel_session *session,
struct task_struct *p,
struct cgroup_namespace *cgroup_ns),
TP_ARGS(session, p, cgroup_ns),
#endif
LTTNG_TRACEPOINT_EVENT(lttng_statedump_process_ipc_ns,
- TP_PROTO(struct lttng_session *session,
+ TP_PROTO(struct lttng_kernel_session *session,
struct task_struct *p,
struct ipc_namespace *ipc_ns),
TP_ARGS(session, p, ipc_ns),
#if !defined(LTTNG_MNT_NS_MISSING_HEADER)
LTTNG_TRACEPOINT_EVENT(lttng_statedump_process_mnt_ns,
- TP_PROTO(struct lttng_session *session,
+ TP_PROTO(struct lttng_kernel_session *session,
struct task_struct *p,
struct mnt_namespace *mnt_ns),
TP_ARGS(session, p, mnt_ns),
#endif
LTTNG_TRACEPOINT_EVENT(lttng_statedump_process_net_ns,
- TP_PROTO(struct lttng_session *session,
+ TP_PROTO(struct lttng_kernel_session *session,
struct task_struct *p,
struct net *net_ns),
TP_ARGS(session, p, net_ns),
)
LTTNG_TRACEPOINT_EVENT(lttng_statedump_process_pid_ns,
- TP_PROTO(struct lttng_session *session,
+ TP_PROTO(struct lttng_kernel_session *session,
struct task_struct *p,
struct pid_namespace *pid_ns),
TP_ARGS(session, p, pid_ns),
)
LTTNG_TRACEPOINT_EVENT(lttng_statedump_process_user_ns,
- TP_PROTO(struct lttng_session *session,
+ TP_PROTO(struct lttng_kernel_session *session,
struct task_struct *p,
struct user_namespace *user_ns),
TP_ARGS(session, p, user_ns),
)
LTTNG_TRACEPOINT_EVENT(lttng_statedump_process_uts_ns,
- TP_PROTO(struct lttng_session *session,
+ TP_PROTO(struct lttng_kernel_session *session,
struct task_struct *p,
struct uts_namespace *uts_ns),
TP_ARGS(session, p, uts_ns),
#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,6,0))
LTTNG_TRACEPOINT_EVENT(lttng_statedump_process_time_ns,
- TP_PROTO(struct lttng_session *session,
+ TP_PROTO(struct lttng_kernel_session *session,
struct task_struct *p,
struct time_namespace *time_ns),
TP_ARGS(session, p, time_ns),
#endif
LTTNG_TRACEPOINT_EVENT(lttng_statedump_file_descriptor,
- TP_PROTO(struct lttng_session *session,
+ TP_PROTO(struct lttng_kernel_session *session,
struct files_struct *files,
int fd, const char *filename,
unsigned int flags, fmode_t fmode),
)
LTTNG_TRACEPOINT_EVENT(lttng_statedump_vm_map,
- TP_PROTO(struct lttng_session *session,
+ TP_PROTO(struct lttng_kernel_session *session,
struct task_struct *p, struct vm_area_struct *map,
unsigned long inode),
TP_ARGS(session, p, map, inode),
)
LTTNG_TRACEPOINT_EVENT(lttng_statedump_network_interface,
- TP_PROTO(struct lttng_session *session,
+ TP_PROTO(struct lttng_kernel_session *session,
struct net_device *dev, struct in_ifaddr *ifa),
TP_ARGS(session, dev, ifa),
TP_FIELDS(
)
LTTNG_TRACEPOINT_EVENT(lttng_statedump_block_device,
- TP_PROTO(struct lttng_session *session,
+ TP_PROTO(struct lttng_kernel_session *session,
dev_t dev, const char *diskname),
TP_ARGS(session, dev, diskname),
TP_FIELDS(
/* Called with desc->lock held */
LTTNG_TRACEPOINT_EVENT(lttng_statedump_interrupt,
- TP_PROTO(struct lttng_session *session,
+ TP_PROTO(struct lttng_kernel_session *session,
unsigned int irq, const char *chip_name,
struct irqaction *action),
TP_ARGS(session, irq, chip_name, action),
#define LTTNG_HAVE_STATEDUMP_CPU_TOPOLOGY
LTTNG_TRACEPOINT_EVENT(lttng_statedump_cpu_topology,
- TP_PROTO(struct lttng_session *session, struct cpuinfo_x86 *c),
+ TP_PROTO(struct lttng_kernel_session *session, struct cpuinfo_x86 *c),
TP_ARGS(session, c),
TP_FIELDS(
ctf_string(architecture, "x86")
static struct kmem_cache *event_notifier_cache;
static struct kmem_cache *event_notifier_private_cache;
-static void lttng_session_lazy_sync_event_enablers(struct lttng_session *session);
-static void lttng_session_sync_event_enablers(struct lttng_session *session);
+static void lttng_session_lazy_sync_event_enablers(struct lttng_kernel_session *session);
+static void lttng_session_sync_event_enablers(struct lttng_kernel_session *session);
static void lttng_event_enabler_destroy(struct lttng_event_enabler *event_enabler);
static void lttng_event_notifier_enabler_destroy(struct lttng_event_notifier_enabler *event_notifier_enabler);
static void lttng_event_notifier_group_sync_enablers(struct lttng_event_notifier_group *event_notifier_group);
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
-int _lttng_event_metadata_statedump(struct lttng_session *session,
+int _lttng_event_metadata_statedump(struct lttng_kernel_session *session,
struct lttng_channel *chan,
struct lttng_kernel_event_recorder *event);
static
-int _lttng_session_metadata_statedump(struct lttng_session *session);
+int _lttng_session_metadata_statedump(struct lttng_kernel_session *session);
static
void _lttng_metadata_channel_hangup(struct lttng_metadata_stream *stream);
static
-int _lttng_type_statedump(struct lttng_session *session,
+int _lttng_type_statedump(struct lttng_kernel_session *session,
const struct lttng_kernel_type_common *type,
enum lttng_kernel_string_encoding parent_encoding,
size_t nesting);
static
-int _lttng_field_statedump(struct lttng_session *session,
+int _lttng_field_statedump(struct lttng_kernel_session *session,
const struct lttng_kernel_event_field *field,
size_t nesting, const char **prev_field_name_p);
*/
int lttng_session_active(void)
{
- struct lttng_session *iter;
+ struct lttng_kernel_session_private *iter;
list_for_each_entry(iter, &sessions, list) {
- if (iter->active)
+ if (iter->pub->active)
return 1;
}
return 0;
}
-struct lttng_session *lttng_session_create(void)
+struct lttng_kernel_session *lttng_session_create(void)
{
- struct lttng_session *session;
+ struct lttng_kernel_session *session;
+ struct lttng_kernel_session_private *session_priv;
struct lttng_metadata_cache *metadata_cache;
int i;
mutex_lock(&sessions_mutex);
- session = lttng_kvzalloc(sizeof(struct lttng_session), GFP_KERNEL);
+ session = lttng_kvzalloc(sizeof(*session), GFP_KERNEL);
if (!session)
goto err;
- INIT_LIST_HEAD(&session->chan);
- INIT_LIST_HEAD(&session->events);
- lttng_guid_gen(&session->uuid);
+ session_priv = lttng_kvzalloc(sizeof(*session_priv), GFP_KERNEL);
+ if (!session_priv)
+ goto err_free_session;
+ session->priv = session_priv;
+ session_priv->pub = session;
+
+ INIT_LIST_HEAD(&session_priv->chan);
+ INIT_LIST_HEAD(&session_priv->events);
+ lttng_guid_gen(&session_priv->uuid);
metadata_cache = kzalloc(sizeof(struct lttng_metadata_cache),
GFP_KERNEL);
if (!metadata_cache)
- goto err_free_session;
+ goto err_free_session_private;
metadata_cache->data = vzalloc(METADATA_CACHE_DEFAULT_SIZE);
if (!metadata_cache->data)
goto err_free_cache;
metadata_cache->cache_alloc = METADATA_CACHE_DEFAULT_SIZE;
kref_init(&metadata_cache->refcount);
mutex_init(&metadata_cache->lock);
- session->metadata_cache = metadata_cache;
+ session_priv->metadata_cache = metadata_cache;
INIT_LIST_HEAD(&metadata_cache->metadata_stream);
- memcpy(&metadata_cache->uuid, &session->uuid,
+ memcpy(&metadata_cache->uuid, &session_priv->uuid,
sizeof(metadata_cache->uuid));
- INIT_LIST_HEAD(&session->enablers_head);
+ INIT_LIST_HEAD(&session_priv->enablers_head);
for (i = 0; i < LTTNG_EVENT_HT_SIZE; i++)
- INIT_HLIST_HEAD(&session->events_ht.table[i]);
- list_add(&session->list, &sessions);
+ INIT_HLIST_HEAD(&session_priv->events_ht.table[i]);
+ list_add(&session_priv->list, &sessions);
+
session->pid_tracker.session = session;
session->pid_tracker.tracker_type = TRACKER_PID;
session->vpid_tracker.session = session;
session->vgid_tracker.session = session;
session->vgid_tracker.tracker_type = TRACKER_VGID;
mutex_unlock(&sessions_mutex);
+
return session;
err_free_cache:
kfree(metadata_cache);
+err_free_session_private:
+ lttng_kvfree(session_priv);
err_free_session:
lttng_kvfree(session);
err:
kfree(cache);
}
-void lttng_session_destroy(struct lttng_session *session)
+void lttng_session_destroy(struct lttng_kernel_session *session)
{
struct lttng_channel *chan, *tmpchan;
struct lttng_kernel_event_recorder_private *event_recorder_priv, *tmpevent_recorder_priv;
mutex_lock(&sessions_mutex);
WRITE_ONCE(session->active, 0);
- list_for_each_entry(chan, &session->chan, list) {
+ 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->events, node) {
+ list_for_each_entry(event_recorder_priv, &session->priv->events, node) {
ret = _lttng_event_unregister(event_recorder_priv->pub);
WARN_ON(ret);
}
synchronize_trace(); /* Wait for in-flight events to complete */
- list_for_each_entry(chan, &session->chan, list) {
+ list_for_each_entry(chan, &session->priv->chan, list) {
ret = lttng_syscalls_destroy_event(chan);
WARN_ON(ret);
}
list_for_each_entry_safe(event_enabler, tmp_event_enabler,
- &session->enablers_head, node)
+ &session->priv->enablers_head, node)
lttng_event_enabler_destroy(event_enabler);
- list_for_each_entry_safe(event_recorder_priv, tmpevent_recorder_priv, &session->events, node)
+ 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->chan, list) {
+ list_for_each_entry_safe(chan, tmpchan, &session->priv->chan, list) {
BUG_ON(chan->channel_type == METADATA_CHANNEL);
_lttng_channel_destroy(chan);
}
- mutex_lock(&session->metadata_cache->lock);
- list_for_each_entry(metadata_stream, &session->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)
_lttng_metadata_channel_hangup(metadata_stream);
- mutex_unlock(&session->metadata_cache->lock);
+ mutex_unlock(&session->priv->metadata_cache->lock);
lttng_id_tracker_destroy(&session->pid_tracker, false);
lttng_id_tracker_destroy(&session->vpid_tracker, false);
lttng_id_tracker_destroy(&session->uid_tracker, false);
lttng_id_tracker_destroy(&session->vuid_tracker, false);
lttng_id_tracker_destroy(&session->gid_tracker, false);
lttng_id_tracker_destroy(&session->vgid_tracker, false);
- kref_put(&session->metadata_cache->refcount, metadata_cache_destroy);
- list_del(&session->list);
+ kref_put(&session->priv->metadata_cache->refcount, metadata_cache_destroy);
+ list_del(&session->priv->list);
mutex_unlock(&sessions_mutex);
+ lttng_kvfree(session->priv);
lttng_kvfree(session);
}
lttng_kvfree(event_notifier_group);
}
-int lttng_session_statedump(struct lttng_session *session)
+int lttng_session_statedump(struct lttng_kernel_session *session)
{
int ret;
return ret;
}
-int lttng_session_enable(struct lttng_session *session)
+int lttng_session_enable(struct lttng_kernel_session *session)
{
int ret = 0;
struct lttng_channel *chan;
}
/* Set transient enabler state to "enabled" */
- session->tstate = 1;
+ session->priv->tstate = 1;
/* We need to sync enablers with session before activation. */
lttng_session_sync_event_enablers(session);
* Snapshot the number of events per channel to know the type of header
* we need to use.
*/
- list_for_each_entry(chan, &session->chan, list) {
+ 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)
}
/* Clear each stream's quiescent state. */
- list_for_each_entry(chan, &session->chan, list) {
+ list_for_each_entry(chan, &session->priv->chan, list) {
if (chan->channel_type != METADATA_CHANNEL)
lib_ring_buffer_clear_quiescent_channel(chan->chan);
}
WRITE_ONCE(session->active, 1);
- WRITE_ONCE(session->been_active, 1);
+ WRITE_ONCE(session->priv->been_active, 1);
ret = _lttng_session_metadata_statedump(session);
if (ret) {
WRITE_ONCE(session->active, 0);
return ret;
}
-int lttng_session_disable(struct lttng_session *session)
+int lttng_session_disable(struct lttng_kernel_session *session)
{
int ret = 0;
struct lttng_channel *chan;
WRITE_ONCE(session->active, 0);
/* Set transient enabler state to "disabled" */
- session->tstate = 0;
+ session->priv->tstate = 0;
lttng_session_sync_event_enablers(session);
/* Set each stream's quiescent state. */
- list_for_each_entry(chan, &session->chan, list) {
+ list_for_each_entry(chan, &session->priv->chan, list) {
if (chan->channel_type != METADATA_CHANNEL)
lib_ring_buffer_set_quiescent_channel(chan->chan);
}
return ret;
}
-int lttng_session_metadata_regenerate(struct lttng_session *session)
+int lttng_session_metadata_regenerate(struct lttng_kernel_session *session)
{
int ret = 0;
struct lttng_channel *chan;
struct lttng_kernel_event_recorder_private *event_recorder_priv;
- struct lttng_metadata_cache *cache = session->metadata_cache;
+ struct lttng_metadata_cache *cache = session->priv->metadata_cache;
struct lttng_metadata_stream *stream;
mutex_lock(&sessions_mutex);
memset(cache->data, 0, cache->cache_alloc);
cache->metadata_written = 0;
cache->version++;
- list_for_each_entry(stream, &session->metadata_cache->metadata_stream, list) {
+ list_for_each_entry(stream, &session->priv->metadata_cache->metadata_stream, list) {
stream->metadata_out = 0;
stream->metadata_in = 0;
}
mutex_unlock(&cache->lock);
- session->metadata_dumped = 0;
- list_for_each_entry(chan, &session->chan, list) {
+ session->priv->metadata_dumped = 0;
+ list_for_each_entry(chan, &session->priv->chan, list) {
chan->metadata_dumped = 0;
}
- list_for_each_entry(event_recorder_priv, &session->events, node) {
+ list_for_each_entry(event_recorder_priv, &session->priv->events, node) {
event_recorder_priv->metadata_dumped = 0;
}
return ret;
}
-struct lttng_channel *lttng_channel_create(struct lttng_session *session,
+struct lttng_channel *lttng_channel_create(struct lttng_kernel_session *session,
const char *transport_name,
void *buf_addr,
size_t subbuf_size, size_t num_subbuf,
struct lttng_transport *transport = NULL;
mutex_lock(&sessions_mutex);
- if (session->been_active && channel_type != METADATA_CHANNEL)
+ if (session->priv->been_active && channel_type != METADATA_CHANNEL)
goto active; /* Refuse to add channel to active session */
transport = lttng_transport_find(transport_name);
if (!transport) {
if (!chan)
goto nomem;
chan->session = session;
- chan->id = session->free_chan_id++;
+ chan->id = session->priv->free_chan_id++;
chan->ops = &transport->ops;
/*
* Note: the channel creation op already writes into the packet
chan->enabled = 1;
chan->transport = transport;
chan->channel_type = channel_type;
- list_add(&chan->list, &session->chan);
+ list_add(&chan->list, &session->priv->chan);
mutex_unlock(&sessions_mutex);
return chan;
const struct lttng_kernel_event_desc *event_desc,
enum lttng_kernel_abi_instrumentation itype)
{
- struct lttng_session *session = chan->session;
+ struct lttng_kernel_session *session = chan->session;
struct lttng_kernel_event_recorder *event_recorder;
struct lttng_kernel_event_recorder_private *event_recorder_priv;
const char *event_name;
goto type_error;
}
- head = utils_borrow_hash_table_bucket(session->events_ht.table,
+ head = utils_borrow_hash_table_bucket(session->priv->events_ht.table,
LTTNG_EVENT_HT_SIZE, event_name);
lttng_hlist_for_each_entry(event_recorder_priv, head, hlist) {
WARN_ON_ONCE(!event_recorder_priv->parent.desc);
module_put(event_recorder->priv->parent.desc->owner);
goto statedump_error;
}
- list_add(&event_recorder_return->priv->node, &chan->session->events);
+ list_add(&event_recorder_return->priv->node, &chan->session->priv->events);
break;
}
goto statedump_error;
}
hlist_add_head(&event_recorder->priv->hlist, head);
- list_add(&event_recorder->priv->node, &chan->session->events);
+ list_add(&event_recorder->priv->node, &chan->session->priv->events);
return event_recorder;
statedump_error:
}
}
-struct lttng_id_tracker *get_tracker(struct lttng_session *session,
+struct lttng_id_tracker *get_tracker(struct lttng_kernel_session *session,
enum tracker_type tracker_type)
{
switch (tracker_type) {
}
}
-int lttng_session_track_id(struct lttng_session *session,
+int lttng_session_track_id(struct lttng_kernel_session *session,
enum tracker_type tracker_type, int id)
{
struct lttng_id_tracker *tracker;
return ret;
}
-int lttng_session_untrack_id(struct lttng_session *session,
+int lttng_session_untrack_id(struct lttng_kernel_session *session,
enum tracker_type tracker_type, int id)
{
struct lttng_id_tracker *tracker;
WARN_ON_ONCE(!id_tracker);
ret = seq_release(inode, file);
if (!ret)
- fput(id_tracker->session->file);
+ fput(id_tracker->session->priv->file);
return ret;
}
.release = lttng_tracker_ids_list_release,
};
-int lttng_session_list_tracker_ids(struct lttng_session *session,
+int lttng_session_list_tracker_ids(struct lttng_kernel_session *session,
enum tracker_type tracker_type)
{
struct file *tracker_ids_list_file;
ret = PTR_ERR(tracker_ids_list_file);
goto file_error;
}
- if (!atomic_long_add_unless(&session->file->f_count, 1, LONG_MAX)) {
+ if (!atomic_long_add_unless(&session->priv->file->f_count, 1, LONG_MAX)) {
ret = -EOVERFLOW;
goto refcount_error;
}
return file_fd;
open_error:
- atomic_long_dec(&session->file->f_count);
+ atomic_long_dec(&session->priv->file->f_count);
refcount_error:
fput(tracker_ids_list_file);
file_error:
static
void lttng_create_tracepoint_event_if_missing(struct lttng_event_enabler *event_enabler)
{
- struct lttng_session *session = event_enabler->chan->session;
+ struct lttng_kernel_session *session = event_enabler->chan->session;
struct lttng_kernel_probe_desc *probe_desc;
const struct lttng_kernel_event_desc *desc;
int i;
* Check if already created.
*/
head = utils_borrow_hash_table_bucket(
- session->events_ht.table, LTTNG_EVENT_HT_SIZE,
+ session->priv->events_ht.table, LTTNG_EVENT_HT_SIZE,
desc->event_name);
lttng_hlist_for_each_entry(event_recorder_private, head, hlist) {
if (event_recorder_private->parent.desc == desc
int lttng_event_enabler_ref_events(struct lttng_event_enabler *event_enabler)
{
struct lttng_channel *chan = event_enabler->chan;
- struct lttng_session *session = event_enabler->chan->session;
+ struct lttng_kernel_session *session = event_enabler->chan->session;
struct lttng_enabler *base_enabler = lttng_event_enabler_as_enabler(event_enabler);
struct lttng_kernel_event_recorder_private *event_recorder_priv;
lttng_create_event_if_missing(event_enabler);
/* For each event matching event_enabler in session event list. */
- list_for_each_entry(event_recorder_priv, &session->events, node) {
+ list_for_each_entry(event_recorder_priv, &session->priv->events, node) {
struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
struct lttng_enabler_ref *enabler_ref;
*/
int lttng_fix_pending_events(void)
{
- struct lttng_session *session;
+ struct lttng_kernel_session_private *session_priv;
- list_for_each_entry(session, &sessions, list)
- lttng_session_lazy_sync_event_enablers(session);
+ list_for_each_entry(session_priv, &sessions, list)
+ lttng_session_lazy_sync_event_enablers(session_priv->pub);
return 0;
}
/* ctx left NULL */
event_enabler->base.enabled = 0;
mutex_lock(&sessions_mutex);
- list_add(&event_enabler->node, &event_enabler->chan->session->enablers_head);
+ list_add(&event_enabler->node, &event_enabler->chan->session->priv->enablers_head);
lttng_session_lazy_sync_event_enablers(event_enabler->chan->session);
mutex_unlock(&sessions_mutex);
return event_enabler;
* Should be called with sessions mutex held.
*/
static
-void lttng_session_sync_event_enablers(struct lttng_session *session)
+void lttng_session_sync_event_enablers(struct lttng_kernel_session *session)
{
struct lttng_event_enabler *event_enabler;
struct lttng_kernel_event_recorder_private *event_recorder_priv;
- list_for_each_entry(event_enabler, &session->enablers_head, node)
+ list_for_each_entry(event_enabler, &session->priv->enablers_head, node)
lttng_event_enabler_ref_events(event_enabler);
/*
* For each event, if at least one of its enablers is enabled,
* and its channel and session transient states are enabled, we
* enable the event, else we disable it.
*/
- list_for_each_entry(event_recorder_priv, &session->events, node) {
+ list_for_each_entry(event_recorder_priv, &session->priv->events, node) {
struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
struct lttng_enabler_ref *enabler_ref;
struct lttng_kernel_bytecode_runtime *runtime;
* intesection of session and channel transient enable
* states.
*/
- enabled = enabled && session->tstate && event_recorder->chan->tstate;
+ enabled = enabled && session->priv->tstate && event_recorder->chan->tstate;
WRITE_ONCE(event_recorder->parent.enabled, enabled);
/*
* Should be called with sessions mutex held.
*/
static
-void lttng_session_lazy_sync_event_enablers(struct lttng_session *session)
+void lttng_session_lazy_sync_event_enablers(struct lttng_kernel_session *session)
{
/* We can skip if session is not active */
if (!session->active)
}
static
-void lttng_metadata_begin(struct lttng_session *session)
+void lttng_metadata_begin(struct lttng_kernel_session *session)
{
- if (atomic_inc_return(&session->metadata_cache->producing) == 1)
- mutex_lock(&session->metadata_cache->lock);
+ if (atomic_inc_return(&session->priv->metadata_cache->producing) == 1)
+ mutex_lock(&session->priv->metadata_cache->lock);
}
static
-void lttng_metadata_end(struct lttng_session *session)
+void lttng_metadata_end(struct lttng_kernel_session *session)
{
- WARN_ON_ONCE(!atomic_read(&session->metadata_cache->producing));
- if (atomic_dec_return(&session->metadata_cache->producing) == 0) {
+ WARN_ON_ONCE(!atomic_read(&session->priv->metadata_cache->producing));
+ if (atomic_dec_return(&session->priv->metadata_cache->producing) == 0) {
struct lttng_metadata_stream *stream;
- list_for_each_entry(stream, &session->metadata_cache->metadata_stream, list)
+ list_for_each_entry(stream, &session->priv->metadata_cache->metadata_stream, list)
wake_up_interruptible(&stream->read_wait);
- mutex_unlock(&session->metadata_cache->lock);
+ mutex_unlock(&session->priv->metadata_cache->lock);
}
}
* The content of the printf is printed as a single atomic metadata
* transaction.
*/
-int lttng_metadata_printf(struct lttng_session *session,
+int lttng_metadata_printf(struct lttng_kernel_session *session,
const char *fmt, ...)
{
char *str;
return -ENOMEM;
len = strlen(str);
- WARN_ON_ONCE(!atomic_read(&session->metadata_cache->producing));
- if (session->metadata_cache->metadata_written + len >
- session->metadata_cache->cache_alloc) {
+ WARN_ON_ONCE(!atomic_read(&session->priv->metadata_cache->producing));
+ if (session->priv->metadata_cache->metadata_written + len >
+ session->priv->metadata_cache->cache_alloc) {
char *tmp_cache_realloc;
unsigned int tmp_cache_alloc_size;
tmp_cache_alloc_size = max_t(unsigned int,
- session->metadata_cache->cache_alloc + len,
- session->metadata_cache->cache_alloc << 1);
+ session->priv->metadata_cache->cache_alloc + len,
+ session->priv->metadata_cache->cache_alloc << 1);
tmp_cache_realloc = vzalloc(tmp_cache_alloc_size);
if (!tmp_cache_realloc)
goto err;
- if (session->metadata_cache->data) {
+ if (session->priv->metadata_cache->data) {
memcpy(tmp_cache_realloc,
- session->metadata_cache->data,
- session->metadata_cache->cache_alloc);
- vfree(session->metadata_cache->data);
+ session->priv->metadata_cache->data,
+ session->priv->metadata_cache->cache_alloc);
+ vfree(session->priv->metadata_cache->data);
}
- session->metadata_cache->cache_alloc = tmp_cache_alloc_size;
- session->metadata_cache->data = tmp_cache_realloc;
+ session->priv->metadata_cache->cache_alloc = tmp_cache_alloc_size;
+ session->priv->metadata_cache->data = tmp_cache_realloc;
}
- memcpy(session->metadata_cache->data +
- session->metadata_cache->metadata_written,
+ memcpy(session->priv->metadata_cache->data +
+ session->priv->metadata_cache->metadata_written,
str, len);
- session->metadata_cache->metadata_written += len;
+ session->priv->metadata_cache->metadata_written += len;
kfree(str);
return 0;
}
static
-int print_tabs(struct lttng_session *session, size_t nesting)
+int print_tabs(struct lttng_kernel_session *session, size_t nesting)
{
size_t i;
}
static
-int lttng_field_name_statedump(struct lttng_session *session,
+int lttng_field_name_statedump(struct lttng_kernel_session *session,
const struct lttng_kernel_event_field *field,
size_t nesting)
{
}
static
-int _lttng_integer_type_statedump(struct lttng_session *session,
+int _lttng_integer_type_statedump(struct lttng_kernel_session *session,
const struct lttng_kernel_type_integer *type,
enum lttng_kernel_string_encoding parent_encoding,
size_t nesting)
* Must be called with sessions_mutex held.
*/
static
-int _lttng_struct_type_statedump(struct lttng_session *session,
+int _lttng_struct_type_statedump(struct lttng_kernel_session *session,
const struct lttng_kernel_type_struct *type,
size_t nesting)
{
* Must be called with sessions_mutex held.
*/
static
-int _lttng_struct_field_statedump(struct lttng_session *session,
+int _lttng_struct_field_statedump(struct lttng_kernel_session *session,
const struct lttng_kernel_event_field *field,
size_t nesting)
{
* Must be called with sessions_mutex held.
*/
static
-int _lttng_variant_type_statedump(struct lttng_session *session,
+int _lttng_variant_type_statedump(struct lttng_kernel_session *session,
const struct lttng_kernel_type_variant *type,
size_t nesting,
const char *prev_field_name)
* Must be called with sessions_mutex held.
*/
static
-int _lttng_variant_field_statedump(struct lttng_session *session,
+int _lttng_variant_field_statedump(struct lttng_kernel_session *session,
const struct lttng_kernel_event_field *field,
size_t nesting,
const char *prev_field_name)
* Must be called with sessions_mutex held.
*/
static
-int _lttng_array_field_statedump(struct lttng_session *session,
+int _lttng_array_field_statedump(struct lttng_kernel_session *session,
const struct lttng_kernel_event_field *field,
size_t nesting)
{
* Must be called with sessions_mutex held.
*/
static
-int _lttng_sequence_field_statedump(struct lttng_session *session,
+int _lttng_sequence_field_statedump(struct lttng_kernel_session *session,
const struct lttng_kernel_event_field *field,
size_t nesting,
const char *prev_field_name)
* Must be called with sessions_mutex held.
*/
static
-int _lttng_enum_type_statedump(struct lttng_session *session,
+int _lttng_enum_type_statedump(struct lttng_kernel_session *session,
const struct lttng_kernel_type_enum *type,
size_t nesting)
{
* Must be called with sessions_mutex held.
*/
static
-int _lttng_enum_field_statedump(struct lttng_session *session,
+int _lttng_enum_field_statedump(struct lttng_kernel_session *session,
const struct lttng_kernel_event_field *field,
size_t nesting)
{
}
static
-int _lttng_integer_field_statedump(struct lttng_session *session,
+int _lttng_integer_field_statedump(struct lttng_kernel_session *session,
const struct lttng_kernel_event_field *field,
size_t nesting)
{
}
static
-int _lttng_string_type_statedump(struct lttng_session *session,
+int _lttng_string_type_statedump(struct lttng_kernel_session *session,
const struct lttng_kernel_type_string *type,
size_t nesting)
{
}
static
-int _lttng_string_field_statedump(struct lttng_session *session,
+int _lttng_string_field_statedump(struct lttng_kernel_session *session,
const struct lttng_kernel_event_field *field,
size_t nesting)
{
* Must be called with sessions_mutex held.
*/
static
-int _lttng_type_statedump(struct lttng_session *session,
+int _lttng_type_statedump(struct lttng_kernel_session *session,
const struct lttng_kernel_type_common *type,
enum lttng_kernel_string_encoding parent_encoding,
size_t nesting)
* Must be called with sessions_mutex held.
*/
static
-int _lttng_field_statedump(struct lttng_session *session,
+int _lttng_field_statedump(struct lttng_kernel_session *session,
const struct lttng_kernel_event_field *field,
size_t nesting,
const char **prev_field_name_p)
}
static
-int _lttng_context_metadata_statedump(struct lttng_session *session,
+int _lttng_context_metadata_statedump(struct lttng_kernel_session *session,
struct lttng_kernel_ctx *ctx)
{
const char *prev_field_name = NULL;
}
static
-int _lttng_fields_metadata_statedump(struct lttng_session *session,
+int _lttng_fields_metadata_statedump(struct lttng_kernel_session *session,
struct lttng_kernel_event_recorder *event_recorder)
{
const char *prev_field_name = NULL;
* transaction.
*/
static
-int _lttng_event_metadata_statedump(struct lttng_session *session,
+int _lttng_event_metadata_statedump(struct lttng_kernel_session *session,
struct lttng_channel *chan,
struct lttng_kernel_event_recorder *event_recorder)
{
* transaction.
*/
static
-int _lttng_channel_metadata_statedump(struct lttng_session *session,
+int _lttng_channel_metadata_statedump(struct lttng_kernel_session *session,
struct lttng_channel *chan)
{
int ret = 0;
* Must be called with sessions_mutex held.
*/
static
-int _lttng_stream_packet_context_declare(struct lttng_session *session)
+int _lttng_stream_packet_context_declare(struct lttng_kernel_session *session)
{
return lttng_metadata_printf(session,
"struct packet_context {\n"
* Must be called with sessions_mutex held.
*/
static
-int _lttng_event_header_declare(struct lttng_session *session)
+int _lttng_event_header_declare(struct lttng_kernel_session *session)
{
return lttng_metadata_printf(session,
"struct event_header_compact {\n"
}
static
-int print_escaped_ctf_string(struct lttng_session *session, const char *string)
+int print_escaped_ctf_string(struct lttng_kernel_session *session, const char *string)
{
int ret = 0;
size_t i;
}
static
-int print_metadata_escaped_field(struct lttng_session *session, const char *field,
+int print_metadata_escaped_field(struct lttng_kernel_session *session, const char *field,
const char *field_value)
{
int ret;
* Must be called with sessions_mutex held.
*/
static
-int _lttng_session_metadata_statedump(struct lttng_session *session)
+int _lttng_session_metadata_statedump(struct lttng_kernel_session *session)
{
- unsigned char *uuid_c = session->uuid.b;
+ 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;
lttng_metadata_begin(session);
- if (session->metadata_dumped)
+ if (session->priv->metadata_dumped)
goto skip_session;
snprintf(uuid_s, sizeof(uuid_s),
if (ret)
goto end;
- ret = print_metadata_escaped_field(session, "trace_name", session->name);
+ ret = print_metadata_escaped_field(session, "trace_name", session->priv->name);
if (ret)
goto end;
ret = print_metadata_escaped_field(session, "trace_creation_datetime",
- session->creation_time);
+ session->priv->creation_time);
if (ret)
goto end;
goto end;
skip_session:
- list_for_each_entry(chan, &session->chan, list) {
+ list_for_each_entry(chan, &session->priv->chan, list) {
ret = _lttng_channel_metadata_statedump(session, chan);
if (ret)
goto end;
}
- list_for_each_entry(event_recorder_priv, &session->events, node) {
+ list_for_each_entry(event_recorder_priv, &session->priv->events, node) {
ret = _lttng_event_metadata_statedump(session, event_recorder_priv->pub->chan,
event_recorder_priv->pub);
if (ret)
goto end;
}
- session->metadata_dumped = 1;
+ session->priv->metadata_dumped = 1;
end:
lttng_metadata_end(session);
return ret;
static void __exit lttng_events_exit(void)
{
- struct lttng_session *session, *tmpsession;
+ struct lttng_kernel_session_private *session_priv, *tmpsession_priv;
lttng_exit_cpu_hotplug();
lttng_logger_exit();
lttng_abi_exit();
- list_for_each_entry_safe(session, tmpsession, &sessions, list)
- lttng_session_destroy(session);
+ list_for_each_entry_safe(session_priv, tmpsession_priv, &sessions, list)
+ lttng_session_destroy(session_priv->pub);
kmem_cache_destroy(event_recorder_cache);
kmem_cache_destroy(event_recorder_private_cache);
kmem_cache_destroy(event_notifier_cache);
#include <instrumentation/events/lttng-statedump.h>
LTTNG_DEFINE_TRACE(lttng_statedump_block_device,
- TP_PROTO(struct lttng_session *session,
+ TP_PROTO(struct lttng_kernel_session *session,
dev_t dev, const char *diskname),
TP_ARGS(session, dev, diskname));
LTTNG_DEFINE_TRACE(lttng_statedump_end,
- TP_PROTO(struct lttng_session *session),
+ TP_PROTO(struct lttng_kernel_session *session),
TP_ARGS(session));
LTTNG_DEFINE_TRACE(lttng_statedump_interrupt,
- TP_PROTO(struct lttng_session *session,
+ TP_PROTO(struct lttng_kernel_session *session,
unsigned int irq, const char *chip_name,
struct irqaction *action),
TP_ARGS(session, irq, chip_name, action));
LTTNG_DEFINE_TRACE(lttng_statedump_file_descriptor,
- TP_PROTO(struct lttng_session *session,
+ TP_PROTO(struct lttng_kernel_session *session,
struct files_struct *files,
int fd, const char *filename,
unsigned int flags, fmode_t fmode),
TP_ARGS(session, files, fd, filename, flags, fmode));
LTTNG_DEFINE_TRACE(lttng_statedump_start,
- TP_PROTO(struct lttng_session *session),
+ TP_PROTO(struct lttng_kernel_session *session),
TP_ARGS(session));
LTTNG_DEFINE_TRACE(lttng_statedump_process_state,
- TP_PROTO(struct lttng_session *session,
+ TP_PROTO(struct lttng_kernel_session *session,
struct task_struct *p,
int type, int mode, int submode, int status,
struct files_struct *files),
TP_ARGS(session, p, type, mode, submode, status, files));
LTTNG_DEFINE_TRACE(lttng_statedump_process_pid_ns,
- TP_PROTO(struct lttng_session *session,
+ TP_PROTO(struct lttng_kernel_session *session,
struct task_struct *p,
struct pid_namespace *pid_ns),
TP_ARGS(session, p, pid_ns));
#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,6,0))
LTTNG_DEFINE_TRACE(lttng_statedump_process_cgroup_ns,
- TP_PROTO(struct lttng_session *session,
+ TP_PROTO(struct lttng_kernel_session *session,
struct task_struct *p,
struct cgroup_namespace *cgroup_ns),
TP_ARGS(session, p, cgroup_ns));
#endif
LTTNG_DEFINE_TRACE(lttng_statedump_process_ipc_ns,
- TP_PROTO(struct lttng_session *session,
+ TP_PROTO(struct lttng_kernel_session *session,
struct task_struct *p,
struct ipc_namespace *ipc_ns),
TP_ARGS(session, p, ipc_ns));
#ifndef LTTNG_MNT_NS_MISSING_HEADER
LTTNG_DEFINE_TRACE(lttng_statedump_process_mnt_ns,
- TP_PROTO(struct lttng_session *session,
+ TP_PROTO(struct lttng_kernel_session *session,
struct task_struct *p,
struct mnt_namespace *mnt_ns),
TP_ARGS(session, p, mnt_ns));
#endif
LTTNG_DEFINE_TRACE(lttng_statedump_process_net_ns,
- TP_PROTO(struct lttng_session *session,
+ TP_PROTO(struct lttng_kernel_session *session,
struct task_struct *p,
struct net *net_ns),
TP_ARGS(session, p, net_ns));
LTTNG_DEFINE_TRACE(lttng_statedump_process_user_ns,
- TP_PROTO(struct lttng_session *session,
+ TP_PROTO(struct lttng_kernel_session *session,
struct task_struct *p,
struct user_namespace *user_ns),
TP_ARGS(session, p, user_ns));
LTTNG_DEFINE_TRACE(lttng_statedump_process_uts_ns,
- TP_PROTO(struct lttng_session *session,
+ TP_PROTO(struct lttng_kernel_session *session,
struct task_struct *p,
struct uts_namespace *uts_ns),
TP_ARGS(session, p, uts_ns));
LTTNG_DEFINE_TRACE(lttng_statedump_process_time_ns,
- TP_PROTO(struct lttng_session *session,
+ TP_PROTO(struct lttng_kernel_session *session,
struct task_struct *p,
struct time_namespace *time_ns),
TP_ARGS(session, p, time_ns));
LTTNG_DEFINE_TRACE(lttng_statedump_network_interface,
- TP_PROTO(struct lttng_session *session,
+ TP_PROTO(struct lttng_kernel_session *session,
struct net_device *dev, struct in_ifaddr *ifa),
TP_ARGS(session, dev, ifa));
#ifdef LTTNG_HAVE_STATEDUMP_CPU_TOPOLOGY
LTTNG_DEFINE_TRACE(lttng_statedump_cpu_topology,
- TP_PROTO(struct lttng_session *session, struct cpuinfo_x86 *c),
+ TP_PROTO(struct lttng_kernel_session *session, struct cpuinfo_x86 *c),
TP_ARGS(session, c));
#endif
struct lttng_fd_ctx {
char *page;
- struct lttng_session *session;
+ struct lttng_kernel_session *session;
struct files_struct *files;
};
#endif
static
-int lttng_enumerate_block_devices(struct lttng_session *session)
+int lttng_enumerate_block_devices(struct lttng_kernel_session *session)
{
struct class *ptr_block_class;
struct device_type *ptr_disk_type;
#ifdef CONFIG_INET
static
-void lttng_enumerate_device(struct lttng_session *session,
+void lttng_enumerate_device(struct lttng_kernel_session *session,
struct net_device *dev)
{
struct in_device *in_dev;
}
static
-int lttng_enumerate_network_ip_interface(struct lttng_session *session)
+int lttng_enumerate_network_ip_interface(struct lttng_kernel_session *session)
{
struct net_device *dev;
}
#else /* CONFIG_INET */
static inline
-int lttng_enumerate_network_ip_interface(struct lttng_session *session)
+int lttng_enumerate_network_ip_interface(struct lttng_kernel_session *session)
{
return 0;
}
/* Called with task lock held. */
static
-void lttng_enumerate_files(struct lttng_session *session,
+void lttng_enumerate_files(struct lttng_kernel_session *session,
struct files_struct *files,
char *tmp)
{
#ifdef LTTNG_HAVE_STATEDUMP_CPU_TOPOLOGY
static
-int lttng_enumerate_cpu_topology(struct lttng_session *session)
+int lttng_enumerate_cpu_topology(struct lttng_kernel_session *session)
{
int cpu;
const cpumask_t *cpumask = cpu_possible_mask;
}
#else
static
-int lttng_enumerate_cpu_topology(struct lttng_session *session)
+int lttng_enumerate_cpu_topology(struct lttng_kernel_session *session)
{
return 0;
}
* iteration, but it is not exported to modules.
*/
static
-void lttng_enumerate_task_vm_maps(struct lttng_session *session,
+void lttng_enumerate_task_vm_maps(struct lttng_kernel_session *session,
struct task_struct *p)
{
struct mm_struct *mm;
}
static
-int lttng_enumerate_vm_maps(struct lttng_session *session)
+int lttng_enumerate_vm_maps(struct lttng_kernel_session *session)
{
struct task_struct *p;
#ifdef CONFIG_LTTNG_HAS_LIST_IRQ
static
-int lttng_list_interrupts(struct lttng_session *session)
+int lttng_list_interrupts(struct lttng_kernel_session *session)
{
unsigned int irq;
unsigned long flags = 0;
}
#else
static inline
-int lttng_list_interrupts(struct lttng_session *session)
+int lttng_list_interrupts(struct lttng_kernel_session *session)
{
return 0;
}
* Called with task lock held.
*/
static
-void lttng_statedump_process_ns(struct lttng_session *session,
+void lttng_statedump_process_ns(struct lttng_kernel_session *session,
struct task_struct *p,
enum lttng_thread_type type,
enum lttng_execution_mode mode,
}
static
-int lttng_enumerate_process_states(struct lttng_session *session)
+int lttng_enumerate_process_states(struct lttng_kernel_session *session)
{
struct task_struct *g, *p;
char *tmp;
}
static
-int do_lttng_statedump(struct lttng_session *session)
+int do_lttng_statedump(struct lttng_kernel_session *session)
{
int cpu, ret;
/*
* Called with session mutex held.
*/
-int lttng_statedump_start(struct lttng_session *session)
+int lttng_statedump_start(struct lttng_kernel_session *session)
{
return do_lttng_statedump(session);
}