Re: [PATCH v3 00/27] function_graph: Allow multiple users for function graph tracing

Steven Rostedt
2024-06-04T19:18:23Z

On Tue, 4 Jun 2024 14:57:42 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> Bah, I just ran the test.d/ftrace/func-filter-pid.tc and it fails too. This
> did pass my other tests that do run ftracetests. Hmm, I just ran it on my
> test box that does the tests and it passes there. I wonder if there's some
> config option that makes it fail :-/
>
> Well, now that I see it fail, I can investigate.

Ah, figured it out. The updated pid test isn't working. This explains why
my test machine didn't fail, as it doesn't have the updated ftracetests.

The problem was that I never set the funcgraph-proc option, even though I
saved it :-p

That is, it shows:

> + 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();

But when you do: echo 1 > options/funcgraph-proc

You get:

# 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();
5) bash-939 | ! 905.825 us | kernel_clone();
5) bash-939 | # 1130.922 us | kernel_clone();
7) bash-939 | # 1097.648 us | kernel_clone();
0) bash-939 | # 1008.000 us | kernel_clone();
3) bash-939 | # 1023.391 us | kernel_clone();
4) bash-939 | # 1033.008 us | kernel_clone();
4) bash-939 | ! 949.072 us | kernel_clone();
4) bash-939 | # 1027.990 us | kernel_clone();
4) bash-939 | ! 954.678 us | kernel_clone();
4) bash-939 | ! 996.557 us | kernel_clone();

Without that option, function graph does no show what process is being
recorded (except at sched switch)

Can you add this patch to the test and see if it works again?

-- Steve

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() {