extern struct marker __stop___markers[];
/*
- * module_mutex nests inside markers_mutex. Markers mutex protects the builtin
+ * markers_mutex nests inside module_mutex. Markers mutex protects the builtin
* and module markers, the hash table and deferred_sync.
*/
static DEFINE_MUTEX(markers_mutex);
* @refcount: number of references left to the given probe_module (out)
*
* Updates the probe callback corresponding to a range of markers.
- * Must be called with markers_mutex held.
*/
void marker_update_probe_range(struct marker *begin,
struct marker *end, struct module *probe_module,
struct marker *iter;
struct marker_entry *mark_entry;
+ mutex_lock(&markers_mutex);
for (iter = begin; iter < end; iter++) {
mark_entry = get_marker(iter->name);
if (mark_entry && mark_entry->refcount) {
disable_marker(iter);
}
}
+ mutex_unlock(&markers_mutex);
}
/*
{
int refcount = 0;
- mutex_lock(&markers_mutex);
/* Core kernel markers */
marker_update_probe_range(__start___markers,
__stop___markers, probe_module, &refcount);
synchronize_sched();
deferred_sync = 0;
}
- mutex_unlock(&markers_mutex);
}
/**
marker_probe_func *probe, void *private)
{
struct marker_entry *entry;
- int ret = 0, need_update = 0;
+ int ret = 0;
mutex_lock(&markers_mutex);
entry = get_marker(name);
ret = add_marker(name, format, probe, private);
if (ret)
goto end;
- need_update = 1;
+ mutex_unlock(&markers_mutex);
+ marker_update_probes(NULL);
+ return ret;
end:
mutex_unlock(&markers_mutex);
- if (need_update)
- marker_update_probes(NULL);
return ret;
}
EXPORT_SYMBOL_GPL(marker_probe_register);
struct module *probe_module;
struct marker_entry *entry;
void *private;
- int need_update = 0;
mutex_lock(&markers_mutex);
entry = get_marker(name);
probe_module = __module_text_address((unsigned long)entry->probe);
private = remove_marker(name);
deferred_sync = 1;
- need_update = 1;
+ mutex_unlock(&markers_mutex);
+ marker_update_probes(probe_module);
+ return private;
end:
mutex_unlock(&markers_mutex);
- if (need_update)
- marker_update_probes(probe_module);
return private;
}
EXPORT_SYMBOL_GPL(marker_probe_unregister);
struct marker_entry *entry;
int found = 0;
unsigned int i;
- int need_update = 0;
mutex_lock(&markers_mutex);
for (i = 0; i < MARKER_TABLE_SIZE; i++) {
probe_module = __module_text_address((unsigned long)entry->probe);
private = remove_marker(entry->name);
deferred_sync = 1;
- need_update = 1;
+ mutex_unlock(&markers_mutex);
+ marker_update_probes(probe_module);
+ return private;
end:
mutex_unlock(&markers_mutex);
- if (need_update)
- marker_update_probes(probe_module);
return private;
}
EXPORT_SYMBOL_GPL(marker_probe_unregister_private_data);
int marker_arm(const char *name)
{
struct marker_entry *entry;
- int ret = 0, need_update = 0;
+ int ret = 0;
mutex_lock(&markers_mutex);
entry = get_marker(name);
*/
if (entry->refcount++)
goto end;
- need_update = 1;
end:
mutex_unlock(&markers_mutex);
- if (need_update)
- marker_update_probes(NULL);
+ marker_update_probes(NULL);
return ret;
}
EXPORT_SYMBOL_GPL(marker_arm);
int marker_disarm(const char *name)
{
struct marker_entry *entry;
- int ret = 0, need_update = 0;
+ int ret = 0;
mutex_lock(&markers_mutex);
entry = get_marker(name);
ret = -EPERM;
goto end;
}
- need_update = 1;
end:
mutex_unlock(&markers_mutex);
- if (need_update)
- marker_update_probes(NULL);
+ marker_update_probes(NULL);
return ret;
}
EXPORT_SYMBOL_GPL(marker_disarm);