Also removal of old unused commented code.
#define GFP_KERNEL
-/* PRINTK */
-
-#include <stdio.h>
-#define printk(fmt, args...) printf(fmt, ## args)
-
-
/* ATTRIBUTES */
#define ____cacheline_aligned
*
* Places a marker using a standard memory read (_imv_read()) to be
* enabled. Should be used for markers in code paths where instruction
- * modification based enabling is not welcome. (__init and __exit functions,
- * lockdep, some traps, printk).
+ * modification based enabling is not welcome.
*/
#define _trace_mark(channel, name, format, args...) \
__trace_mark(1, channel, name, NULL, format, ## args)
#include <sys/syscall.h>
#include <errno.h>
#include <stdarg.h>
+#include <stdio.h>
#include "share.h"
struct ust_buffer *ltt_buf = channel->buf;
if (local_read(<t_buf->events_lost))
- printk(KERN_ALERT
- "LTT : %s : %ld events lost "
- "in %s channel.\n",
+ ERR("channel %s: %ld events lost",
channel->channel_name,
- local_read(<t_buf->events_lost),
- channel->channel_name);
+ local_read(<t_buf->events_lost));
if (local_read(<t_buf->corrupted_subbuffers))
- printk(KERN_ALERT
- "LTT : %s : %ld corrupted subbuffers "
- "in %s channel.\n",
+ ERR("channel %s : %ld corrupted subbuffers",
channel->channel_name,
- local_read(<t_buf->corrupted_subbuffers),
- channel->channel_name);
+ local_read(<t_buf->corrupted_subbuffers));
ltt_relay_print_errors(trace, channel);
}
/* FIXME: handle error of this call */
result = ust_buffers_channel_open(ltt_chan, subbuf_size, n_subbufs);
if (result == -1) {
- printk(KERN_ERR "LTT : Can't open channel for trace %s\n",
- trace_name);
+ ERR("Cannot open channel for trace %s", trace_name);
goto relay_open_error;
}
ltt_reserve_switch_new_subbuf(channel, buf, &offsets, &tsc);
}
-static void ltt_relay_print_user_errors(struct ltt_trace_struct *trace,
- unsigned int chan_index, size_t data_size,
- struct user_dbg_data *dbg)
-{
- struct ust_channel *channel;
- struct ust_buffer *buf;
-
- channel = &trace->channels[chan_index];
- buf = channel->buf;
-
- printk(KERN_ERR "Error in LTT usertrace : "
- "buffer full : event lost in blocking "
- "mode. Increase LTT_RESERVE_CRITICAL.\n");
- printk(KERN_ERR "LTT nesting level is %u.\n", ltt_nesting);
- printk(KERN_ERR "LTT avail size %lu.\n",
- dbg->avail_size);
- printk(KERN_ERR "avai write : %lu, read : %lu\n",
- dbg->write, dbg->read);
-
- dbg->write = local_read(&buf->offset);
- dbg->read = atomic_long_read(&buf->consumed);
-
- printk(KERN_ERR "LTT cur size %lu.\n",
- dbg->write + LTT_RESERVE_CRITICAL + data_size
- - SUBBUF_TRUNC(dbg->read, channel));
- printk(KERN_ERR "cur write : %lu, read : %lu\n",
- dbg->write, dbg->read);
-}
-
static struct ltt_transport ust_relay_transport = {
.name = "ustrelay",
.ops = {
.wakeup_channel = ltt_relay_async_wakeup_chan,
// .commit_slot = ltt_relay_commit_slot,
.reserve_slot = ltt_relay_reserve_slot,
- .user_errors = ltt_relay_print_user_errors,
},
};
return;
if (!entry->ptype) {
- printk(KERN_DEBUG "Single probe : %p %p\n",
+ DBG("Single probe : %p %p",
entry->single.func,
entry->single.probe_private);
} else {
for (i = 0; entry->multi[i].func; i++)
- printk(KERN_DEBUG "Multi probe %d : %p %p\n", i,
+ DBG("Multi probe %d : %p %p", i,
entry->multi[i].func,
entry->multi[i].probe_private);
}
head = &marker_table[hash & ((1 << MARKER_HASH_BITS)-1)];
hlist_for_each_entry(e, node, head, hlist) {
if (!strcmp(channel, e->channel) && !strcmp(name, e->name)) {
- printk(KERN_NOTICE
- "Marker %s.%s busy\n", channel, name);
+ DBG("Marker %s.%s busy", channel, name);
return ERR_PTR(-EBUSY); /* Already there */
}
}
if (entry->format) {
if (strcmp(entry->format, elem->format) != 0) {
- printk(KERN_NOTICE
- "Format mismatch for probe %s "
- "(%s), marker (%s)\n",
+ DBG("Format mismatch for probe %s (%s), marker (%s)",
entry->name,
entry->format,
elem->format);
}
}
-//ust// asmlinkage long sys_marker(char __user *name, char __user *format,
-//ust// char __user *state, int reg)
+/*
+ * Update current process.
+ * Note that we have to wait a whole scheduler period before we are sure that
+ * every running userspace threads have their markers updated.
+ * (synchronize_sched() can be used to insure this).
+ */
+//ust// void marker_update_process(void)
//ust// {
//ust// struct user_marker *umark;
-//ust// long len;
+//ust// struct hlist_node *pos;
//ust// struct marker_entry *entry;
-//ust// int ret = 0;
//ust//
-//ust// printk(KERN_DEBUG "Program %s %s marker [%p, %p]\n",
-//ust// current->comm, reg ? "registers" : "unregisters",
-//ust// name, state);
-//ust// if (reg) {
-//ust// umark = kmalloc(sizeof(struct user_marker), GFP_KERNEL);
-//ust// umark->name[MAX_USER_MARKER_NAME_LEN - 1] = '\0';
-//ust// umark->format[MAX_USER_MARKER_FORMAT_LEN - 1] = '\0';
-//ust// umark->state = state;
-//ust// len = strncpy_from_user(umark->name, name,
-//ust// MAX_USER_MARKER_NAME_LEN - 1);
-//ust// if (len < 0) {
-//ust// ret = -EFAULT;
-//ust// goto error;
-//ust// }
-//ust// len = strncpy_from_user(umark->format, format,
-//ust// MAX_USER_MARKER_FORMAT_LEN - 1);
-//ust// if (len < 0) {
-//ust// ret = -EFAULT;
-//ust// goto error;
-//ust// }
-//ust// printk(KERN_DEBUG "Marker name : %s, format : %s", umark->name,
-//ust// umark->format);
-//ust// mutex_lock(&markers_mutex);
+//ust// mutex_lock(&markers_mutex);
+//ust// mutex_lock(¤t->group_leader->user_markers_mutex);
+//ust// if (strcmp(current->comm, "testprog") == 0)
+//ust// DBG("do update pending for testprog");
+//ust// hlist_for_each_entry(umark, pos,
+//ust// ¤t->group_leader->user_markers, hlist) {
+//ust// DBG("Updating marker %s in %s", umark->name, current->comm);
//ust// entry = get_marker("userspace", umark->name);
//ust// if (entry) {
//ust// if (entry->format &&
//ust// strcmp(entry->format, umark->format) != 0) {
-//ust// printk(" error, wrong format in process %s",
+//ust// WARN("error, wrong format in process %s",
//ust// current->comm);
-//ust// ret = -EPERM;
-//ust// goto error_unlock;
+//ust// break;
//ust// }
-//ust// printk(" %s", !!entry->refcount
-//ust// ? "enabled" : "disabled");
-//ust// if (put_user(!!entry->refcount, state)) {
-//ust// ret = -EFAULT;
-//ust// goto error_unlock;
+//ust// if (put_user(!!entry->refcount, umark->state)) {
+//ust// WARN("Marker in %s caused a fault",
+//ust// current->comm);
+//ust// break;
//ust// }
-//ust// printk("\n");
//ust// } else {
-//ust// printk(" disabled\n");
//ust// if (put_user(0, umark->state)) {
-//ust// printk(KERN_WARNING
-//ust// "Marker in %s caused a fault\n",
-//ust// current->comm);
-//ust// goto error_unlock;
+//ust// WARN("Marker in %s caused a fault", current->comm);
+//ust// break;
//ust// }
//ust// }
-//ust// mutex_lock(¤t->group_leader->user_markers_mutex);
-//ust// hlist_add_head(&umark->hlist,
-//ust// ¤t->group_leader->user_markers);
-//ust// current->group_leader->user_markers_sequence++;
-//ust// mutex_unlock(¤t->group_leader->user_markers_mutex);
-//ust// mutex_unlock(&markers_mutex);
-//ust// } else {
-//ust// mutex_lock(¤t->group_leader->user_markers_mutex);
-//ust// free_user_marker(state,
-//ust// ¤t->group_leader->user_markers);
-//ust// current->group_leader->user_markers_sequence++;
-//ust// mutex_unlock(¤t->group_leader->user_markers_mutex);
-//ust// }
-//ust// goto end;
-//ust// error_unlock:
-//ust// mutex_unlock(&markers_mutex);
-//ust// error:
-//ust// kfree(umark);
-//ust// end:
-//ust// return ret;
-//ust// }
-//ust//
-//ust// /*
-//ust// * Types :
-//ust// * string : 0
-//ust// */
-//ust// asmlinkage long sys_trace(int type, uint16_t id,
-//ust// char __user *ubuf)
-//ust// {
-//ust// long ret = -EPERM;
-//ust// char *page;
-//ust// int len;
-//ust//
-//ust// switch (type) {
-//ust// case 0: /* String */
-//ust// ret = -ENOMEM;
-//ust// page = (char *)__get_free_page(GFP_TEMPORARY);
-//ust// if (!page)
-//ust// goto string_out;
-//ust// len = strncpy_from_user(page, ubuf, PAGE_SIZE);
-//ust// if (len < 0) {
-//ust// ret = -EFAULT;
-//ust// goto string_err;
-//ust// }
-//ust// trace_mark(userspace, string, "string %s", page);
-//ust// string_err:
-//ust// free_page((unsigned long) page);
-//ust// string_out:
-//ust// break;
-//ust// default:
-//ust// break;
-//ust// }
-//ust// return ret;
-//ust// }
-
-//ust// static void marker_update_processes(void)
-//ust// {
-//ust// struct task_struct *g, *t;
-//ust//
-//ust// /*
-//ust// * markers_mutex is taken to protect the p->user_markers read.
-//ust// */
-//ust// mutex_lock(&markers_mutex);
-//ust// read_lock(&tasklist_lock);
-//ust// for_each_process(g) {
-//ust// WARN_ON(!thread_group_leader(g));
-//ust// if (hlist_empty(&g->user_markers))
-//ust// continue;
-//ust// if (strcmp(g->comm, "testprog") == 0)
-//ust// printk(KERN_DEBUG "set update pending for testprog\n");
-//ust// t = g;
-//ust// do {
-//ust// /* TODO : implement this thread flag in each arch. */
-//ust// set_tsk_thread_flag(t, TIF_MARKER_PENDING);
-//ust// } while ((t = next_thread(t)) != g);
//ust// }
-//ust// read_unlock(&tasklist_lock);
+//ust// clear_thread_flag(TIF_MARKER_PENDING);
+//ust// mutex_unlock(¤t->group_leader->user_markers_mutex);
//ust// mutex_unlock(&markers_mutex);
//ust// }
-/*
- * Update current process.
- * Note that we have to wait a whole scheduler period before we are sure that
- * every running userspace threads have their markers updated.
- * (synchronize_sched() can be used to insure this).
- */
-void marker_update_process(void)
-{
- struct user_marker *umark;
- struct hlist_node *pos;
- struct marker_entry *entry;
-
- mutex_lock(&markers_mutex);
- mutex_lock(¤t->group_leader->user_markers_mutex);
- if (strcmp(current->comm, "testprog") == 0)
- printk(KERN_DEBUG "do update pending for testprog\n");
- hlist_for_each_entry(umark, pos,
- ¤t->group_leader->user_markers, hlist) {
- printk(KERN_DEBUG "Updating marker %s in %s\n",
- umark->name, current->comm);
- entry = get_marker("userspace", umark->name);
- if (entry) {
- if (entry->format &&
- strcmp(entry->format, umark->format) != 0) {
- printk(KERN_WARNING
- " error, wrong format in process %s\n",
- current->comm);
- break;
- }
- if (put_user(!!entry->refcount, umark->state)) {
- printk(KERN_WARNING
- "Marker in %s caused a fault\n",
- current->comm);
- break;
- }
- } else {
- if (put_user(0, umark->state)) {
- printk(KERN_WARNING
- "Marker in %s caused a fault\n",
- current->comm);
- break;
- }
- }
- }
- clear_thread_flag(TIF_MARKER_PENDING);
- mutex_unlock(¤t->group_leader->user_markers_mutex);
- mutex_unlock(&markers_mutex);
-}
-
/*
* Called at process exit and upon do_execve().
* We assume that when the leader exits, no more references can be done to the
WARN("invalid marker name");
goto next_cmd;
}
- printf("%s %s\n", channel_name, marker_name);
result = ltt_marker_connect(channel_name, marker_name, "default");
if(result < 0) {
if(marker_name == NULL) {
}
- printf("%s %s\n", channel_name, marker_name);
result = ltt_marker_disconnect(channel_name, marker_name, "default");
if(result < 0) {
return;
for (i = 0; entry->funcs[i]; i++)
- printk(KERN_DEBUG "Probe %d : %p\n", i, entry->funcs[i]);
+ DBG("Probe %d : %p", i, entry->funcs[i]);
}
static void *
head = &tracepoint_table[hash & (TRACEPOINT_TABLE_SIZE - 1)];
hlist_for_each_entry(e, node, head, hlist) {
if (!strcmp(name, e->name)) {
- printk(KERN_NOTICE
- "tracepoint %s busy\n", name);
+ DBG("tracepoint %s busy", name);
return ERR_PTR(-EEXIST); /* Already there */
}
}
/*
- * ltt/ltt-tracer.c
+ * tracer.c
*
* (C) Copyright 2005-2008 -
* Mathieu Desnoyers (mathieu.desnoyers@polymtl.ca)
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
- * Tracing management internal kernel API. Trace buffer allocation/free, tracing
- * start/stop.
- *
- * Author:
- * Mathieu Desnoyers (mathieu.desnoyers@polymtl.ca)
- *
* Inspired from LTT :
* Karim Yaghmour (karim@opersys.com)
* Tom Zanussi (zanussi@us.ibm.com)
* 27/05/05, Modular redesign and rewrite.
*/
-//ust// #include <linux/time.h>
-//ust// #include <linux/ltt-tracer.h>
-//ust// #include <linux/module.h>
-//ust// #include <linux/string.h>
-//ust// #include <linux/slab.h>
-//ust// #include <linux/init.h>
-//ust// #include <linux/rcupdate.h>
-//ust// #include <linux/sched.h>
-//ust// #include <linux/bitops.h>
-//ust// #include <linux/fs.h>
-//ust// #include <linux/cpu.h>
-//ust// #include <linux/kref.h>
-//ust// #include <linux/delay.h>
-//ust// #include <linux/vmalloc.h>
-//ust// #include <asm/atomic.h>
#include <urcu-bp.h>
#include <urcu/rculist.h>
//ust//
//ust// return ret;
//ust// }
-//ust// EXPORT_SYMBOL_GPL(ltt_module_register);
/**
* ltt_module_unregister - LTT module unregistration
//ust// }
//ust//
//ust// }
-//ust// EXPORT_SYMBOL_GPL(ltt_module_unregister);
static LIST_HEAD(ltt_transport_list);
list_add_tail(&transport->node, <t_transport_list);
ltt_unlock_traces();
}
-//ust// EXPORT_SYMBOL_GPL(ltt_transport_register);
/**
* ltt_transport_unregister - LTT transport unregistration
list_del(&transport->node);
ltt_unlock_traces();
}
-//ust// EXPORT_SYMBOL_GPL(ltt_transport_unregister);
static inline int is_channel_overwrite(enum ltt_channels chan,
enum trace_mode mode)
header->start_freq = trace->start_freq;
header->freq_scale = trace->freq_scale;
}
-//ust// EXPORT_SYMBOL_GPL(ltt_write_trace_header);
static void trace_async_wakeup(struct ltt_trace_struct *trace)
{
return NULL;
}
-//ust// EXPORT_SYMBOL_GPL(_ltt_trace_find_setup);
/**
* ltt_release_transport - Release an LTT transport
//ust// struct ltt_trace_struct, ltt_transport_kref);
//ust// trace->ops->remove_dirs(trace);
}
-//ust// EXPORT_SYMBOL_GPL(ltt_release_transport);
/**
* ltt_release_trace - Release a LTT trace
ltt_channels_trace_free(trace->channels);
kfree(trace);
}
-//ust// EXPORT_SYMBOL_GPL(ltt_release_trace);
static inline void prepare_chan_size_num(unsigned int *subbuf_size,
unsigned int *n_subbufs)
enum ltt_channels chantype;
if (_ltt_trace_find_setup(trace_name)) {
- printk(KERN_ERR "LTT : Trace name %s already used.\n",
- trace_name);
+ ERR("Trace name %s already used", trace_name);
err = -EEXIST;
goto traces_error;
}
if (_ltt_trace_find(trace_name)) {
- printk(KERN_ERR "LTT : Trace name %s already used.\n",
- trace_name);
+ ERR("Trace name %s already used", trace_name);
err = -EEXIST;
goto traces_error;
}
new_trace = kzalloc(sizeof(struct ltt_trace_struct), GFP_KERNEL);
if (!new_trace) {
- printk(KERN_ERR
- "LTT : Unable to allocate memory for trace %s\n",
- trace_name);
+ ERR("Unable to allocate memory for trace %s", trace_name);
err = -ENOMEM;
goto traces_error;
}
new_trace->channels = ltt_channels_trace_alloc(&new_trace->nr_channels,
0, 1);
if (!new_trace->channels) {
- printk(KERN_ERR
- "LTT : Unable to allocate memory for chaninfo %s\n",
- trace_name);
+ ERR("Unable to allocate memory for chaninfo %s\n", trace_name);
err = -ENOMEM;
goto trace_free;
}
traces_error:
return err;
}
-//ust// EXPORT_SYMBOL_GPL(_ltt_trace_setup);
int ltt_trace_setup(const char *trace_name)
ltt_unlock_traces();
return ret;
}
-//ust// EXPORT_SYMBOL_GPL(ltt_trace_setup);
/* must be called from within a traces lock. */
static void _ltt_trace_free(struct ltt_trace_struct *trace)
trace = _ltt_trace_find_setup(trace_name);
if (!trace) {
- printk(KERN_ERR "LTT : Trace not found %s\n", trace_name);
+ ERR("Trace not found %s", trace_name);
err = -ENOENT;
goto traces_error;
}
}
}
if (!transport) {
- printk(KERN_ERR "LTT : Transport %s is not present.\n",
- trace_type);
+ ERR("Transport %s is not present", trace_type);
err = -EINVAL;
goto traces_error;
}
ltt_unlock_traces();
return err;
}
-//ust// EXPORT_SYMBOL_GPL(ltt_trace_set_type);
int ltt_trace_set_channel_subbufsize(const char *trace_name,
const char *channel_name, unsigned int size)
trace = _ltt_trace_find_setup(trace_name);
if (!trace) {
- printk(KERN_ERR "LTT : Trace not found %s\n", trace_name);
+ ERR("Trace not found %s", trace_name);
err = -ENOENT;
goto traces_error;
}
index = ltt_channels_get_index_from_name(channel_name);
if (index < 0) {
- printk(KERN_ERR "LTT : Channel %s not found\n", channel_name);
+ ERR("Channel %s not found", channel_name);
err = -ENOENT;
goto traces_error;
}
ltt_unlock_traces();
return err;
}
-//ust// EXPORT_SYMBOL_GPL(ltt_trace_set_channel_subbufsize);
int ltt_trace_set_channel_subbufcount(const char *trace_name,
const char *channel_name, unsigned int cnt)
trace = _ltt_trace_find_setup(trace_name);
if (!trace) {
- printk(KERN_ERR "LTT : Trace not found %s\n", trace_name);
+ ERR("Trace not found %s", trace_name);
err = -ENOENT;
goto traces_error;
}
index = ltt_channels_get_index_from_name(channel_name);
if (index < 0) {
- printk(KERN_ERR "LTT : Channel %s not found\n", channel_name);
+ ERR("Channel %s not found", channel_name);
err = -ENOENT;
goto traces_error;
}
ltt_unlock_traces();
return err;
}
-//ust// EXPORT_SYMBOL_GPL(ltt_trace_set_channel_subbufcount);
int ltt_trace_set_channel_enable(const char *trace_name,
const char *channel_name, unsigned int enable)
trace = _ltt_trace_find_setup(trace_name);
if (!trace) {
- printk(KERN_ERR "LTT : Trace not found %s\n", trace_name);
+ ERR("Trace not found %s", trace_name);
err = -ENOENT;
goto traces_error;
}
* read the trace, we always enable this channel.
*/
if (!enable && !strcmp(channel_name, "metadata")) {
- printk(KERN_ERR "LTT : Trying to disable metadata channel\n");
+ ERR("Trying to disable metadata channel");
err = -EINVAL;
goto traces_error;
}
index = ltt_channels_get_index_from_name(channel_name);
if (index < 0) {
- printk(KERN_ERR "LTT : Channel %s not found\n", channel_name);
+ ERR("Channel %s not found", channel_name);
err = -ENOENT;
goto traces_error;
}
ltt_unlock_traces();
return err;
}
-//ust// EXPORT_SYMBOL_GPL(ltt_trace_set_channel_enable);
int ltt_trace_set_channel_overwrite(const char *trace_name,
const char *channel_name, unsigned int overwrite)
trace = _ltt_trace_find_setup(trace_name);
if (!trace) {
- printk(KERN_ERR "LTT : Trace not found %s\n", trace_name);
+ ERR("Trace not found %s", trace_name);
err = -ENOENT;
goto traces_error;
}
* able to read the trace.
*/
if (overwrite && !strcmp(channel_name, "metadata")) {
- printk(KERN_ERR "LTT : Trying to set metadata channel to "
- "overwrite mode\n");
+ ERR("Trying to set metadata channel to overwrite mode");
err = -EINVAL;
goto traces_error;
}
index = ltt_channels_get_index_from_name(channel_name);
if (index < 0) {
- printk(KERN_ERR "LTT : Channel %s not found\n", channel_name);
+ ERR("Channel %s not found", channel_name);
err = -ENOENT;
goto traces_error;
}
ltt_unlock_traces();
return err;
}
-//ust// EXPORT_SYMBOL_GPL(ltt_trace_set_channel_overwrite);
int ltt_trace_alloc(const char *trace_name)
{
trace = _ltt_trace_find_setup(trace_name);
if (!trace) {
- printk(KERN_ERR "LTT : Trace not found %s\n", trace_name);
+ ERR("Trace not found %s", trace_name);
err = -ENOENT;
goto traces_error;
}
trace->freq_scale = trace_clock_freq_scale();
if (!trace->transport) {
- printk(KERN_ERR "LTT : Transport is not set.\n");
+ ERR("Transport is not set");
err = -EINVAL;
goto transport_error;
}
//ust// if (!try_module_get(trace->transport->owner)) {
-//ust// printk(KERN_ERR "LTT : Can't lock transport module.\n");
+//ust// ERR("Can't lock transport module");
//ust// err = -ENODEV;
//ust// goto transport_error;
//ust// }
//ust// err = trace->ops->create_dirs(trace);
//ust// if (err) {
-//ust// printk(KERN_ERR "LTT : Can't create dir for trace %s.\n",
-//ust// trace_name);
+//ust// ERR("Can't create dir for trace %s", trace_name);
//ust// goto dirs_error;
//ust// }
subbuf_cnt,
trace->channels[chan].overwrite);
if (err != 0) {
- printk(KERN_ERR "LTT : Can't create channel %s.\n",
- channel_name);
+ ERR("Cannot create channel %s", channel_name);
goto create_channel_error;
}
}
ltt_unlock_traces();
return err;
}
-//ust// EXPORT_SYMBOL_GPL(ltt_trace_alloc);
/*
* It is worked as a wrapper for current version of ltt_control.ko.
goto traces_error;
}
if (trace->active) {
- printk(KERN_ERR
- "LTT : Can't destroy trace %s : tracer is active\n",
- trace->trace_name);
+ ERR("Can't destroy trace %s : tracer is active", trace->trace_name);
err = -EBUSY;
goto active_error;
}
ltt_unlock_traces();
return err;
}
-//ust// EXPORT_SYMBOL_GPL(ltt_trace_destroy);
/* must be called from within a traces lock. */
static int _ltt_trace_start(struct ltt_trace_struct *trace)
goto traces_error;
}
if (trace->active)
- printk(KERN_INFO "LTT : Tracing already active for trace %s\n",
- trace->trace_name);
+ DBG("Tracing already active for trace %s", trace->trace_name);
//ust// if (!try_module_get(ltt_run_filter_owner)) {
//ust// err = -ENODEV;
-//ust// printk(KERN_ERR "LTT : Can't lock filter module.\n");
+//ust// ERR("Cannot lock filter module");
//ust// goto get_ltt_run_filter_error;
//ust// }
trace->active = 1;
//ust// if (!try_module_get(ltt_statedump_owner)) {
//ust// err = -ENODEV;
-//ust// printk(KERN_ERR
-//ust// "LTT : Can't lock state dump module.\n");
+//ust// ERR("Cannot lock state dump module");
//ust// } else {
ltt_statedump_functor(trace);
//ust// module_put(ltt_statedump_owner);
ltt_unlock_traces();
return err;
}
-//ust// EXPORT_SYMBOL_GPL(ltt_trace_start);
/* must be called from within traces lock */
static int _ltt_trace_stop(struct ltt_trace_struct *trace)
goto traces_error;
}
if (!trace->active)
- printk(KERN_INFO "LTT : Tracing not active for trace %s\n",
- trace->trace_name);
+ DBG("LTT : Tracing not active for trace %s", trace->trace_name);
if (trace->active) {
trace->active = 0;
ltt_traces.num_active_traces--;
ltt_unlock_traces();
return err;
}
-//ust// EXPORT_SYMBOL_GPL(ltt_trace_stop);
-
-/**
- * ltt_control - Trace control in-kernel API
- * @msg: Action to perform
- * @trace_name: Trace on which the action must be done
- * @trace_type: Type of trace (normal, flight, hybrid)
- * @args: Arguments specific to the action
- */
-//ust// int ltt_control(enum ltt_control_msg msg, const char *trace_name,
-//ust// const char *trace_type, union ltt_control_args args)
-//ust// {
-//ust// int err = -EPERM;
-//ust//
-//ust// printk(KERN_ALERT "ltt_control : trace %s\n", trace_name);
-//ust// switch (msg) {
-//ust// case LTT_CONTROL_START:
-//ust// printk(KERN_DEBUG "Start tracing %s\n", trace_name);
-//ust// err = ltt_trace_start(trace_name);
-//ust// break;
-//ust// case LTT_CONTROL_STOP:
-//ust// printk(KERN_DEBUG "Stop tracing %s\n", trace_name);
-//ust// err = ltt_trace_stop(trace_name);
-//ust// break;
-//ust// case LTT_CONTROL_CREATE_TRACE:
-//ust// printk(KERN_DEBUG "Creating trace %s\n", trace_name);
-//ust// err = ltt_trace_create(trace_name, trace_type,
-//ust// args.new_trace.mode,
-//ust// args.new_trace.subbuf_size_low,
-//ust// args.new_trace.n_subbufs_low,
-//ust// args.new_trace.subbuf_size_med,
-//ust// args.new_trace.n_subbufs_med,
-//ust// args.new_trace.subbuf_size_high,
-//ust// args.new_trace.n_subbufs_high);
-//ust// break;
-//ust// case LTT_CONTROL_DESTROY_TRACE:
-//ust// printk(KERN_DEBUG "Destroying trace %s\n", trace_name);
-//ust// err = ltt_trace_destroy(trace_name);
-//ust// break;
-//ust// }
-//ust// return err;
-//ust// }
-//ust// EXPORT_SYMBOL_GPL(ltt_control);
/**
* ltt_filter_control - Trace filter control in-kernel API
int err;
struct ltt_trace_struct *trace;
- printk(KERN_DEBUG "ltt_filter_control : trace %s\n", trace_name);
+ DBG("ltt_filter_control : trace %s", trace_name);
ltt_lock_traces();
trace = _ltt_trace_find(trace_name);
if (trace == NULL) {
- printk(KERN_ALERT
- "Trace does not exist. Cannot proxy control request\n");
+ ERR("Trace does not exist. Cannot proxy control request");
err = -ENOENT;
goto trace_error;
}
//ust// }
switch (msg) {
case LTT_FILTER_DEFAULT_ACCEPT:
- printk(KERN_DEBUG
- "Proxy filter default accept %s\n", trace_name);
+ DBG("Proxy filter default accept %s", trace_name);
err = (*ltt_filter_control_functor)(msg, trace);
break;
case LTT_FILTER_DEFAULT_REJECT:
- printk(KERN_DEBUG
- "Proxy filter default reject %s\n", trace_name);
+ DBG("Proxy filter default reject %s", trace_name);
err = (*ltt_filter_control_functor)(msg, trace);
break;
default:
ltt_unlock_traces();
return err;
}
-//ust// EXPORT_SYMBOL_GPL(ltt_filter_control);
-
-//ust// int __init ltt_init(void)
-//ust// {
-//ust// /* Make sure no page fault can be triggered by this module */
-//ust// vmalloc_sync_all();
-//ust// return 0;
-//ust// }
-
-//ust// module_init(ltt_init)
-
-//ust// static void __exit ltt_exit(void)
-//ust// {
-//ust// struct ltt_trace_struct *trace;
-//ust// struct list_head *pos, *n;
-//ust//
-//ust// ltt_lock_traces();
-//ust// /* Stop each trace, currently being read by RCU read-side */
-//ust// list_for_each_entry_rcu(trace, <t_traces.head, list)
-//ust// _ltt_trace_stop(trace);
-//ust// /* Wait for quiescent state. Readers have preemption disabled. */
-//ust// synchronize_sched();
-//ust// /* Safe iteration is now permitted. It does not have to be RCU-safe
-//ust// * because no readers are left. */
-//ust// list_for_each_safe(pos, n, <t_traces.head) {
-//ust// trace = container_of(pos, struct ltt_trace_struct, list);
-//ust// /* _ltt_trace_destroy does a synchronize_sched() */
-//ust// _ltt_trace_destroy(trace);
-//ust// __ltt_trace_destroy(trace);
-//ust// }
-//ust// /* free traces in pre-alloc status */
-//ust// list_for_each_safe(pos, n, <t_traces.setup_head) {
-//ust// trace = container_of(pos, struct ltt_trace_struct, list);
-//ust// _ltt_trace_free(trace);
-//ust// }
-//ust//
-//ust// ltt_unlock_traces();
-//ust// }
-
-//ust// module_exit(ltt_exit)
-
-//ust// MODULE_LICENSE("GPL");
-//ust// MODULE_AUTHOR("Mathieu Desnoyers");
-//ust// MODULE_DESCRIPTION("Linux Trace Toolkit Next Generation Tracer Kernel API");
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-//ust// #include <linux/ltt-core.h>
-//ust// #include <linux/percpu.h>
-//ust// #include <linux/module.h>
-//ust// #include <linux/debugfs.h>
#include <ust/kernelcompat.h>
#include "tracercore.h"
.setup_head = LIST_HEAD_INIT(ltt_traces.setup_head),
.head = LIST_HEAD_INIT(ltt_traces.head),
};
-//ust// EXPORT_SYMBOL(ltt_traces);
/* Traces list writer locking */
static DEFINE_MUTEX(ltt_traces_mutex);
-/* dentry of ltt's root dir */
-//ust// static struct dentry *ltt_root_dentry;
-//ust// struct dentry *get_ltt_root(void)
-//ust// {
-//ust// if (!ltt_root_dentry) {
-//ust// ltt_root_dentry = debugfs_create_dir(LTT_ROOT, NULL);
-//ust// if (!ltt_root_dentry)
-//ust// printk(KERN_ERR "LTT : create ltt root dir failed\n");
-//ust// }
-//ust// return ltt_root_dentry;
-//ust// }
-//ust// EXPORT_SYMBOL_GPL(get_ltt_root);
-
void ltt_lock_traces(void)
{
mutex_lock(<t_traces_mutex);
}
-//ust// EXPORT_SYMBOL_GPL(ltt_lock_traces);
void ltt_unlock_traces(void)
{
mutex_unlock(<t_traces_mutex);
}
-//ust// EXPORT_SYMBOL_GPL(ltt_unlock_traces);
//ust// DEFINE_PER_CPU(unsigned int, ltt_nesting);
//ust// EXPORT_PER_CPU_SYMBOL(ltt_nesting);
/* This function pointer is protected by a trace activation check */
ltt_run_filter_functor ltt_run_filter = ltt_run_filter_default;
-//ust// EXPORT_SYMBOL_GPL(ltt_run_filter);
void ltt_filter_register(ltt_run_filter_functor func)
{
ltt_run_filter = func;
}
-//ust// EXPORT_SYMBOL_GPL(ltt_filter_register);
void ltt_filter_unregister(void)
{
ltt_run_filter = ltt_run_filter_default;
}
-//ust// EXPORT_SYMBOL_GPL(ltt_filter_unregister);