linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] selftests/tracing: Fix ftracetest testcase issues
@ 2024-05-31  9:43 Masami Hiramatsu (Google)
  2024-05-31  9:43 ` [PATCH 1/2] selftests/tracing: Fix event filter test to retry up to 10 times Masami Hiramatsu (Google)
  2024-05-31  9:43 ` [PATCH 2/2] selftests/tracing: Fix to check the required syscall event Masami Hiramatsu (Google)
  0 siblings, 2 replies; 6+ messages in thread
From: Masami Hiramatsu (Google) @ 2024-05-31  9:43 UTC (permalink / raw)
  To: Steven Rostedt, Shuah Khan
  Cc: linux-kernel, linux-trace-kernel, mhiramat, linux-kselftest

Here is a couple of patches to fix issues related to runing environment
and kernel configuration.

Thank you,
---

Masami Hiramatsu (Google) (2):
      selftests/tracing: Fix event filter test to retry up to 10 times
      selftests/tracing: Fix to check the required syscall event


 .../ftrace/test.d/dynevent/test_duplicates.tc      |    2 +-
 .../ftrace/test.d/filter/event-filter-function.tc  |   20 +++++++++++++++++++-
 2 files changed, 20 insertions(+), 2 deletions(-)

--
Masami Hiramatsu (Google) <mhiramat@kernel.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] selftests/tracing: Fix event filter test to retry up to 10 times
  2024-05-31  9:43 [PATCH 0/2] selftests/tracing: Fix ftracetest testcase issues Masami Hiramatsu (Google)
@ 2024-05-31  9:43 ` Masami Hiramatsu (Google)
  2024-05-31 14:41   ` Shuah Khan
  2024-05-31  9:43 ` [PATCH 2/2] selftests/tracing: Fix to check the required syscall event Masami Hiramatsu (Google)
  1 sibling, 1 reply; 6+ messages in thread
From: Masami Hiramatsu (Google) @ 2024-05-31  9:43 UTC (permalink / raw)
  To: Steven Rostedt, Shuah Khan
  Cc: linux-kernel, linux-trace-kernel, mhiramat, linux-kselftest

From: Masami Hiramatsu (Google) <mhiramat@kernel.org>

Commit eb50d0f250e9 ("selftests/ftrace: Choose target function for filter
test from samples") choose the target function from samples, but sometimes
this test failes randomly because the target function does not hit at the
next time. So retry getting samples up to 10 times.

Fixes: eb50d0f250e9 ("selftests/ftrace: Choose target function for filter test from samples")
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
 .../ftrace/test.d/filter/event-filter-function.tc  |   20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/ftrace/test.d/filter/event-filter-function.tc b/tools/testing/selftests/ftrace/test.d/filter/event-filter-function.tc
index 3f74c09c56b6..118247b8dd84 100644
--- a/tools/testing/selftests/ftrace/test.d/filter/event-filter-function.tc
+++ b/tools/testing/selftests/ftrace/test.d/filter/event-filter-function.tc
@@ -10,7 +10,6 @@ fail() { #msg
 }
 
 sample_events() {
-    echo > trace
     echo 1 > events/kmem/kmem_cache_free/enable
     echo 1 > tracing_on
     ls > /dev/null
@@ -22,6 +21,7 @@ echo 0 > tracing_on
 echo 0 > events/enable
 
 echo "Get the most frequently calling function"
+echo > trace
 sample_events
 
 target_func=`cat trace | grep -o 'call_site=\([^+]*\)' | sed 's/call_site=//' | sort | uniq -c | sort | tail -n 1 | sed 's/^[ 0-9]*//'`
@@ -32,7 +32,16 @@ echo > trace
 
 echo "Test event filter function name"
 echo "call_site.function == $target_func" > events/kmem/kmem_cache_free/filter
+
+sample_events
+max_retry=10
+while [ `grep kmem_cache_free trace| wc -l` -eq 0 ]; do
 sample_events
+max_retry=$((max_retry - 1))
+if [ $max_retry -eq 0 ]; then
+	exit_fail
+fi
+done
 
 hitcnt=`grep kmem_cache_free trace| grep $target_func | wc -l`
 misscnt=`grep kmem_cache_free trace| grep -v $target_func | wc -l`
@@ -49,7 +58,16 @@ address=`grep " ${target_func}\$" /proc/kallsyms | cut -d' ' -f1`
 
 echo "Test event filter function address"
 echo "call_site.function == 0x$address" > events/kmem/kmem_cache_free/filter
+echo > trace
+sample_events
+max_retry=10
+while [ `grep kmem_cache_free trace| wc -l` -eq 0 ]; do
 sample_events
+max_retry=$((max_retry - 1))
+if [ $max_retry -eq 0 ]; then
+	exit_fail
+fi
+done
 
 hitcnt=`grep kmem_cache_free trace| grep $target_func | wc -l`
 misscnt=`grep kmem_cache_free trace| grep -v $target_func | wc -l`


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] selftests/tracing: Fix to check the required syscall event
  2024-05-31  9:43 [PATCH 0/2] selftests/tracing: Fix ftracetest testcase issues Masami Hiramatsu (Google)
  2024-05-31  9:43 ` [PATCH 1/2] selftests/tracing: Fix event filter test to retry up to 10 times Masami Hiramatsu (Google)
