linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] ftrace/selftest: Test combination of function_graph tracer and function profiler
@ 2024-10-04 18:56 Steven Rostedt
  2024-10-08  0:33 ` Masami Hiramatsu
  2024-10-10 20:45 ` Shuah Khan
  0 siblings, 2 replies; 5+ messages in thread
From: Steven Rostedt @ 2024-10-04 18:56 UTC (permalink / raw)
  To: LKML, Linux Trace Kernel
  Cc: Masami Hiramatsu, Mathieu Desnoyers, Shuah Khan, linux-kselftest

From: Steven Rostedt <rostedt@goodmis.org>

Masami reported a bug when running function graph tracing then the
function profiler. The following commands would cause a kernel crash:

  # cd /sys/kernel/tracing/
  # echo function_graph > current_tracer
  # echo 1 > function_profile_enabled

In that order. Create a test to test this two to make sure this does not
come back as a regression.

Link: https://lore.kernel.org/172398528350.293426.8347220120333730248.stgit@devnote2

Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
Changes since v1: https://lore.kernel.org/20240821150903.05c6cf96@gandalf.local.home

- Added comment to why we are doing a sleep 1

- Now that the fix is in mainline, we can add this to the selftests

 .../ftrace/test.d/ftrace/fgraph-profiler.tc   | 31 +++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 tools/testing/selftests/ftrace/test.d/ftrace/fgraph-profiler.tc

diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/fgraph-profiler.tc b/tools/testing/selftests/ftrace/test.d/ftrace/fgraph-profiler.tc
new file mode 100644
index 000000000000..1580e4ef9739
--- /dev/null
+++ b/tools/testing/selftests/ftrace/test.d/ftrace/fgraph-profiler.tc
@@ -0,0 +1,31 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+# description: ftrace - function profiler with function graph tracing
+# requires: function_profile_enabled set_ftrace_filter function_graph:tracer
+
+# The function graph tracer can now be run along side of the function
+# profiler. But there was a bug that caused the combination of the two
+# to crash. It also required the function graph tracer to be started
+# first.
+#
+# This test triggers that bug
+#
+# We need function_graph and profiling to to run this test
+
+fail() { # mesg
+    echo $1
+    exit_fail
+}
+
+echo "Enabling function graph tracer:"
+echo function_graph > current_tracer
+echo "enable profiler"
+
+# Older kernels do not allow function_profile to be enabled with
+# function graph tracer. If the below fails, mark it as unsupported
+echo 1 > function_profile_enabled || exit_unsupported
+
+# Let it run for a bit to make sure nothing explodes
+sleep 1
+
+exit 0
-- 
2.45.2


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

* Re: [PATCH v2] ftrace/selftest: Test combination of function_graph tracer and function profiler
  2024-10-04 18:56 [PATCH v2] ftrace/selftest: Test combination of function_graph tracer and function profiler Steven Rostedt
