2014-10-20 10:52:15

by Heiko Carstens

[permalink] [raw]
Subject: [PATCH 0/2] ftracetest improvement and new testcase

These two patches are a result from the s390 vs kprobes on ftrace
discussion, however they can be handled completely independent.

One patch simply sorts the ftrace testcases, while the second adds
a new testcase with a couple of sanity test with respect to the
coexistence of kprobes and ftrace.

Heiko Carstens (2):
ftracetest: add kprobes on ftrace testcase
ftracetest: sort testcases

tools/testing/selftests/ftrace/ftracetest | 2 +-
.../ftrace/test.d/kprobe/kprobe_ftrace.tc | 55 ++++++++++++++++++++++
2 files changed, 56 insertions(+), 1 deletion(-)
create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc

--
1.8.5.5


2014-10-20 10:52:18

by Heiko Carstens

[permalink] [raw]
Subject: [PATCH 2/2] ftracetest: sort testcases

Make sure the order of the executed testcases is always the same.

Acked-by: Masami Hiramatsu <[email protected]>
Signed-off-by: Heiko Carstens <[email protected]>
---
tools/testing/selftests/ftrace/ftracetest | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/ftrace/ftracetest b/tools/testing/selftests/ftrace/ftracetest
index a8f81c782856..2007a2cde56f 100755
--- a/tools/testing/selftests/ftrace/ftracetest
+++ b/tools/testing/selftests/ftrace/ftracetest
@@ -37,7 +37,7 @@ abspath() {
}

find_testcases() { #directory
- echo `find $1 -name \*.tc`
+ echo `find $1 -name \*.tc | sort`
}

parse_opts() { # opts
--
1.8.5.5

2014-10-20 10:52:13

by Heiko Carstens

[permalink] [raw]
Subject: [PATCH 1/2] ftracetest: add kprobes on ftrace testcase

Add a kprobes on ftrace testcase. The testcase verifies that
- enabling and disabling function tracing works on a function which
already contains a dynamic kprobe
- adding and removing a dynamic kprobe works on a function which is
already enabled for function tracing

Signed-off-by: Heiko Carstens <[email protected]>
---
.../ftrace/test.d/kprobe/kprobe_ftrace.tc | 55 ++++++++++++++++++++++
1 file changed, 55 insertions(+)
create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc

diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc
new file mode 100644
index 000000000000..ab41d2b29841
--- /dev/null
+++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc
@@ -0,0 +1,55 @@
+#!/bin/sh
+# description: Kprobe dynamic event with function tracer
+
+[ -f kprobe_events ] || exit_unsupported # this is configurable
+grep function available_tracers || exit_unsupported # this is configurable
+
+# prepare
+echo nop > current_tracer
+echo do_fork > set_ftrace_filter
+echo 0 > events/enable
+echo > kprobe_events
+echo 'p:testprobe do_fork' > kprobe_events
+
+# kprobe on / ftrace off
+echo 1 > events/kprobes/testprobe/enable
+echo > trace
+( echo "forked")
+grep testprobe trace
+! grep 'do_fork <-' trace
+
+# kprobe on / ftrace on
+echo function > current_tracer
+echo > trace
+( echo "forked")
+grep testprobe trace
+grep 'do_fork <-' trace
+
+# kprobe off / ftrace on
+echo 0 > events/kprobes/testprobe/enable
+echo > trace
+( echo "forked")
+! grep testprobe trace
+grep 'do_fork <-' trace
+
+# kprobe on / ftrace on
+echo 1 > events/kprobes/testprobe/enable
+echo function > current_tracer
+echo > trace
+( echo "forked")
+grep testprobe trace
+grep 'do_fork <-' trace
+
+# kprobe on / ftrace off
+echo nop > current_tracer
+echo > trace
+( echo "forked")
+grep testprobe trace
+! grep 'do_fork <-' trace
+
+# cleanup
+echo nop > current_tracer
+echo > set_ftrace_filter
+echo 0 > events/kprobes/testprobe/enable
+echo > kprobe_events
+echo > trace
--
1.8.5.5

Subject: Re: [PATCH 1/2] ftracetest: add kprobes on ftrace testcase

(2014/10/20 19:52), Heiko Carstens wrote:
> Add a kprobes on ftrace testcase. The testcase verifies that
> - enabling and disabling function tracing works on a function which
> already contains a dynamic kprobe
> - adding and removing a dynamic kprobe works on a function which is
> already enabled for function tracing
>

Looks good to me.

> Signed-off-by: Heiko Carstens <[email protected]>

Acked-by: Masami Hiramatsu <[email protected]>

Thanks!

> ---
> .../ftrace/test.d/kprobe/kprobe_ftrace.tc | 55 ++++++++++++++++++++++
> 1 file changed, 55 insertions(+)
> create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc
>
> diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc
> new file mode 100644
> index 000000000000..ab41d2b29841
> --- /dev/null
> +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc
> @@ -0,0 +1,55 @@
> +#!/bin/sh
> +# description: Kprobe dynamic event with function tracer
> +
> +[ -f kprobe_events ] || exit_unsupported # this is configurable
> +grep function available_tracers || exit_unsupported # this is configurable
> +
> +# prepare
> +echo nop > current_tracer
> +echo do_fork > set_ftrace_filter
> +echo 0 > events/enable
> +echo > kprobe_events
> +echo 'p:testprobe do_fork' > kprobe_events
> +
> +# kprobe on / ftrace off
> +echo 1 > events/kprobes/testprobe/enable
> +echo > trace
> +( echo "forked")
> +grep testprobe trace
> +! grep 'do_fork <-' trace

I like this technique :)

