From: Tom Zanussi <zanussi@kernel.org>
To: rostedt@goodmis.org
Cc: artem.bityutskiy@linux.intel.com, mhiramat@kernel.org,
linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org
Subject: [PATCH v4 10/12] tracing: Change trace_boot to use kprobe_event interface
Date: Wed, 29 Jan 2020 12:59:30 -0600 [thread overview]
Message-ID: <af5429d11291ab1e9a85a0ff944af3b2bcf193c7.1580323897.git.zanussi@kernel.org> (raw)
In-Reply-To: <cover.1580323897.git.zanussi@kernel.org>
In-Reply-To: <cover.1580323897.git.zanussi@kernel.org>
Have trace_boot_add_kprobe_event() use the kprobe_event interface.
Also, rename kprobe_event_run_cmd() to kprobe_event_run_command() now
that trace_boot's version is gone.
Signed-off-by: Tom Zanussi <zanussi@kernel.org>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
---
kernel/trace/trace_boot.c | 35 +++++++++++++++--------------------
kernel/trace/trace_kprobe.c | 9 ++-------
2 files changed, 17 insertions(+), 27 deletions(-)
diff --git a/kernel/trace/trace_boot.c b/kernel/trace/trace_boot.c
index 8f40de349db1..352924477e8f 100644
--- a/kernel/trace/trace_boot.c
+++ b/kernel/trace/trace_boot.c
@@ -91,37 +91,32 @@ trace_boot_enable_events(struct trace_array *tr, struct xbc_node *node)
}
#ifdef CONFIG_KPROBE_EVENTS
-extern int trace_kprobe_run_command(const char *command);
-
static int __init
trace_boot_add_kprobe_event(struct xbc_node *node, const char *event)
{
+ struct dynevent_cmd cmd;
struct xbc_node *anode;
char buf[MAX_BUF_LEN];
const char *val;
- char *p;
- int len;
+ int ret;
- len = snprintf(buf, ARRAY_SIZE(buf) - 1, "p:kprobes/%s ", event);
- if (len >= ARRAY_SIZE(buf)) {
- pr_err("Event name is too long: %s\n", event);
- return -E2BIG;
- }
- p = buf + len;
- len = ARRAY_SIZE(buf) - len;
+ kprobe_event_cmd_init(&cmd, buf, MAX_BUF_LEN);
+
+ ret = kprobe_event_gen_cmd_start(&cmd, event, NULL);
+ if (ret)
+ return ret;
xbc_node_for_each_array_value(node, "probes", anode, val) {
- if (strlcpy(p, val, len) >= len) {
- pr_err("Probe definition is too long: %s\n", val);
- return -E2BIG;
- }
- if (trace_kprobe_run_command(buf) < 0) {
- pr_err("Failed to add probe: %s\n", buf);
- return -EINVAL;
- }
+ ret = kprobe_event_add_field(&cmd, val);
+ if (ret)
+ return ret;
}
- return 0;
+ ret = kprobe_event_gen_cmd_end(&cmd);
+ if (ret)
+ pr_err("Failed to add probe: %s\n", buf);
+
+ return ret;
}
#else
static inline int __init
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index f43548b466d0..307abb724a71 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -901,12 +901,7 @@ static int create_or_delete_trace_kprobe(int argc, char **argv)
return ret == -ECANCELED ? -EINVAL : ret;
}
-int trace_kprobe_run_command(const char *command)
-{
- return trace_run_command(command, create_or_delete_trace_kprobe);
-}
-
-static int trace_kprobe_run_cmd(struct dynevent_cmd *cmd)
+static int trace_kprobe_run_command(struct dynevent_cmd *cmd)
{
return trace_run_command(cmd->buf, create_or_delete_trace_kprobe);
}
@@ -923,7 +918,7 @@ static int trace_kprobe_run_cmd(struct dynevent_cmd *cmd)
void kprobe_event_cmd_init(struct dynevent_cmd *cmd, char *buf, int maxlen)
{
dynevent_cmd_init(cmd, buf, maxlen, DYNEVENT_TYPE_KPROBE,
- trace_kprobe_run_cmd);
+ trace_kprobe_run_command);
}
EXPORT_SYMBOL_GPL(kprobe_event_cmd_init);
--
2.14.1
next prev parent reply other threads:[~2020-01-29 19:00 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-29 18:59 [PATCH v4 00/12] tracing: Add support for in-kernel dynamic event API Tom Zanussi
2020-01-29 18:59 ` [PATCH v4 01/12] tracing: Add trace_array_find/_get() to find instance trace arrays Tom Zanussi
2020-01-29 21:14 ` Steven Rostedt
2020-01-29 18:59 ` [PATCH v4 02/12] tracing: Add trace_get/put_event_file() Tom Zanussi
2020-01-29 18:59 ` [PATCH v4 03/12] tracing: Add synth_event_delete() Tom Zanussi
2020-01-29 18:59 ` [PATCH v4 04/12] tracing: Add dynamic event command creation interface Tom Zanussi
2020-01-30 2:40 ` Masami Hiramatsu
2020-01-30 2:58 ` Steven Rostedt
2020-01-29 18:59 ` [PATCH v4 05/12] tracing: Add synthetic event command generation functions Tom Zanussi
2020-01-29 18:59 ` [PATCH v4 06/12] tracing: Change trace_boot to use synth_event interface Tom Zanussi
2020-01-31 17:49 ` Tom Zanussi
2020-01-31 17:55 ` Steven Rostedt
2020-01-31 18:00 ` Steven Rostedt
2020-01-31 18:01 ` Tom Zanussi
2020-01-29 18:59 ` [PATCH v4 07/12] tracing: Add synth_event_trace() and related functions Tom Zanussi
2020-01-29 21:09 ` Steven Rostedt
2020-01-29 22:58 ` Tom Zanussi
2020-01-30 3:01 ` Steven Rostedt
2020-01-29 18:59 ` [PATCH v4 08/12] tracing: Add synth event generation test module Tom Zanussi
2020-01-29 18:59 ` [PATCH v4 09/12] tracing: Add kprobe event command generation functions Tom Zanussi
2020-01-29 18:59 ` Tom Zanussi [this message]
2020-01-29 18:59 ` [PATCH v4 11/12] tracing: Add kprobe event command generation test module Tom Zanussi
2020-01-29 18:59 ` [PATCH v4 12/12] tracing: Documentation for in-kernel synthetic event API Tom Zanussi
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=af5429d11291ab1e9a85a0ff944af3b2bcf193c7.1580323897.git.zanussi@kernel.org \
--to=zanussi@kernel.org \
--cc=artem.bityutskiy@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.org \
/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).