Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: rostedt at goodmis.org (Steven Rostedt)
Subject: [PATCH v2 12/32] selftests/ftrace: Improve kprobe on module testcase to load/unload module
Date: Fri, 24 Aug 2018 19:07:08 -0400	[thread overview]
Message-ID: <20180824190708.3c170cc6@gandalf.local.home> (raw)
In-Reply-To: <153443729154.23257.15704810148795897178.stgit@devbox>

On Fri, 17 Aug 2018 01:34:51 +0900
Masami Hiramatsu <mhiramat at kernel.org> wrote:

> Improve kprobe events on module testcase to check module
> load/unload with disabled/enabled events. This also change
> the target module to trace_printk.ko, so it depends on
> CONFIG_SAMPLE_TRACE_PRINTK=m.
> 
> Signed-off-by: Masami Hiramatsu <mhiramat at kernel.org>
> ---
>  tools/testing/selftests/ftrace/config              |    4 ++
>  .../ftrace/test.d/kprobe/kprobe_module.tc          |   35 ++++++++++++++++++--
>  2 files changed, 36 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/testing/selftests/ftrace/config b/tools/testing/selftests/ftrace/config
> index 07db5ab09cc7..32cf61b6bb54 100644
> --- a/tools/testing/selftests/ftrace/config
> +++ b/tools/testing/selftests/ftrace/config
> @@ -7,3 +7,7 @@ CONFIG_HIST_TRIGGERS=y
>  CONFIG_PREEMPT_TRACER=y
>  CONFIG_IRQSOFF_TRACER=y
>  CONFIG_PREEMPTIRQ_DELAY_TEST=m
> +CONFIG_MODULES=y
> +CONFIG_MODULE_UNLOAD=y
> +CONFIG_SAMPLES=y
> +CONFIG_SAMPLE_TRACE_PRINTK=m
> diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_module.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_module.tc
> index ec6c5fffef1e..1efe9e616bc4 100644
> --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_module.tc
> +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_module.tc
> @@ -4,11 +4,18 @@
>  
>  [ -f kprobe_events ] || exit_unsupported # this is configurable
>  
> +rmmod trace-printk ||:
> +if ! modprobe trace-printk.ko ; then

"modprobe trace-printk.ko" dosen't work. You need to drop the .ko

> +  echo "No trace-printk sample module - please make CONFIG_SAMPLE_TRACE_PRINTK=
> +m"
> +  exit_unresolved;
> +fi
> +
> +MOD=trace_printk
> +FUNC=trace_printk_irq_work
> +
>  :;: "Add an event on a module function without specifying event name" ;:
>  
> -MOD=`lsmod | head -n 2 | tail -n 1 | cut -f1 -d" "`
> -FUNC=`grep -m 1 ".* t .*\\[$MOD\\]" /proc/kallsyms | xargs | cut -f3 -d" "`
> -[ "x" != "x$MOD" -a "y" != "y$FUNC" ] || exit_unresolved
>  echo "p $MOD:$FUNC" > kprobe_events
>  PROBE_NAME=`echo $MOD:$FUNC | tr ".:" "_"`
>  test -d events/kprobes/p_${PROBE_NAME}_0 || exit_failure
> @@ -22,3 +29,25 @@ test -d events/kprobes/event1 || exit_failure
>  
>  echo "p:kprobes1/event1 $MOD:$FUNC" > kprobe_events
>  test -d events/kprobes1/event1 || exit_failure
> +
> +:;: "Remove target module, but event still be there" ;:
> +if ! rmmod trace-printk ; then
> +  echo "Failed to unload module - please enable CONFIG_MODULE_UNLOAD"
> +  exit_unresolved;
> +fi
> +test -d events/kprobes1/event1
> +
> +:;: "Check posibility to defining events on unloaded module";:
> +echo "p:event2 $MOD:$FUNC" >> kprobe_events
> +
> +:;: "Target is gone, but we can prepare for next time";:
> +echo 1 > events/kprobes1/event1/enable
> +
> +:;: "Load module again, which means the event1 should be recorded";:
> +modprobe trace-printk.ko

