lkml.org 
[lkml]   [2019]   [Jun]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[for-next][PATCH 05/12] tracing/uprobe: Set print format when parsing command
From: Masami Hiramatsu <mhiramat@kernel.org>

Set event call's print format right after parsed command for
simplifying (un)register_uprobe_event().

Link: http://lkml.kernel.org/r/155931581659.28323.5404667166417404076.stgit@devnote2

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
kernel/trace/trace_uprobe.c | 25 +++++++------------------
1 file changed, 7 insertions(+), 18 deletions(-)

diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index 3d6b868830f3..34ce671b6080 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -345,6 +345,7 @@ static void free_trace_uprobe(struct trace_uprobe *tu)
path_put(&tu->path);
kfree(tu->tp.call.class->system);
kfree(tu->tp.call.name);
+ kfree(tu->tp.call.print_fmt);
kfree(tu->filename);
kfree(tu);
}
@@ -592,6 +593,10 @@ static int trace_uprobe_create(int argc, const char **argv)
goto error;
}

+ ret = traceprobe_set_print_fmt(&tu->tp, is_ret_probe(tu));
+ if (ret < 0)
+ goto error;
+
ret = register_trace_uprobe(tu);
if (!ret)
goto out;
@@ -1362,21 +1367,15 @@ static int register_uprobe_event(struct trace_uprobe *tu)

init_trace_event_call(tu, call);

- if (traceprobe_set_print_fmt(&tu->tp, is_ret_probe(tu)) < 0)
- return -ENOMEM;
-
ret = register_trace_event(&call->event);
- if (!ret) {
- kfree(call->print_fmt);
+ if (!ret)
return -ENODEV;
- }

ret = trace_add_event_call(call);

if (ret) {
pr_info("Failed to register uprobe event: %s\n",
trace_event_name(call));
- kfree(call->print_fmt);
unregister_trace_event(&call->event);
}

@@ -1385,15 +1384,8 @@ static int register_uprobe_event(struct trace_uprobe *tu)

static int unregister_uprobe_event(struct trace_uprobe *tu)
{
- int ret;
-
/* tu->event is unregistered in trace_remove_event_call() */
- ret = trace_remove_event_call(&tu->tp.call);
- if (ret)
- return ret;
- kfree(tu->tp.call.print_fmt);
- tu->tp.call.print_fmt = NULL;
- return 0;
+ return trace_remove_event_call(&tu->tp.call);
}

#ifdef CONFIG_PERF_EVENTS
@@ -1452,9 +1444,6 @@ void destroy_local_trace_uprobe(struct trace_event_call *event_call)

tu = container_of(event_call, struct trace_uprobe, tp.call);

- kfree(tu->tp.call.print_fmt);
- tu->tp.call.print_fmt = NULL;
-
free_trace_uprobe(tu);
}
#endif /* CONFIG_PERF_EVENTS */
--
2.20.1

\
 
 \ /
  Last update: 2019-06-25 21:17    [W:0.051 / U:2.064 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site