@ 2024-10-08  0:33 ` Masami Hiramatsu
  2024-10-10 17:04   ` Shuah Khan
  2024-10-10 20:45 ` Shuah Khan
  1 sibling, 1 reply; 5+ messages in thread
From: Masami Hiramatsu @ 2024-10-08  0:33 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: LKML, Linux Trace Kernel, Masami Hiramatsu, Mathieu Desnoyers,
	Shuah Khan, linux-kselftest

On Fri, 4 Oct 2024 14:56:18 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> From: Steven Rostedt <rostedt@goodmis.org>
> 
> Masami reported a bug when running function graph tracing then the
> function profiler. The following commands would cause a kernel crash:
> 
>   # cd /sys/kernel/tracing/
>   # echo function_graph > current_tracer
>   # echo 1 > function_profile_enabled
> 
> In that order. Create a test to test this two to make sure this does not
> come back as a regression.
> 
> Link: https://lore.kernel.org/172398528350.293426.8347220120333730248.stgit@devnote2
> 

Looks good to me.

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

Thanks!

> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> ---
> Changes since v1: https://lore.kernel.org/20240821150903.05c6cf96@gandalf.local.home
> 
> - Added comment to why we are doing a sleep 1
> 
> - Now that the fix is in mainline, we can add this to the selftests
> 
>  .../ftrace/test.d/ftrace/fgraph-profiler.tc   | 31 +++++++++++++++++++
>  1 file changed, 31 insertions(+)
>  create mode 100644 tools/testing/selftests/ftrace/test.d/ftrace/fgraph-profiler.tc
> 
> diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/fgraph-profiler.tc b/tools/testing/selftests/ftrace/test.d/ftrace/fgraph-profiler.tc
> new file mode 100644
> index 000000000000..1580e4ef9739
> --- /dev/null
> +++ b/tools/testing/selftests/ftrace/test.d/ftrace/fgraph-profiler.tc
> @@ -0,0 +1,31 @@
> +#!/bin/sh
> +# SPDX-License-Identifier: GPL-2.0
> +# description: ftrace - function profiler with function graph tracing
> +# requires: function_profile_enabled set_ftrace_filter function_graph:tracer
> +
> +# The function graph tracer can now be run along side of the function
> +# profiler. But there was a bug that caused the combination of the two
> +# to crash. It also required the function graph tracer to be started
> +# first.
> +#
> +# This test triggers that bug
> +#
> +# We need function_graph and profiling to to run this test
> +
> +fail() { # mesg
> +    echo $1
> +    exit_fail
> +}
> +
> +echo "Enabling function graph tracer:"
> +echo function_graph > current_tracer
> +echo "enable profiler"
> +
> +# Older kernels do not allow function_profile to be enabled with
> +# function graph tracer. If the below fails, mark it as unsupported
> +echo 1 > function_profile_enabled || exit_unsupported
> +
> +# Let it run for a bit to make sure nothing explodes
> +sleep 1
> +
> +exit 0
> -- 
> 2.45.2
> 


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

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

* Re: [PATCH v2] ftrace/selftest: Test combination of function_graph tracer and function profiler
  2024-10-08  0:33 ` Masami Hiramatsu
@ 2024-10-10 17:04   ` Shuah Khan
  2024-10-10 17:31     ` Steven Rostedt
  0 siblings, 1 reply; 5+ messages in thread
From: Shuah Khan @ 2024-10-10 17:04 UTC (permalink / raw)
  To: Masami Hiramatsu (Google), Steven Rostedt
  Cc: LKML, Linux Trace Kernel, Mathieu Desnoyers, linux-kselftest,
	Shuah Khan

On 10/7/24 18:33, Masami Hiramatsu (Google) wrote:
> On Fri, 4 Oct 2024 14:56:18 -0400
> Steven Rostedt <rostedt@goodmis.org> wrote:
> 
>> From: Steven Rostedt <rostedt@goodmis.org>
>>
>> Masami reported a bug when running function graph tracing then the
>> function profiler. The following commands would cause a kernel crash:
>>
>>    # cd /sys/kernel/tracing/
>>    # echo function_graph > current_tracer
>>    # echo 1 > function_profile_enabled
>>
>> In that order. Create a test to test this two to make sure this does not
>> come back as a regression.
>>
>> Link: https://lore.kernel.org/172398528350.293426.8347220120333730248.stgit@devnote2
>>
> 
> Looks good to me.
> 
> Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> 
> Thanks!
> 
>> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>

Steve, Would you like me take this one through my tree?

thanks,
-- Shuah


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

* Re: [PATCH v2] ftrace/selftest: Test combination of function_graph tracer and function profiler
  2024-10-10 17:04   ` Shuah Khan
@ 2024-10-10 17:31     ` Steven Rostedt
  0 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2024-10-10 17:31 UTC (permalink / raw)
  To: Shuah Khan
  Cc: Masami Hiramatsu (Google), LKML, Linux Trace Kernel,
	Mathieu Desnoyers, linux-kselftest

On Thu, 10 Oct 2024 11:04:43 -0600
Shuah Khan <skhan@linuxfoundation.org> wrote:

