Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1677757 > unrolled thread

[PATCH v2 2/4] selftests/ftrace: Add a test to probe module functions

Started by"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
First post2017-06-29 15:40 +0200
Last post2017-07-07 18:20 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2 2/4] selftests/ftrace: Add a test to probe module functions "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2017-06-29 15:40 +0200
    Re: [PATCH v2 2/4] selftests/ftrace: Add a test to probe module  functions Masami Hiramatsu <mhiramat@kernel.org> - 2017-07-03 05:30 +0200
      Re: [PATCH v2 2/4] selftests/ftrace: Add a test to probe module  functions Masami Hiramatsu <mhiramat@kernel.org> - 2017-07-03 06:00 +0200
        Re: [PATCH v2 2/4] selftests/ftrace: Add a test to probe module  functions "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2017-07-07 18:20 +0200

#1677757 — [PATCH v2 2/4] selftests/ftrace: Add a test to probe module functions

From"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
Date2017-06-29 15:40 +0200
Subject[PATCH v2 2/4] selftests/ftrace: Add a test to probe module functions
Message-ID<tXHPQ-8aI-25@gated-at.bofh.it>
Add a kprobes test to ensure that we are able to add a probe on a
module function using 'p <mod>:<func>' format, without having to
specify a probe name.

Suggested-by: Masami Hiramatsu <mhiramat@kernel.org>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
---
 .../testing/selftests/ftrace/test.d/kprobe/probe_module.tc | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/probe_module.tc

diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/probe_module.tc b/tools/testing/selftests/ftrace/test.d/kprobe/probe_module.tc
new file mode 100644
index 000000000000..ea7657041ba6
--- /dev/null
+++ b/tools/testing/selftests/ftrace/test.d/kprobe/probe_module.tc
@@ -0,0 +1,14 @@
+#!/bin/sh
+# description: Kprobe dynamic event - probing module
+
+[ -f kprobe_events ] || exit_unsupported # this is configurable
+
+echo 0 > events/enable
+echo > kprobe_events
+export MOD=`lsmod | head -n 2 | tail -n 1 | cut -f1 -d" "`
+export FUNC=`grep -m 1 ".* t .*\\[$MOD\\]" /proc/kallsyms | xargs | cut -f3 -d" "`
+[ "x" != "x$MOD" -a "y" != "y$FUNC" ] || exit_untested
+echo p $MOD:$FUNC > kprobe_events
+grep $MOD kprobe_events
+echo > kprobe_events
+clear_trace
-- 
2.13.1

[toc] | [next] | [standalone]


#1679621 — Re: [PATCH v2 2/4] selftests/ftrace: Add a test to probe module functions

FromMasami Hiramatsu <mhiramat@kernel.org>
Date2017-07-03 05:30 +0200
SubjectRe: [PATCH v2 2/4] selftests/ftrace: Add a test to probe module functions
Message-ID<tZ0dI-3G2-5@gated-at.bofh.it>
In reply to#1677757
On Thu, 29 Jun 2017 19:05:37 +0530
"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> wrote:

> Add a kprobes test to ensure that we are able to add a probe on a
> module function using 'p <mod>:<func>' format, without having to
> specify a probe name.
> 
> Suggested-by: Masami Hiramatsu <mhiramat@kernel.org>
> Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
> ---
>  .../testing/selftests/ftrace/test.d/kprobe/probe_module.tc | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>  create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/probe_module.tc
> 
> diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/probe_module.tc b/tools/testing/selftests/ftrace/test.d/kprobe/probe_module.tc
> new file mode 100644
> index 000000000000..ea7657041ba6
> --- /dev/null
> +++ b/tools/testing/selftests/ftrace/test.d/kprobe/probe_module.tc
> @@ -0,0 +1,14 @@
> +#!/bin/sh
> +# description: Kprobe dynamic event - probing module
> +
> +[ -f kprobe_events ] || exit_unsupported # this is configurable
> +
> +echo 0 > events/enable
> +echo > kprobe_events
> +export MOD=`lsmod | head -n 2 | tail -n 1 | cut -f1 -d" "`
> +export FUNC=`grep -m 1 ".* t .*\\[$MOD\\]" /proc/kallsyms | xargs | cut -f3 -d" "`
> +[ "x" != "x$MOD" -a "y" != "y$FUNC" ] || exit_untested

Could you also add below case?

echo p:probe_$MOD/$FUNC $MOD/$FUNC > kprobe_events 

This is for "new event with name on module" case, your one is for "new event without name on module (automatic name generation)"

We should have different test case, because those kicks slightly different parts in kprobe tracer.

Thank you,

> +echo p $MOD:$FUNC > kprobe_events
> +grep $MOD kprobe_events
> +echo > kprobe_events
> +clear_trace
> -- 
> 2.13.1
> 


-- 
Masami Hiramatsu <mhiramat@kernel.org>

[toc] | [prev] | [next] | [standalone]


#1679632 — Re: [PATCH v2 2/4] selftests/ftrace: Add a test to probe module functions

FromMasami Hiramatsu <mhiramat@kernel.org>
Date2017-07-03 06:00 +0200
SubjectRe: [PATCH v2 2/4] selftests/ftrace: Add a test to probe module functions
Message-ID<tZ0GK-3R7-3@gated-at.bofh.it>
In reply to#1679621
On Mon, 3 Jul 2017 12:27:33 +0900
Masami Hiramatsu <mhiramat@kernel.org> wrote:

> On Thu, 29 Jun 2017 19:05:37 +0530
> "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> wrote:
> 
> > Add a kprobes test to ensure that we are able to add a probe on a
> > module function using 'p <mod>:<func>' format, without having to
> > specify a probe name.
> > 
> > Suggested-by: Masami Hiramatsu <mhiramat@kernel.org>
> > Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
> > Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
> > ---
> >  .../testing/selftests/ftrace/test.d/kprobe/probe_module.tc | 14 ++++++++++++++
> >  1 file changed, 14 insertions(+)
> >  create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/probe_module.tc
> > 
> > diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/probe_module.tc b/tools/testing/selftests/ftrace/test.d/kprobe/probe_module.tc
> > new file mode 100644
> > index 000000000000..ea7657041ba6
> > --- /dev/null
> > +++ b/tools/testing/selftests/ftrace/test.d/kprobe/probe_module.tc
> > @@ -0,0 +1,14 @@
> > +#!/bin/sh
> > +# description: Kprobe dynamic event - probing module
> > +
> > +[ -f kprobe_events ] || exit_unsupported # this is configurable
> > +
> > +echo 0 > events/enable
> > +echo > kprobe_events
> > +export MOD=`lsmod | head -n 2 | tail -n 1 | cut -f1 -d" "`
> > +export FUNC=`grep -m 1 ".* t .*\\[$MOD\\]" /proc/kallsyms | xargs | cut -f3 -d" "`
> > +[ "x" != "x$MOD" -a "y" != "y$FUNC" ] || exit_untested
> 
> Could you also add below case?
> 
> echo p:probe_$MOD/$FUNC $MOD/$FUNC > kprobe_events 

Oops, it should be something like

echo "p:test_${MOD}_${FUNC} $MOD/$FUNC" > kprobe_events

since we would like to avoid adding new group name for it.

(Adding new group name should be a separated one.)

Thank you,

> 
> This is for "new event with name on module" case, your one is for "new event without name on module (automatic name generation)"
> 
> We should have different test case, because those kicks slightly different parts in kprobe tracer.
> 
> Thank you,
> 
> > +echo p $MOD:$FUNC > kprobe_events
> > +grep $MOD kprobe_events
> > +echo > kprobe_events
> > +clear_trace
> > -- 
> > 2.13.1
> > 
> 
> 
> -- 
> Masami Hiramatsu <mhiramat@kernel.org>


-- 
Masami Hiramatsu <mhiramat@kernel.org>

[toc] | [prev] | [next] | [standalone]


#1683284 — Re: [PATCH v2 2/4] selftests/ftrace: Add a test to probe module functions

From"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
Date2017-07-07 18:20 +0200
SubjectRe: [PATCH v2 2/4] selftests/ftrace: Add a test to probe module functions
Message-ID<u0E94-6rS-23@gated-at.bofh.it>
In reply to#1679632
On 2017/07/03 12:51PM, Masami Hiramatsu wrote:
> On Mon, 3 Jul 2017 12:27:33 +0900
> Masami Hiramatsu <mhiramat@kernel.org> wrote:
> 
> > On Thu, 29 Jun 2017 19:05:37 +0530
> > "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> wrote:
> > 
> > > Add a kprobes test to ensure that we are able to add a probe on a
> > > module function using 'p <mod>:<func>' format, without having to
> > > specify a probe name.
> > > 
> > > Suggested-by: Masami Hiramatsu <mhiramat@kernel.org>
> > > Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
> > > Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
> > > ---
> > >  .../testing/selftests/ftrace/test.d/kprobe/probe_module.tc | 14 ++++++++++++++
> > >  1 file changed, 14 insertions(+)
> > >  create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/probe_module.tc
> > > 
> > > diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/probe_module.tc b/tools/testing/selftests/ftrace/test.d/kprobe/probe_module.tc
> > > new file mode 100644
> > > index 000000000000..ea7657041ba6
> > > --- /dev/null
> > > +++ b/tools/testing/selftests/ftrace/test.d/kprobe/probe_module.tc
> > > @@ -0,0 +1,14 @@
> > > +#!/bin/sh
> > > +# description: Kprobe dynamic event - probing module
> > > +
> > > +[ -f kprobe_events ] || exit_unsupported # this is configurable
> > > +
> > > +echo 0 > events/enable
> > > +echo > kprobe_events
> > > +export MOD=`lsmod | head -n 2 | tail -n 1 | cut -f1 -d" "`
> > > +export FUNC=`grep -m 1 ".* t .*\\[$MOD\\]" /proc/kallsyms | xargs | cut -f3 -d" "`
> > > +[ "x" != "x$MOD" -a "y" != "y$FUNC" ] || exit_untested
> > 
> > Could you also add below case?
> > 
> > echo p:probe_$MOD/$FUNC $MOD/$FUNC > kprobe_events 
> 
> Oops, it should be something like
> 
> echo "p:test_${MOD}_${FUNC} $MOD/$FUNC" > kprobe_events
> 
> since we would like to avoid adding new group name for it.
> 
> (Adding new group name should be a separated one.)
> 
> Thank you,
> 
> > 
> > This is for "new event with name on module" case, your one is for "new event without name on module (automatic name generation)"
> > 
> > We should have different test case, because those kicks slightly different parts in kprobe tracer.

Sure. Will make changes to the two tests here and re-spin.

Thanks,
Naveen

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web