mirror of https://gitee.com/openkylin/linux.git
tracing/boottime: Fix kprobe event API usage
Fix boottime kprobe events to use API correctly for
multiple events.
For example, when we set a multiprobe kprobe events in
bootconfig like below,
ftrace.event.kprobes.myevent {
probes = "vfs_read $arg1 $arg2", "vfs_write $arg1 $arg2"
}
This cause an error;
trace_boot: Failed to add probe: p:kprobes/myevent (null) vfs_read $arg1 $arg2 vfs_write $arg1 $arg2
This shows the 1st argument becomes NULL and multiprobes
are merged to 1 probe.
Link: http://lkml.kernel.org/r/158779375766.6082.201939936008972838.stgit@devnote2
Cc: Ingo Molnar <mingo@kernel.org>
Cc: stable@vger.kernel.org
Fixes: 29a1548105
("tracing: Change trace_boot to use kprobe_event interface")
Reviewed-by: Tom Zanussi <zanussi@kernel.org>
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
This commit is contained in:
parent
dcbd21c9fc
commit
da0f1f4167
|
@ -95,23 +95,19 @@ trace_boot_add_kprobe_event(struct xbc_node *node, const char *event)
|
||||||
struct xbc_node *anode;
|
struct xbc_node *anode;
|
||||||
char buf[MAX_BUF_LEN];
|
char buf[MAX_BUF_LEN];
|
||||||
const char *val;
|
const char *val;
|
||||||
int ret;
|
int ret = 0;
|
||||||
|
|
||||||
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) {
|
xbc_node_for_each_array_value(node, "probes", anode, val) {
|
||||||
ret = kprobe_event_add_field(&cmd, val);
|
kprobe_event_cmd_init(&cmd, buf, MAX_BUF_LEN);
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = kprobe_event_gen_cmd_end(&cmd);
|
ret = kprobe_event_gen_cmd_start(&cmd, event, val);
|
||||||
if (ret)
|
if (ret)
|
||||||
pr_err("Failed to add probe: %s\n", buf);
|
break;
|
||||||
|
|
||||||
|
ret = kprobe_event_gen_cmd_end(&cmd);
|
||||||
|
if (ret)
|
||||||
|
pr_err("Failed to add probe: %s\n", buf);
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue