void lock_markers(void)
{
- mutex_lock(&markers_mutex);
+ pthread_mutex_lock(&markers_mutex);
}
void unlock_markers(void)
{
- mutex_unlock(&markers_mutex);
+ pthread_mutex_unlock(&markers_mutex);
}
/*
static void free_old_closure(struct rcu_head *head)
{
- struct marker_entry *entry = container_of(head,
+ struct marker_entry *entry = _ust_container_of(head,
struct marker_entry, rcu);
free(entry->oldptr);
/* Make sure we free the data before setting the pending flag to 0 */
}
}
/*
- * Using malloc here to allocate a variable length element. Could
+ * Using zmalloc here to allocate a variable length element. Could
* cause some memory fragmentation if overused.
*/
- e = malloc(sizeof(struct marker_entry)
+ e = zmalloc(sizeof(struct marker_entry)
+ channel_len + name_len + format_len);
if (!e)
return ERR_PTR(-ENOMEM);
e->name = &e->channel[channel_len];
memcpy(e->name, name, name_len);
if (format) {
- e->format = &e->name[channel_len + name_len];
+ e->format = &e->name[name_len];
memcpy(e->format, format, format_len);
if (strcmp(e->format, MARK_NOARGS) == 0)
e->call = marker_probe_cb_noarg;
if (entry->format) {
if (strcmp(entry->format, elem->format) != 0) {
- DBG("Format mismatch for probe %s (%s), marker (%s)",
+ ERR("Format mismatch for probe %s (%s), marker (%s)",
entry->name,
entry->format,
elem->format);
//ust// BUG_ON(!ret);
ret = tracepoint_probe_register_noupdate(
elem->tp_name,
- elem->tp_cb);
+ elem->tp_cb, NULL);
} else {
ret = tracepoint_probe_unregister_noupdate(
elem->tp_name,
- elem->tp_cb);
+ elem->tp_cb, NULL);
/*
* tracepoint_probe_update_all() must be called
* before the module containing tp_cb is unloaded.
* checking has been done in the __trace_mark_tp() macro.
*/
ret = tracepoint_probe_unregister_noupdate(elem->tp_name,
- elem->tp_cb);
+ elem->tp_cb, NULL);
WARN_ON(ret);
/*
* tracepoint_probe_update_all() must be called
{
struct marker_entry *entry;
- mutex_lock(&markers_mutex);
+ pthread_mutex_lock(&markers_mutex);
entry = get_marker(channel, name);
- mutex_unlock(&markers_mutex);
+ pthread_mutex_unlock(&markers_mutex);
return entry && !!entry->refcount;
}
struct marker *iter;
struct marker_entry *mark_entry;
- mutex_lock(&markers_mutex);
+ pthread_mutex_lock(&markers_mutex);
for (iter = begin; iter < end; iter++) {
mark_entry = get_marker(iter->channel, iter->name);
if (mark_entry) {
disable_marker(iter);
}
}
- mutex_unlock(&markers_mutex);
+ pthread_mutex_unlock(&markers_mutex);
}
static void lib_update_markers(void)
struct lib *lib;
/* FIXME: we should probably take a mutex here on libs */
-//ust// mutex_lock(&module_mutex);
+//ust// pthread_mutex_lock(&module_mutex);
list_for_each_entry(lib, &libs, list)
marker_update_probe_range(lib->markers_start,
lib->markers_start + lib->markers_count);
-//ust// mutex_unlock(&module_mutex);
+//ust// pthread_mutex_unlock(&module_mutex);
}
/*
struct marker_probe_closure *old;
int first_probe = 0;
- mutex_lock(&markers_mutex);
+ pthread_mutex_lock(&markers_mutex);
entry = get_marker(channel, name);
if (!entry) {
first_probe = 1;
else
goto end;
}
- mutex_unlock(&markers_mutex);
+ pthread_mutex_unlock(&markers_mutex);
/* Activate marker if necessary */
marker_update_probes();
- mutex_lock(&markers_mutex);
+ pthread_mutex_lock(&markers_mutex);
entry = get_marker(channel, name);
if (!entry)
goto end;
ret_err = remove_marker(channel, name);
WARN_ON(ret_err);
end:
- mutex_unlock(&markers_mutex);
+ pthread_mutex_unlock(&markers_mutex);
return ret;
}
//ust// EXPORT_SYMBOL_GPL(marker_probe_register);
struct marker_probe_closure *old;
int ret = -ENOENT;
- mutex_lock(&markers_mutex);
+ pthread_mutex_lock(&markers_mutex);
entry = get_marker(channel, name);
if (!entry)
goto end;
//ust// if (entry->rcu_pending)
//ust// rcu_barrier_sched();
old = marker_entry_remove_probe(entry, probe, probe_private);
- mutex_unlock(&markers_mutex);
+ pthread_mutex_unlock(&markers_mutex);
marker_update_probes();
- mutex_lock(&markers_mutex);
+ pthread_mutex_lock(&markers_mutex);
entry = get_marker(channel, name);
if (!entry)
goto end;
remove_marker(channel, name); /* Ignore busy error message */
ret = 0;
end:
- mutex_unlock(&markers_mutex);
+ pthread_mutex_unlock(&markers_mutex);
return ret;
}
//ust// EXPORT_SYMBOL_GPL(marker_probe_unregister);
struct marker_probe_closure *old;
char *channel = NULL, *name = NULL;
- mutex_lock(&markers_mutex);
+ pthread_mutex_lock(&markers_mutex);
entry = get_marker_from_private_data(probe, probe_private);
if (!entry) {
ret = -ENOENT;
old = marker_entry_remove_probe(entry, NULL, probe_private);
channel = strdup(entry->channel);
name = strdup(entry->name);
- mutex_unlock(&markers_mutex);
+ pthread_mutex_unlock(&markers_mutex);
marker_update_probes();
- mutex_lock(&markers_mutex);
+ pthread_mutex_lock(&markers_mutex);
entry = get_marker(channel, name);
if (!entry)
goto end;
/* Ignore busy error message */
remove_marker(channel, name);
end:
- mutex_unlock(&markers_mutex);
+ pthread_mutex_unlock(&markers_mutex);
free(channel);
free(name);
return ret;
struct lib *iter_lib;
int found = 0;
-//ust// mutex_lock(&module_mutex);
+//ust// pthread_mutex_lock(&module_mutex);
list_for_each_entry(iter_lib, &libs, list) {
if (iter_lib < iter->lib)
continue;
break;
}
}
-//ust// mutex_unlock(&module_mutex);
+//ust// pthread_mutex_unlock(&module_mutex);
return found;
}
//ust// struct hlist_node *pos;
//ust// struct marker_entry *entry;
//ust//
-//ust// mutex_lock(&markers_mutex);
-//ust// mutex_lock(¤t->group_leader->user_markers_mutex);
+//ust// pthread_mutex_lock(&markers_mutex);
+//ust// pthread_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// }
//ust// }
//ust// clear_thread_flag(TIF_MARKER_PENDING);
-//ust// mutex_unlock(¤t->group_leader->user_markers_mutex);
-//ust// mutex_unlock(&markers_mutex);
+//ust// pthread_mutex_unlock(¤t->group_leader->user_markers_mutex);
+//ust// pthread_mutex_unlock(&markers_mutex);
//ust// }
/*
struct hlist_node *pos, *n;
if (thread_group_leader(p)) {
- mutex_lock(&markers_mutex);
- mutex_lock(&p->user_markers_mutex);
+ pthread_mutex_lock(&markers_mutex);
+ pthread_mutex_lock(&p->user_markers_mutex);
hlist_for_each_entry_safe(umark, pos, n, &p->user_markers,
hlist)
free(umark);
INIT_HLIST_HEAD(&p->user_markers);
p->user_markers_sequence++;
- mutex_unlock(&p->user_markers_mutex);
- mutex_unlock(&markers_mutex);
+ pthread_mutex_unlock(&p->user_markers_mutex);
+ pthread_mutex_unlock(&markers_mutex);
}
}
{
struct marker_entry *entry;
- mutex_lock(&markers_mutex);
+ pthread_mutex_lock(&markers_mutex);
entry = get_marker(channel, name);
- mutex_unlock(&markers_mutex);
+ pthread_mutex_unlock(&markers_mutex);
return entry && !!entry->refcount;
}
struct hlist_node *node;
unsigned int i;
- mutex_lock(&markers_mutex);
+ pthread_mutex_lock(&markers_mutex);
call_data.trace = trace;
call_data.serializer = NULL;
entry->format);
}
}
- mutex_unlock(&markers_mutex);
+ pthread_mutex_unlock(&markers_mutex);
}
//ust// EXPORT_SYMBOL_GPL(ltt_dump_marker_state);
{
struct lib *pl;
- pl = (struct lib *) malloc(sizeof(struct lib));
+ pl = (struct lib *) zmalloc(sizeof(struct lib));
pl->markers_start = markers_start;
pl->markers_count = markers_count;
lock_markers();
/* FIXME: we should probably take a mutex here on libs */
-//ust// mutex_lock(&module_mutex);
+//ust// pthread_mutex_lock(&module_mutex);
list_for_each_entry(lib, &libs, list) {
if(lib->markers_start == markers_start) {
struct lib *lib2free = lib;