@ 2024-05-31  9:43 ` Masami Hiramatsu (Google)
  2024-05-31 14:41   ` Shuah Khan
  1 sibling, 1 reply; 6+ messages in thread
From: Masami Hiramatsu (Google) @ 2024-05-31  9:43 UTC (permalink / raw)
  To: Steven Rostedt, Shuah Khan
  Cc: linux-kernel, linux-trace-kernel, mhiramat, linux-kselftest

From: Masami Hiramatsu (Google) <mhiramat@kernel.org>

Since test_duplicates.tc depends on syscalls/sys_enter_openat event,
it must add the event file to `requires`.
Without this fix, the test fails if CONFIG_FTRACE_SYSCALLS=n.

Fixes: 297e1dcdca3d ("selftests/ftrace: Add selftest for testing duplicate eprobes and kprobes")
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
 .../ftrace/test.d/dynevent/test_duplicates.tc      |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/ftrace/test.d/dynevent/test_duplicates.tc b/tools/testing/selftests/ftrace/test.d/dynevent/test_duplicates.tc
index d3a79da215c8..5f72abe6fa79 100644
--- a/tools/testing/selftests/ftrace/test.d/dynevent/test_duplicates.tc
+++ b/tools/testing/selftests/ftrace/test.d/dynevent/test_duplicates.tc
@@ -1,7 +1,7 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0
 # description: Generic dynamic event - check if duplicate events are caught
-# requires: dynamic_events "e[:[<group>/][<event>]] <attached-group>.<attached-event> [<args>]":README
+# requires: dynamic_events "e[:[<group>/][<event>]] <attached-group>.<attached-event> [<args>]":README events/syscalls/sys_enter_openat
 
 echo 0 > events/enable
 


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] selftests/tracing: Fix to check the required syscall event
  2024-05-31  9:43 ` [PATCH 2/2] selftests/tracing: Fix to check the required syscall event Masami Hiramatsu (Google)
@ 2024-05-31 14:41   ` Shuah Khan
  2024-05-31 15:00     ` Masami Hiramatsu
  0 siblings, 1 reply; 6+ messages in thread
From: Shuah Khan @ 2024-05-31 14:41 UTC (permalink / raw)
  To: Masami Hiramatsu (Google), Steven Rostedt, Shuah Khan
  Cc: linux-kernel, linux-trace-kernel, linux-kselftest, Shuah Khan

On 5/31/24 03:43, Masami Hiramatsu (Google) wrote:
> From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> 
> Since test_duplicates.tc depends on syscalls/sys_enter_openat event,
> it must add the event file to `requires`.
> Without this fix, the test fails if CONFIG_FTRACE_SYSCALLS=n.
> 
> Fixes: 297e1dcdca3d ("selftests/ftrace: Add selftest for testing duplicate eprobes and kprobes")
> Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> ---
>   .../ftrace/test.d/dynevent/test_duplicates.tc      |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/ftrace/test.d/dynevent/test_duplicates.tc b/tools/testing/selftests/ftrace/test.d/dynevent/test_duplicates.tc
> index d3a79da215c8..5f72abe6fa79 100644
> --- a/tools/testing/selftests/ftrace/test.d/dynevent/test_duplicates.tc
> +++ b/tools/testing/selftests/ftrace/test.d/dynevent/test_duplicates.tc
> @@ -1,7 +1,7 @@
>   #!/bin/sh
>   # SPDX-License-Identifier: GPL-2.0
>   # description: Generic dynamic event - check if duplicate events are caught
> -# requires: dynamic_events "e[:[<group>/][<event>]] <attached-group>.<attached-event> [<args>]":README
> +# requires: dynamic_events "e[:[<group>/][<event>]] <attached-group>.<attached-event> [<args>]":README events/syscalls/sys_enter_openat
>   
>   echo 0 > events/enable
>   
> 
> 

This change is already in mainline. I sent the fix up in my 6.10-rc1 pr?
The short log is a slightly different:

commit f6c3c83db1d939ebdb8c8922748ae647d8126d91
Author: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Date:   Tue May 21 09:00:22 2024 +0900

     selftests/ftrace: Fix to check required event file
     
     The dynevent/test_duplicates.tc test case uses `syscalls/sys_enter_openat`
     event for defining eprobe on it. Since this `syscalls` events depend on
     CONFIG_FTRACE_SYSCALLS=y, if it is not set, the test will fail.
     
     Add the event file to `required` line so that the test will return
     `unsupported` result.
     
     Fixes: 297e1dcdca3d ("selftests/ftrace: Add selftest for testing duplicate eprobes and kprobes")
     Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
     Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

thanks,
-- Shuah

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] selftests/tracing: Fix event filter test to retry up to 10 times
  2024-05-31  9:43 ` [PATCH 1/2] selftests/tracing: Fix event filter test to retry up to 10 times Masami Hiramatsu (Google)