Same here.

-- Steve

> +grep "event1:" trace
> +
> +:;: "Remove the module again and check the event is not locked"
> +rmmod trace-printk
> +echo 0 > events/kprobes1/event1/enable
> +echo "-:kprobes1/event1" >> kprobe_events

WARNING: multiple messages have this Message-ID (diff)
From: rostedt@goodmis.org (Steven Rostedt)
Subject: [PATCH v2 12/32] selftests/ftrace: Improve kprobe on module testcase to load/unload module
Date: Fri, 24 Aug 2018 19:07:08 -0400	[thread overview]
Message-ID: <20180824190708.3c170cc6@gandalf.local.home> (raw)
Message-ID: <20180824230708.GPLkg6_vQUSLeceVpZhIj9YHfJL3jZpmg1lyzkRl3-Q@z> (raw)
In-Reply-To: <153443729154.23257.15704810148795897178.stgit@devbox>

On Fri, 17 Aug 2018 01:34:51 +0900
Masami Hiramatsu <mhiramat@kernel.org> wrote:

> Improve kprobe events on module testcase to check module
> load/unload with disabled/enabled events. This also change
> the target module to trace_printk.ko, so it depends on
> CONFIG_SAMPLE_TRACE_PRINTK=m.
> 
> Signed-off-by: Masami Hiramatsu <mhiramat at kernel.org>
> ---
>  tools/testing/selftests/ftrace/config              |    4 ++
>  .../ftrace/test.d/kprobe/kprobe_module.tc          |   35 ++++++++++++++++++--
>  2 files changed, 36 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/testing/selftests/ftrace/config b/tools/testing/selftests/ftrace/config
> index 07db5ab09cc7..32cf61b6bb54 100644
> --- a/tools/testing/selftests/ftrace/config
> +++ b/tools/testing/selftests/ftrace/config
> @@ -7,3 +7,7 @@ CONFIG_HIST_TRIGGERS=y
>  CONFIG_PREEMPT_TRACER=y
>  CONFIG_IRQSOFF_TRACER=y
>  CONFIG_PREEMPTIRQ_DELAY_TEST=m
> +CONFIG_MODULES=y
> +CONFIG_MODULE_UNLOAD=y
> +CONFIG_SAMPLES=y
> +CONFIG_SAMPLE_TRACE_PRINTK=m
> diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_module.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_module.tc
> index ec6c5fffef1e..1efe9e616bc4 100644
> --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_module.tc
> +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_module.tc
> @@ -4,11 +4,18 @@
>  
>  [ -f kprobe_events ] || exit_unsupported # this is configurable
>  
> +rmmod trace-printk ||:
> +if ! modprobe trace-printk.ko ; then

"modprobe trace-printk.ko" dosen't work. You need to drop the .ko

> +  echo "No trace-printk sample module - please make CONFIG_SAMPLE_TRACE_PRINTK=
> +m"
> +  exit_unresolved;
> +fi
> +
> +MOD=trace_printk
> +FUNC=trace_printk_irq_work
> +
>  :;: "Add an event on a module function without specifying event name" ;:
>  
> -MOD=`lsmod | head -n 2 | tail -n 1 | cut -f1 -d" "`
> -FUNC=`grep -m 1 ".* t .*\\[$MOD\\]" /proc/kallsyms | xargs | cut -f3 -d" "`
> -[ "x" != "x$MOD" -a "y" != "y$FUNC" ] || exit_unresolved
>  echo "p $MOD:$FUNC" > kprobe_events
>  PROBE_NAME=`echo $MOD:$FUNC | tr ".:" "_"`
>  test -d events/kprobes/p_${PROBE_NAME}_0 || exit_failure
> @@ -22,3 +29,25 @@ test -d events/kprobes/event1 || exit_failure
>  
>  echo "p:kprobes1/event1 $MOD:$FUNC" > kprobe_events
>  test -d events/kprobes1/event1 || exit_failure
> +
> +:;: "Remove target module, but event still be there" ;:
> +if ! rmmod trace-printk ; then
> +  echo "Failed to unload module - please enable CONFIG_MODULE_UNLOAD"
> +  exit_unresolved;
> +fi
> +test -d events/kprobes1/event1
> +
> +:;: "Check posibility to defining events on unloaded module";:
> +echo "p:event2 $MOD:$FUNC" >> kprobe_events
> +
> +:;: "Target is gone, but we can prepare for next time";:
> +echo 1 > events/kprobes1/event1/enable
> +
> +:;: "Load module again, which means the event1 should be recorded";:
> +modprobe trace-printk.ko

