event);
if (ret)
goto register_error;
+ ret = try_module_get(event->desc->owner);
+ WARN_ON_ONCE(!ret);
break;
case LTTNG_KERNEL_FUNCTION:
ret = lttng_ftrace_register(event_param->name,
event);
if (ret)
goto register_error;
+ ret = try_module_get(event->desc->owner);
+ WARN_ON_ONCE(!ret);
break;
default:
WARN_ON_ONCE(1);
event);
if (ret)
return ret;
- ltt_event_put(event->desc);
break;
case LTTNG_KERNEL_KPROBE:
lttng_kprobes_unregister(event);
static
void _ltt_event_destroy(struct ltt_event *event)
{
- ltt_event_put(event->desc);
+ switch (event->instrumentation) {
+ case LTTNG_KERNEL_TRACEPOINT:
+ ltt_event_put(event->desc);
+ break;
+ case LTTNG_KERNEL_KPROBE:
+ module_put(event->desc->owner);
+ lttng_kprobes_destroy_private(event);
+ break;
+ case LTTNG_KERNEL_FUNCTION:
+ module_put(event->desc->owner);
+ lttng_ftrace_destroy_private(event);
+ break;
+ default:
+ WARN_ON_ONCE(1);
+ }
list_del(&event->list);
kmem_cache_free(event_cache, event);
}
uint64_t addr,
struct ltt_event *event);
void lttng_kprobes_unregister(struct ltt_event *event);
+void lttng_kprobes_destroy_private(struct ltt_event *event);
#else
static inline
int lttng_kprobes_register(const char *name,
void lttng_kprobes_unregister(struct ltt_event *event)
{
}
+
+static inline
+void lttng_kprobes_destroy_private(struct ltt_event *event)
+{
+}
#endif
#ifdef CONFIG_DYNAMIC_FTRACE
const char *symbol_name,
struct ltt_event *event);
void lttng_ftrace_unregister(struct ltt_event *event);
+void lttng_ftrace_destroy_private(struct ltt_event *event);
#else
static inline
int lttng_ftrace_register(const char *name,
void lttng_ftrace_unregister(struct ltt_event *event)
{
}
+
+static inline
+void lttng_ftrace_destroy_private(struct ltt_event *event)
+{
+}
#endif
extern const struct file_operations lttng_tracepoint_list_fops;
{
wrapper_unregister_ftrace_function_probe(event->u.ftrace.symbol_name,
<tng_ftrace_ops, event);
+}
+EXPORT_SYMBOL_GPL(lttng_ftrace_unregister);
+
+void lttng_ftrace_destroy_private(struct ltt_event *event)
+{
kfree(event->u.ftrace.symbol_name);
kfree(event->desc->fields);
kfree(event->desc->name);
kfree(event->desc);
}
-EXPORT_SYMBOL_GPL(lttng_ftrace_unregister);
+EXPORT_SYMBOL_GPL(lttng_ftrace_destroy_private);
int lttng_ftrace_init(void)
{
void lttng_kprobes_unregister(struct ltt_event *event)
{
unregister_kprobe(&event->u.kprobe.kp);
+}
+EXPORT_SYMBOL_GPL(lttng_kprobes_unregister);
+
+void lttng_kprobes_destroy_private(struct ltt_event *event)
+{
kfree(event->u.kprobe.symbol_name);
kfree(event->desc->fields);
kfree(event->desc->name);
kfree(event->desc);
}
-EXPORT_SYMBOL_GPL(lttng_kprobes_unregister);
+EXPORT_SYMBOL_GPL(lttng_kprobes_destroy_private);
MODULE_LICENSE("GPL and additional rights");
MODULE_AUTHOR("Mathieu Desnoyers");