> +
> +# kprobe on / ftrace on
> +echo function > current_tracer
> +echo > trace
> +( echo "forked")
> +grep testprobe trace
> +grep 'do_fork <-' trace
> +
> +# kprobe off / ftrace on
> +echo 0 > events/kprobes/testprobe/enable
> +echo > trace
> +( echo "forked")
> +! grep testprobe trace
> +grep 'do_fork <-' trace
> +
> +# kprobe on / ftrace on
> +echo 1 > events/kprobes/testprobe/enable
> +echo function > current_tracer
> +echo > trace
> +( echo "forked")
> +grep testprobe trace
> +grep 'do_fork <-' trace
> +
> +# kprobe on / ftrace off
> +echo nop > current_tracer
> +echo > trace
> +( echo "forked")
> +grep testprobe trace
> +! grep 'do_fork <-' trace
> +
> +# cleanup
> +echo nop > current_tracer
> +echo > set_ftrace_filter
> +echo 0 > events/kprobes/testprobe/enable
> +echo > kprobe_events
> +echo > trace
>


--
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Research Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: [email protected]

2014-10-21 11:59:35

by Heiko Carstens

[permalink] [raw]
Subject: Re: [PATCH 1/2] ftracetest: add kprobes on ftrace testcase

On Tue, Oct 21, 2014 at 06:21:05PM +0900, Masami Hiramatsu wrote:
> (2014/10/20 19:52), Heiko Carstens wrote:
> > Add a kprobes on ftrace testcase. The testcase verifies that
> > - enabling and disabling function tracing works on a function which
> > already contains a dynamic kprobe
> > - adding and removing a dynamic kprobe works on a function which is
> > already enabled for function tracing
> >
>
> Looks good to me.
>
> > Signed-off-by: Heiko Carstens <[email protected]>
>
> Acked-by: Masami Hiramatsu <[email protected]>

Hi Masami,

thanks! How should these two patches go upstream?

Thanks,
Heiko

Subject: Re: Re: [PATCH 1/2] ftracetest: add kprobes on ftrace testcase

(2014/10/21 20:59), Heiko Carstens wrote:
> On Tue, Oct 21, 2014 at 06:21:05PM +0900, Masami Hiramatsu wrote:
>> (2014/10/20 19:52), Heiko Carstens wrote:
>>> Add a kprobes on ftrace testcase. The testcase verifies that
>>> - enabling and disabling function tracing works on a function which
>>> already contains a dynamic kprobe
>>> - adding and removing a dynamic kprobe works on a function which is
>>> already enabled for function tracing
>>>
>>
>> Looks good to me.
>>
>>> Signed-off-by: Heiko Carstens <[email protected]>
>>
>> Acked-by: Masami Hiramatsu <[email protected]>
>
> Hi Masami,
>
> thanks! How should these two patches go upstream?

Steven, could you pick this series to your tree?
I think it is better to manage ftracetest testcases in one tree.

Thank you,

--
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Research Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: [email protected]

2014-10-22 15:04:44

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH 1/2] ftracetest: add kprobes on ftrace testcase

On Tue, 21 Oct 2014 21:10:00 +0900
Masami Hiramatsu <[email protected]> wrote:


> Steven, could you pick this series to your tree?
> I think it is better to manage ftracetest testcases in one tree.

I can pick these up. Is it OK if it goes into the 3.19 queue? Or is
there some urgent need to get them into 3.18? As they are ftracetests,
it's not that big of a deal to get them in early, as it is highly
unlikely to break the kernel itself.

-- Steve

Subject: Re: [PATCH 1/2] ftracetest: add kprobes on ftrace testcase

(2014/10/23 0:04), Steven Rostedt wrote:
> On Tue, 21 Oct 2014 21:10:00 +0900
> Masami Hiramatsu <[email protected]> wrote:
>
>
>> Steven, could you pick this series to your tree?
>> I think it is better to manage ftracetest testcases in one tree.
>
> I can pick these up. Is it OK if it goes into the 3.19 queue? Or is
> there some urgent need to get them into 3.18? As they are ftracetests,
> it's not that big of a deal to get them in early, as it is highly
> unlikely to break the kernel itself.

It seems we have no urgent need, I think 3.19 queue is OK. :)

Thank you,

--
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Research Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: [email protected]