Re: [PATCH v5 3.1.0-rc4-tip 19/26] tracing: Extract out commoncode for kprobes/uprobes traceevents.

From: Masami Hiramatsu
Date: Wed Sep 28 2011 - 01:04:31 EST


(2011/09/20 21:03), Srikar Dronamraju wrote:
> Move parts of trace_kprobe.c that can be shared with upcoming
> trace_uprobe.c. Common code to kernel/trace/trace_probe.h and
> kernel/trace/trace_probe.c.

This seems including different changes (as below). Please separate it.
(Maybe "Use Boolean instead of integer" patch? :))

[...]
> @@ -651,7 +107,7 @@ static struct trace_probe *alloc_trace_probe(const char *group,
> void *addr,
> const char *symbol,
> unsigned long offs,
> - int nargs, int is_return)
> + int nargs, bool is_return)
> {
> struct trace_probe *tp;
> int ret = -ENOMEM;
[...]

> @@ -1153,7 +366,7 @@ static int create_trace_probe(int argc, char **argv)
> */
> struct trace_probe *tp;
> int i, ret = 0;
> - int is_return = 0, is_delete = 0;
> + bool is_return = false, is_delete = false;
> char *symbol = NULL, *event = NULL, *group = NULL;
> char *arg;
> unsigned long offset = 0;
> @@ -1162,11 +375,11 @@ static int create_trace_probe(int argc, char **argv)
>
> /* argc must be >= 1 */
> if (argv[0][0] == 'p')
> - is_return = 0;
> + is_return = false;
> else if (argv[0][0] == 'r')
> - is_return = 1;
> + is_return = true;
> else if (argv[0][0] == '-')
> - is_delete = 1;
> + is_delete = true;
> else {
> pr_info("Probe definition must be started with 'p', 'r' or"
> " '-'.\n");

And also, this has bugs in selftest code.

[...]
> @@ -2020,7 +1166,7 @@ static __init int kprobe_trace_self_tests_init(void)
>
> pr_info("Testing kprobe tracing: ");
>
> - ret = command_trace_probe("p:testprobe kprobe_trace_selftest_target "
> + ret = traceprobe_command("p:testprobe kprobe_trace_selftest_target "
> "$stack $stack0 +0($stack)");
> if (WARN_ON_ONCE(ret)) {
> pr_warning("error on probing function entry.\n");
> @@ -2035,7 +1181,7 @@ static __init int kprobe_trace_self_tests_init(void)
> enable_trace_probe(tp, TP_FLAG_TRACE);
> }
>
> - ret = command_trace_probe("r:testprobe2 kprobe_trace_selftest_target "
> + ret = traceprobe_command("r:testprobe2 kprobe_trace_selftest_target "
> "$retval");
> if (WARN_ON_ONCE(ret)) {
> pr_warning("error on probing function return.\n");
> @@ -2055,13 +1201,13 @@ static __init int kprobe_trace_self_tests_init(void)
>
> ret = target(1, 2, 3, 4, 5, 6);
>
> - ret = command_trace_probe("-:testprobe");
> + ret = traceprobe_command_trace_probe("-:testprobe");
> if (WARN_ON_ONCE(ret)) {
> pr_warning("error on deleting a probe.\n");
> warn++;
> }
>
> - ret = command_trace_probe("-:testprobe2");
> + ret = traceprobe_command_trace_probe("-:testprobe2");
> if (WARN_ON_ONCE(ret)) {
> pr_warning("error on deleting a probe.\n");
> warn++;

traceprobe_command(str) and traceprobe_command_trace_probe(str) should be
traceprobe_command(str, create_trace_probe).

Thank you,


--
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@xxxxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/