Same here.

-- Steve

> +grep "event1:" trace
> +
> +:;: "Remove the module again and check the event is not locked"
> +rmmod trace-printk
> +echo 0 > events/kprobes1/event1/enable
> +echo "-:kprobes1/event1" >> kprobe_events

  parent reply	other threads:[~2018-08-24 23:07 UTC|newest]

Thread overview: 152+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-16 16:29 [PATCH v2 00/32] selftests/ftrace: Improve ftracetest with coverage check mhiramat
2018-08-16 16:29 ` Masami Hiramatsu
2018-08-16 16:29 ` [PATCH v2 01/32] tracing: Allow gcov profiling on only ftrace subsystem mhiramat
2018-08-16 16:29   ` Masami Hiramatsu
2018-08-20 15:32   ` rostedt
2018-08-20 15:32     ` Steven Rostedt
2018-08-20 15:33     ` rostedt
2018-08-20 15:33       ` Steven Rostedt
2018-08-21  6:53       ` mhiramat
2018-08-21  6:53         ` Masami Hiramatsu
2018-08-16 16:30 ` [PATCH v2 02/32] selftests/ftrace: Add --stop-fail hidden option for debug mhiramat
2018-08-16 16:30   ` Masami Hiramatsu
2018-08-24 20:38   ` rostedt
2018-08-24 20:38     ` Steven Rostedt
2018-08-16 16:30 ` [PATCH v2 03/32] selftests/ftrace: Add --console hidden option mhiramat
2018-08-16 16:30   ` Masami Hiramatsu
2018-08-24 20:37   ` rostedt
2018-08-24 20:37     ` Steven Rostedt
2018-08-25  1:35     ` mhiramat
2018-08-25  1:35       ` Masami Hiramatsu
2018-08-25  1:42       ` rostedt
2018-08-25  1:42         ` Steven Rostedt
2018-08-26  7:28         ` mhiramat
2018-08-26  7:28           ` Masami Hiramatsu
2018-08-16 16:31 ` [PATCH v2 04/32] selftests/ftrace: Add case number prefix to logfile mhiramat
2018-08-16 16:31   ` Masami Hiramatsu
2018-08-24 21:47   ` rostedt
2018-08-24 21:47     ` Steven Rostedt
2018-08-16 16:31 ` [PATCH v2 05/32] selftests/ftrace: More initialize features in initialize_ftrace mhiramat
2018-08-16 16:31   ` Masami Hiramatsu
2018-08-24 21:24   ` rostedt
2018-08-24 21:24     ` Steven Rostedt
2018-08-24 21:46   ` rostedt
2018-08-24 21:46     ` Steven Rostedt
2018-08-24 21:46     ` rostedt
2018-08-24 21:46       ` Steven Rostedt
2018-08-16 16:32 ` [PATCH v2 06/32] selftests/ftrace: Add SPDX License Identifier to template mhiramat
2018-08-16 16:32   ` Masami Hiramatsu
2018-08-16 16:32 ` [PATCH v2 07/32] selftests/ftrace: Cleanup ftrace after running test mhiramat
2018-08-16 16:32   ` Masami Hiramatsu
2018-08-16 16:32 ` [PATCH v2 08/32] selftests/ftrace: Remove unneeded per-test init/cleanup ftrace mhiramat
2018-08-16 16:32   ` Masami Hiramatsu
2018-08-16 16:33 ` [PATCH v2 09/32] selftests/ftrace: Fix to test kprobe $comm arg only if available mhiramat
2018-08-16 16:33   ` Masami Hiramatsu
2018-08-16 16:33 ` [PATCH v2 10/32] selftests/ftrace: Fix checkbashisms errors mhiramat
2018-08-16 16:33   ` Masami Hiramatsu
2018-08-24 21:50   ` rostedt
2018-08-24 21:50     ` Steven Rostedt
2018-08-16 16:34 ` [PATCH v2 11/32] selftests/ftrace: Use loopback address instead of localhost mhiramat
2018-08-16 16:34   ` Masami Hiramatsu
2018-08-24 21:52   ` rostedt
2018-08-24 21:52     ` Steven Rostedt
2018-08-25  1:47     ` mhiramat
2018-08-25  1:47       ` Masami Hiramatsu
2018-08-16 16:34 ` [PATCH v2 12/32] selftests/ftrace: Improve kprobe on module testcase to load/unload module mhiramat
2018-08-16 16:34   ` Masami Hiramatsu
2018-08-24 23:07   ` rostedt [this message]
2018-08-24 23:07     ` Steven Rostedt
2018-08-16 16:35 ` [PATCH v2 13/32] selftests/ftrace: Improve kprobe testcase to check log data mhiramat
2018-08-16 16:35   ` Masami Hiramatsu
2018-08-16 16:35 ` [PATCH v2 14/32] selftests/ftrace: Improve kretprobe " mhiramat
2018-08-16 16:35   ` Masami Hiramatsu
2018-08-16 16:36 ` [PATCH v2 15/32] selftests/ftrace: Test kprobe-event argument with various bitsize mhiramat
2018-08-16 16:36   ` Masami Hiramatsu
2018-08-16 16:36 ` [PATCH v2 16/32] selftests/ftrace: Check set_event_pid result mhiramat
2018-08-16 16:36   ` Masami Hiramatsu
2018-08-16 16:37 ` [PATCH v2 17/32] selftests/ftrace: Add kprobe event with $comm argument testcase mhiramat
2018-08-16 16:37   ` Masami Hiramatsu
2018-08-16 16:37 ` [PATCH v2 18/32] selftests/ftrace: Add kprobe profile testcase mhiramat
2018-08-16 16:37   ` Masami Hiramatsu
2018-08-16 16:38 ` [PATCH v2 19/32] selftests/ftrace: Add a testcase for nop tracer mhiramat
2018-08-16 16:38   ` Masami Hiramatsu
2018-08-24 22:53   ` rostedt
2018-08-24 22:53     ` Steven Rostedt
2018-08-26  7:30     ` mhiramat
2018-08-26  7:30       ` Masami Hiramatsu
2018-08-16 16:38 ` [PATCH v2 20/32] selftests/ftrace: Add kprobe-event with symbol argument test mhiramat
2018-08-16 16:38   ` Masami Hiramatsu
2018-08-16 16:39 ` [PATCH v2 21/32] selftests/ftrace: Add trace_printk sample module test mhiramat
2018-08-16 16:39   ` Masami Hiramatsu
2018-08-24 23:06   ` rostedt
2018-08-24 23:06     ` Steven Rostedt
2018-08-26  8:43     ` mhiramat
2018-08-26  8:43       ` Masami Hiramatsu
2018-08-16 16:39 ` [PATCH v2 22/32] selftests/ftrace: Add ringbuffer size changing testcase mhiramat
2018-08-16 16:39   ` Masami Hiramatsu
2018-08-24 23:18   ` rostedt
2018-08-24 23:18     ` Steven Rostedt
2018-08-30  7:12     ` mhiramat
2018-08-30  7:12       ` Masami Hiramatsu
2018-08-30 15:50       ` rostedt
2018-08-30 15:50         ` Steven Rostedt
2018-08-30 23:35         ` mhiramat
2018-08-30 23:35           ` Masami Hiramatsu
2018-08-30 23:40           ` rostedt
2018-08-30 23:40             ` Steven Rostedt
2018-08-16 16:40 ` [PATCH v2 23/32] selftests/ftrace: Add function profiling stat testcase mhiramat
2018-08-16 16:40   ` Masami Hiramatsu
2018-08-24 23:20   ` rostedt
2018-08-24 23:20     ` Steven Rostedt
2018-08-26 11:20     ` mhiramat
2018-08-26 11:20       ` Masami Hiramatsu
2018-08-16 16:40 ` [PATCH v2 24/32] selftests/ftrace: Add max stack tracer testcase mhiramat
2018-08-16 16:40   ` Masami Hiramatsu
2018-08-24 23:23   ` rostedt
2018-08-24 23:23     ` Steven Rostedt
2018-08-25  1:45     ` mhiramat
2018-08-25  1:45       ` Masami Hiramatsu
2018-08-25  2:41       ` rostedt
2018-08-25  2:41         ` Steven Rostedt
2018-08-26  8:42         ` mhiramat
2018-08-26  8:42           ` Masami Hiramatsu
2018-08-16 16:40 ` [PATCH v2 25/32] selftests/ftrace: Add function filter on module testcase mhiramat
2018-08-16 16:40   ` Masami Hiramatsu
2018-08-24 23:25   ` rostedt
2018-08-24 23:25     ` Steven Rostedt
2018-08-16 16:41 ` [PATCH v2 26/32] selftests/ftrace: Add trace_pipe testcase mhiramat
2018-08-16 16:41   ` Masami Hiramatsu
2018-08-24 23:26   ` rostedt
2018-08-24 23:26     ` Steven Rostedt
2018-08-26 11:20     ` mhiramat
2018-08-26 11:20       ` Masami Hiramatsu
2018-08-16 16:41 ` [PATCH v2 27/32] selftests/ftrace: Add stacktrace ftrace filter command testcase mhiramat
2018-08-16 16:41   ` Masami Hiramatsu
2018-08-24 23:28   ` rostedt
2018-08-24 23:28     ` Steven Rostedt
2018-08-16 16:42 ` [PATCH v2 28/32] selftests/ftrace: Add wakeup tracer testcase mhiramat
2018-08-16 16:42   ` Masami Hiramatsu
2018-08-16 16:42 ` [PATCH v2 29/32] selftests/ftrace: Add wakeup_rt " mhiramat
2018-08-16 16:42   ` Masami Hiramatsu
2018-08-25  2:09   ` rostedt
2018-08-25  2:09     ` Steven Rostedt
2018-08-26 11:22     ` mhiramat
2018-08-26 11:22       ` Masami Hiramatsu
2018-08-16 16:43 ` [PATCH v2 30/32] selftests/ftrace: Add ftrace cpumask testcase mhiramat
2018-08-16 16:43   ` Masami Hiramatsu
2018-08-25  2:18   ` rostedt
2018-08-25  2:18     ` Steven Rostedt
2018-08-27 12:16     ` mhiramat
2018-08-27 12:16       ` Masami Hiramatsu
2018-08-16 16:43 ` [PATCH v2 31/32] selftests/ftrace: Add output format testcase mhiramat
2018-08-16 16:43   ` Masami Hiramatsu
2018-08-25  2:19   ` rostedt
2018-08-25  2:19     ` Steven Rostedt
2018-08-30  7:48     ` mhiramat
2018-08-30  7:48       ` Masami Hiramatsu
2018-08-16 16:44 ` [PATCH v2 32/32] selftests/ftrace: Add blktrace testcase mhiramat
2018-08-16 16:44   ` Masami Hiramatsu
2018-08-25  2:22   ` rostedt
2018-08-25  2:22     ` Steven Rostedt
2018-08-30  7:53     ` mhiramat
2018-08-30  7:53       ` Masami Hiramatsu

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=20180824190708.3c170cc6@gandalf.local.home \
    --to=linux-kselftest@vger.kernel.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