diff mbox series

ftrace/selftests: Fix pid test with function graph not showing pids

Message ID 20240604152550.0c01d7cd@gandalf.local.home (mailing list archive)
State Accepted
Commit 5efe9688f9488e8e95177d03be2678021233e877
Headers show
Series ftrace/selftests: Fix pid test with function graph not showing pids | expand

Commit Message

Steven Rostedt June 4, 2024, 7:25 p.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

The pid filtering test will set the pid filters and make sure that both
function and function_graph tracing honors the filters. But the
function_graph tracer test was failing because the PID was not being
filtered properly. That's because the funcgraph-proc option wasn't getting
set. Without that option the PID is not shown.

Instead we get:

	+ cat trace
	# tracer: function_graph
	#
	# CPU  DURATION                  FUNCTION CALLS
	# |     |   |                     |   |   |   |
	 3) ! 143.685 us  |  kernel_clone();
	 3) ! 127.055 us  |  kernel_clone();
	 1) ! 127.170 us  |  kernel_clone();
	 3) ! 126.840 us  |  kernel_clone();

When we should be getting:

	+ cat trace
	# tracer: function_graph
	#
	# CPU  TASK/PID         DURATION                  FUNCTION CALLS
	# |     |    |           |   |                     |   |   |   |
	 4)    bash-939    | # 1070.009 us |  kernel_clone();
	 4)    bash-939    | # 1116.903 us |  kernel_clone();
	 5)    bash-939    | ! 976.133 us  |  kernel_clone();
	 5)    bash-939    | ! 954.012 us  |  kernel_clone();

The test looks for the pids it is filtering and will fail if it can not
find them. Without fungraph-proc option set, it will not be displayed and
the test will fail.

Link: https://lore.kernel.org/all/Zl9JFnzKGuUM10X2@J2N7QTR9R3/

Fixes: 35b944a997e2 ("selftests/ftrace: Add function_graph tracer to func-filter-pid test")
Reported-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc | 2 ++
 1 file changed, 2 insertions(+)

Comments

Mark Rutland June 5, 2024, 9:45 a.m. UTC | #1
On Tue, Jun 04, 2024 at 03:25:50PM -0400, Steven Rostedt wrote:
> From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
> 
> The pid filtering test will set the pid filters and make sure that both
> function and function_graph tracing honors the filters. But the
> function_graph tracer test was failing because the PID was not being
> filtered properly. That's because the funcgraph-proc option wasn't getting
> set. Without that option the PID is not shown.
> 
> Instead we get:
> 
> 	+ cat trace
> 	# tracer: function_graph
> 	#
> 	# CPU  DURATION                  FUNCTION CALLS
> 	# |     |   |                     |   |   |   |
> 	 3) ! 143.685 us  |  kernel_clone();
> 	 3) ! 127.055 us  |  kernel_clone();
> 	 1) ! 127.170 us  |  kernel_clone();
> 	 3) ! 126.840 us  |  kernel_clone();
> 
> When we should be getting:
> 
> 	+ cat trace
> 	# tracer: function_graph
> 	#
> 	# CPU  TASK/PID         DURATION                  FUNCTION CALLS
> 	# |     |    |           |   |                     |   |   |   |
> 	 4)    bash-939    | # 1070.009 us |  kernel_clone();
> 	 4)    bash-939    | # 1116.903 us |  kernel_clone();
> 	 5)    bash-939    | ! 976.133 us  |  kernel_clone();
> 	 5)    bash-939    | ! 954.012 us  |  kernel_clone();
> 
> The test looks for the pids it is filtering and will fail if it can not
> find them. Without fungraph-proc option set, it will not be displayed and
> the test will fail.
> 
> Link: https://lore.kernel.org/all/Zl9JFnzKGuUM10X2@J2N7QTR9R3/
> 
> Fixes: 35b944a997e2 ("selftests/ftrace: Add function_graph tracer to func-filter-pid test")
> Reported-by: Mark Rutland <mark.rutland@arm.com>
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>

Applying this makes the pid filter tests go from FAIL to PASS, so FWIW:

Tested-by: Mark Rutland <mark.rutland@arm.com>

Mark.

> ---
>  tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc b/tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc
> index c6fc9d31a496..8dcce001881d 100644
> --- a/tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc
> +++ b/tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc
> @@ -8,6 +8,7 @@
>  # Also test it on an instance directory
>  
>  do_function_fork=1
> +do_funcgraph_proc=1
>  
>  if [ ! -f options/function-fork ]; then
>      do_function_fork=0
> @@ -28,6 +29,7 @@ fi
>  
>  if [ $do_funcgraph_proc -eq 1 ]; then
>      orig_value2=`cat options/funcgraph-proc`
> +    echo 1 > options/funcgraph-proc
>  fi
>  
>  do_reset() {
> -- 
> 2.43.0
>
diff mbox series

Patch

diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc b/tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc
index c6fc9d31a496..8dcce001881d 100644
--- a/tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc
+++ b/tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc
@@ -8,6 +8,7 @@ 
 # Also test it on an instance directory
 
 do_function_fork=1
+do_funcgraph_proc=1
 
 if [ ! -f options/function-fork ]; then
     do_function_fork=0
@@ -28,6 +29,7 @@  fi
 
 if [ $do_funcgraph_proc -eq 1 ]; then
     orig_value2=`cat options/funcgraph-proc`
+    echo 1 > options/funcgraph-proc
 fi
 
 do_reset() {