> On 10/7/24 18:33, Masami Hiramatsu (Google) wrote:
> > On Fri, 4 Oct 2024 14:56:18 -0400
> > Steven Rostedt <rostedt@goodmis.org> wrote:
> >   
> >> From: Steven Rostedt <rostedt@goodmis.org>
> >>
> >> Masami reported a bug when running function graph tracing then the
> >> function profiler. The following commands would cause a kernel crash:
> >>
> >>    # cd /sys/kernel/tracing/
> >>    # echo function_graph > current_tracer
> >>    # echo 1 > function_profile_enabled
> >>
> >> In that order. Create a test to test this two to make sure this does not
> >> come back as a regression.
> >>
> >> Link: https://lore.kernel.org/172398528350.293426.8347220120333730248.stgit@devnote2
> >>  
> > 
> > Looks good to me.
> > 
> > Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> > 
> > Thanks!
> >   
> >> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>  
> 
> Steve, Would you like me take this one through my tree?
>

Yes please.

Thanks Shuah!

-- Steve

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

* Re: [PATCH v2] ftrace/selftest: Test combination of function_graph tracer and function profiler
  2024-10-04 18:56 [PATCH v2] ftrace/selftest: Test combination of function_graph tracer and function profiler Steven Rostedt
  2024-10-08  0:33 ` Masami Hiramatsu
@ 2024-10-10 20:45 ` Shuah Khan
  1 sibling, 0 replies; 5+ messages in thread
From: Shuah Khan @ 2024-10-10 20:45 UTC (permalink / raw)
  To: Steven Rostedt, LKML, Linux Trace Kernel
  Cc: Masami Hiramatsu, Mathieu Desnoyers, linux-kselftest, Shuah Khan

On 10/4/24 12:56, Steven Rostedt wrote:
> From: Steven Rostedt <rostedt@goodmis.org>
> 
> Masami reported a bug when running function graph tracing then the
> function profiler. The following commands would cause a kernel crash:
> 
>    # cd /sys/kernel/tracing/
>    # echo function_graph > current_tracer
>    # echo 1 > function_profile_enabled
> 
> In that order. Create a test to test this two to make sure this does not
> come back as a regression.
> 
> Link: https://lore.kernel.org/172398528350.293426.8347220120333730248.stgit@devnote2
> 
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> ---
> Changes since v1: https://lore.kernel.org/20240821150903.05c6cf96@gandalf.local.home
> 
> - Added comment to why we are doing a sleep 1
> 
> - Now that the fix is in mainline, we can add this to the selftests
> 
>   .../ftrace/test.d/ftrace/fgraph-profiler.tc   | 31 +++++++++++++++++++
>   1 file changed, 31 insertions(+)
>   create mode 100644 tools/testing/selftests/ftrace/test.d/ftrace/fgraph-profiler.tc
> 
> diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/fgraph-profiler.tc b/tools/testing/selftests/ftrace/test.d/ftrace/fgraph-profiler.tc
> new file mode 100644
> index 000000000000..1580e4ef9739
> --- /dev/null
> +++ b/tools/testing/selftests/ftrace/test.d/ftrace/fgraph-profiler.tc
> @@ -0,0 +1,31 @@
> +#!/bin/sh
> +# SPDX-License-Identifier: GPL-2.0
> +# description: ftrace - function profiler with function graph tracing
> +# requires: function_profile_enabled set_ftrace_filter function_graph:tracer
> +
> +# The function graph tracer can now be run along side of the function
> +# profiler. But there was a bug that caused the combination of the two
> +# to crash. It also required the function graph tracer to be started
> +# first.
> +#
> +# This test triggers that bug
> +#
> +# We need function_graph and profiling to to run this test

"to to" -< "to"

I noticed this during my commit checks. Please fix and send v3.

> +
> +fail() { # mesg
> +    echo $1
> +    exit_fail
> +}
> +
> +echo "Enabling function graph tracer:"
> +echo function_graph > current_tracer
> +echo "enable profiler"
> +
> +# Older kernels do not allow function_profile to be enabled with
> +# function graph tracer. If the below fails, mark it as unsupported
> +echo 1 > function_profile_enabled || exit_unsupported
> +
> +# Let it run for a bit to make sure nothing explodes
> +sleep 1
> +
> +exit 0


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

end of thread, other threads:[~2024-10-10 20:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-04 18:56 [PATCH v2] ftrace/selftest: Test combination of function_graph tracer and function profiler Steven Rostedt
2024-10-08  0:33 ` Masami Hiramatsu
2024-10-10 17:04   ` Shuah Khan
2024-10-10 17:31     ` Steven Rostedt
2024-10-10 20:45 ` Shuah Khan

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).