@ 2024-05-31 14:41   ` Shuah Khan
  0 siblings, 0 replies; 6+ messages in thread
From: Shuah Khan @ 2024-05-31 14:41 UTC (permalink / raw)
  To: Masami Hiramatsu (Google), Steven Rostedt, Shuah Khan
  Cc: linux-kernel, linux-trace-kernel, linux-kselftest, Shuah Khan

On 5/31/24 03:43, Masami Hiramatsu (Google) wrote:
> From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> 
> Commit eb50d0f250e9 ("selftests/ftrace: Choose target function for filter
> test from samples") choose the target function from samples, but sometimes
> this test failes randomly because the target function does not hit at the
> next time. So retry getting samples up to 10 times.
> 
> Fixes: eb50d0f250e9 ("selftests/ftrace: Choose target function for filter test from samples")
> Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> ---

Applied to linux-kselftest fixes for the next rc

thanks,
-- Shuah

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] selftests/tracing: Fix to check the required syscall event
  2024-05-31 14:41   ` Shuah Khan
@ 2024-05-31 15:00     ` Masami Hiramatsu
  0 siblings, 0 replies; 6+ messages in thread
From: Masami Hiramatsu @ 2024-05-31 15:00 UTC (permalink / raw)
  To: Shuah Khan
  Cc: Steven Rostedt, Shuah Khan, linux-kernel, linux-trace-kernel,
	linux-kselftest

On Fri, 31 May 2024 08:41:00 -0600
Shuah Khan <skhan@linuxfoundation.org> wrote:

> On 5/31/24 03:43, Masami Hiramatsu (Google) wrote:
> > From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> > 
> > Since test_duplicates.tc depends on syscalls/sys_enter_openat event,
> > it must add the event file to `requires`.
> > Without this fix, the test fails if CONFIG_FTRACE_SYSCALLS=n.
> > 
> > Fixes: 297e1dcdca3d ("selftests/ftrace: Add selftest for testing duplicate eprobes and kprobes")
> > Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> > ---
> >   .../ftrace/test.d/dynevent/test_duplicates.tc      |    2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tools/testing/selftests/ftrace/test.d/dynevent/test_duplicates.tc b/tools/testing/selftests/ftrace/test.d/dynevent/test_duplicates.tc
> > index d3a79da215c8..5f72abe6fa79 100644
> > --- a/tools/testing/selftests/ftrace/test.d/dynevent/test_duplicates.tc
> > +++ b/tools/testing/selftests/ftrace/test.d/dynevent/test_duplicates.tc
> > @@ -1,7 +1,7 @@
> >   #!/bin/sh
> >   # SPDX-License-Identifier: GPL-2.0
> >   # description: Generic dynamic event - check if duplicate events are caught
> > -# requires: dynamic_events "e[:[<group>/][<event>]] <attached-group>.<attached-event> [<args>]":README
> > +# requires: dynamic_events "e[:[<group>/][<event>]] <attached-group>.<attached-event> [<args>]":README events/syscalls/sys_enter_openat
> >   
> >   echo 0 > events/enable
> >   
> > 
> > 
> 
> This change is already in mainline. I sent the fix up in my 6.10-rc1 pr?

Oops, sorry, I forgot to pick it to my working branch...

Thanks!

> The short log is a slightly different:
> 
> commit f6c3c83db1d939ebdb8c8922748ae647d8126d91
> Author: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> Date:   Tue May 21 09:00:22 2024 +0900
> 
>      selftests/ftrace: Fix to check required event file
>      
>      The dynevent/test_duplicates.tc test case uses `syscalls/sys_enter_openat`
>      event for defining eprobe on it. Since this `syscalls` events depend on
>      CONFIG_FTRACE_SYSCALLS=y, if it is not set, the test will fail.
>      
>      Add the event file to `required` line so that the test will return
>      `unsupported` result.
>      
>      Fixes: 297e1dcdca3d ("selftests/ftrace: Add selftest for testing duplicate eprobes and kprobes")
>      Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
>      Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
> 
> thanks,
> -- Shuah


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-05-31 15:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-31  9:43 [PATCH 0/2] selftests/tracing: Fix ftracetest testcase issues Masami Hiramatsu (Google)
2024-05-31  9:43 ` [PATCH 1/2] selftests/tracing: Fix event filter test to retry up to 10 times Masami Hiramatsu (Google)
2024-05-31 14:41   ` Shuah Khan
2024-05-31  9:43 ` [PATCH 2/2] selftests/tracing: Fix to check the required syscall event Masami Hiramatsu (Google)
2024-05-31 14:41   ` Shuah Khan
2024-05-31 15:00     ` Masami Hiramatsu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).