From: Masami Hiramatsu <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Ingo Molnar <mingo@redhat.com>,
linux-kernel@vger.kernel.org,
Tom Zanussi <tom.zanussi@linux.intel.com>,
Ravi Bangoria <ravi.bangoria@linux.ibm.com>,
Namhyung Kim <namhyung@kernel.org>,
Arnaldo Carvalho de Melo <acme@kernel.org>
Subject: [PATCH 02/21] tracing/uprobe: Set print format when parsing command
Date: Sat, 1 Jun 2019 00:16:56 +0900 [thread overview]
Message-ID: <155931581659.28323.5404667166417404076.stgit@devnote2> (raw)
In-Reply-To: <155931578555.28323.16360245959211149678.stgit@devnote2>
Set event call's print format right after parsed command for
simplifying (un)register_uprobe_event().
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.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 */
next prev parent reply other threads:[~2019-05-31 15:17 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-31 15:16 [PATCH 00/21] tracing/probe: Add multi-probes per event support Masami Hiramatsu
2019-05-31 15:16 ` [PATCH 01/21] tracing/kprobe: Set print format right after parsed command Masami Hiramatsu
2019-05-31 15:16 ` Masami Hiramatsu [this message]
2019-05-31 15:17 ` [PATCH 03/21] tracing/probe: Add trace_probe init and free functions Masami Hiramatsu
2019-05-31 15:17 ` [PATCH 04/21] tracing/probe: Add trace_event_call register API for trace_probe Masami Hiramatsu
2019-05-31 15:17 ` [PATCH 05/21] tracing/probe: Add trace_event_file access APIs " Masami Hiramatsu
2019-05-31 15:17 ` [PATCH 06/21] tracing/probe: Add trace flag " Masami Hiramatsu
2019-05-31 15:17 ` [PATCH 07/21] tracing/probe: Add probe event name and group name accesses APIs Masami Hiramatsu
2019-05-31 15:17 ` [PATCH 08/21] tracing/probe: Add trace_event_call " Masami Hiramatsu
2019-05-31 15:18 ` [PATCH 09/21] tracing/kprobe: Check registered state using kprobe Masami Hiramatsu
2019-05-31 15:18 ` [PATCH 10/21] tracing/probe: Split trace_event related data from trace_probe Masami Hiramatsu
2019-06-18 1:56 ` Steven Rostedt
2019-06-18 16:14 ` Masami Hiramatsu
2019-06-18 16:23 ` Steven Rostedt
2019-06-18 21:11 ` Steven Rostedt
2019-06-19 2:28 ` Masami Hiramatsu
2019-06-19 9:19 ` Steven Rostedt
2019-06-19 1:11 ` Masami Hiramatsu
2019-05-31 15:18 ` [PATCH 11/21] tracing/dynevent: Delete all matched events Masami Hiramatsu
2019-05-31 15:18 ` [PATCH 12/21] tracing/dynevent: Pass extra arguments to match operation Masami Hiramatsu
2019-05-31 15:18 ` [PATCH 13/21] tracing/kprobe: Add multi-probe per event support Masami Hiramatsu
2019-05-31 15:18 ` [PATCH 14/21] tracing/uprobe: Add multi-probe per uprobe " Masami Hiramatsu
2019-05-31 15:19 ` [PATCH 15/21] tracing/kprobe: Add per-probe delete from event Masami Hiramatsu
2019-05-31 15:19 ` [PATCH 16/21] tracing/uprobe: " Masami Hiramatsu
2019-06-18 2:16 ` Steven Rostedt
2019-06-18 16:18 ` Masami Hiramatsu
2019-05-31 15:19 ` [PATCH 17/21] tracing/probe: Add immediate parameter support Masami Hiramatsu
2019-05-31 15:19 ` [PATCH 18/21] tracing/probe: Add immediate string " Masami Hiramatsu
2019-05-31 15:19 ` [PATCH 19/21] selftests/ftrace: Add a testcase for kprobe multiprobe event Masami Hiramatsu
2019-05-31 15:19 ` [PATCH 20/21] selftests/ftrace: Add syntax error test for immediates Masami Hiramatsu
2019-05-31 15:20 ` [PATCH 21/21] selftests/ftrace: Add syntax error test for multiprobe Masami Hiramatsu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=155931581659.28323.5404667166417404076.stgit@devnote2 \
--to=mhiramat@kernel.org \
--cc=acme@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=ravi.bangoria@linux.ibm.com \
--cc=rostedt@goodmis.org \
--cc=tom.zanussi@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).