diff mbox series

[5/7] tracing: add config option for print arguments in ftrace

Message ID 20240904065908.1009086-6-svens@linux.ibm.com (mailing list archive)
State New
Headers show
Series add function arguments to ftrace | expand

Commit Message

Sven Schnelle Sept. 4, 2024, 6:58 a.m. UTC
Add a config option to disable/enable function argument
printing support during runtime.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
---
 kernel/trace/Kconfig | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Zheng Yejian Sept. 6, 2024, 3:36 a.m. UTC | #1
On 2024/9/4 14:58, Sven Schnelle wrote:
> Add a config option to disable/enable function argument
> printing support during runtime.
> 
> Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
> ---
>   kernel/trace/Kconfig | 12 ++++++++++++
>   1 file changed, 12 insertions(+)
> 
> diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
> index 721c3b221048..8b9b6cdf39ac 100644
> --- a/kernel/trace/Kconfig
> +++ b/kernel/trace/Kconfig
> @@ -242,6 +242,18 @@ config FUNCTION_GRAPH_RETVAL
>   	  enable it via the trace option funcgraph-retval.
>   	  See Documentation/trace/ftrace.rst
>   
> +config FUNCTION_TRACE_ARGS
> +	bool "Kernel Function Tracer Arguments"
> +	depends on HAVE_FUNCTION_ARG_ACCESS_API
> +	depends on DEBUG_INFO_BTF && BPF_SYSCALL

Nice feature!

Just a nit, DEBUG_INFO_BTF currently depends on BPF_SYSCALL,
so BPF_SYSCALL may not be necessary here. This feature
also doesn't seem to depend on bpf.

> +	default n
> +	help
> +	  Support recording and printing of function arguments when using
> +	  the function tracer or function graph tracer. This feature is off
> +	  by default, and can be enabled via the trace option func-args (for
> +	  the function tracer) and funcgraph-args (for the function graph
> +	  tracer).
> +
>   config DYNAMIC_FTRACE
>   	bool "enable/disable function tracing dynamically"
>   	depends on FUNCTION_TRACER
Masami Hiramatsu (Google) Sept. 8, 2024, 1:30 p.m. UTC | #2
On Fri, 6 Sep 2024 11:36:11 +0800
Zheng Yejian <zhengyejian@huaweicloud.com> wrote:

> On 2024/9/4 14:58, Sven Schnelle wrote:
> > Add a config option to disable/enable function argument
> > printing support during runtime.
> > 
> > Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
> > ---
> >   kernel/trace/Kconfig | 12 ++++++++++++
> >   1 file changed, 12 insertions(+)
> > 
> > diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
> > index 721c3b221048..8b9b6cdf39ac 100644
> > --- a/kernel/trace/Kconfig
> > +++ b/kernel/trace/Kconfig
> > @@ -242,6 +242,18 @@ config FUNCTION_GRAPH_RETVAL
> >   	  enable it via the trace option funcgraph-retval.
> >   	  See Documentation/trace/ftrace.rst
> >   
> > +config FUNCTION_TRACE_ARGS
> > +	bool "Kernel Function Tracer Arguments"
> > +	depends on HAVE_FUNCTION_ARG_ACCESS_API
> > +	depends on DEBUG_INFO_BTF && BPF_SYSCALL
> 
> Nice feature!
> 
> Just a nit, DEBUG_INFO_BTF currently depends on BPF_SYSCALL,
> so BPF_SYSCALL may not be necessary here. This feature
> also doesn't seem to depend on bpf.

Indeed. Sven, you can check the PROBE_EVENTS_BTF_ARGS as
an example.

config PROBE_EVENTS_BTF_ARGS
        depends on HAVE_FUNCTION_ARG_ACCESS_API
        depends on FPROBE_EVENTS || KPROBE_EVENTS
        depends on DEBUG_INFO_BTF && BPF_SYSCALL
        bool "Support BTF function arguments for probe events"

Thank you,

> 
> > +	default n
> > +	help
> > +	  Support recording and printing of function arguments when using
> > +	  the function tracer or function graph tracer. This feature is off
> > +	  by default, and can be enabled via the trace option func-args (for
> > +	  the function tracer) and funcgraph-args (for the function graph
> > +	  tracer).
> > +
> >   config DYNAMIC_FTRACE
> >   	bool "enable/disable function tracing dynamically"
> >   	depends on FUNCTION_TRACER
> 
> -- 
> Thanks,
> Zheng Yejian
> 
>
Sven Schnelle Sept. 9, 2024, 8:16 a.m. UTC | #3
Masami Hiramatsu (Google) <mhiramat@kernel.org> writes:

> On Fri, 6 Sep 2024 11:36:11 +0800
> Zheng Yejian <zhengyejian@huaweicloud.com> wrote:
>
>> On 2024/9/4 14:58, Sven Schnelle wrote:
>> > Add a config option to disable/enable function argument
>> > printing support during runtime.
>> > 
>> > Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
>> > ---
>> >   kernel/trace/Kconfig | 12 ++++++++++++
>> >   1 file changed, 12 insertions(+)
>> > 
>> > diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
>> > index 721c3b221048..8b9b6cdf39ac 100644
>> > --- a/kernel/trace/Kconfig
>> > +++ b/kernel/trace/Kconfig
>> > @@ -242,6 +242,18 @@ config FUNCTION_GRAPH_RETVAL
>> >   	  enable it via the trace option funcgraph-retval.
>> >   	  See Documentation/trace/ftrace.rst
>> >   
>> > +config FUNCTION_TRACE_ARGS
>> > +	bool "Kernel Function Tracer Arguments"
>> > +	depends on HAVE_FUNCTION_ARG_ACCESS_API
>> > +	depends on DEBUG_INFO_BTF && BPF_SYSCALL
>> 
>> Nice feature!
>> 
>> Just a nit, DEBUG_INFO_BTF currently depends on BPF_SYSCALL,
>> so BPF_SYSCALL may not be necessary here. This feature
>> also doesn't seem to depend on bpf.
>
> Indeed. Sven, you can check the PROBE_EVENTS_BTF_ARGS as
> an example.
>
> config PROBE_EVENTS_BTF_ARGS
>         depends on HAVE_FUNCTION_ARG_ACCESS_API
>         depends on FPROBE_EVENTS || KPROBE_EVENTS
>         depends on DEBUG_INFO_BTF && BPF_SYSCALL
>         bool "Support BTF function arguments for probe events"

Now i'm confused - Zheng wrote that DEBUG_INFO_BTF depends on
BPF_SYSCALL. I just verified that. So i could just remove BPF_SYSCALL
from the dependencies - but your example also has BPF_SYSCALL listed.

Regards
Sven
Masami Hiramatsu (Google) Sept. 9, 2024, 1:56 p.m. UTC | #4
On Mon, 09 Sep 2024 10:16:55 +0200
Sven Schnelle <svens@linux.ibm.com> wrote:

> Masami Hiramatsu (Google) <mhiramat@kernel.org> writes:
> 
> > On Fri, 6 Sep 2024 11:36:11 +0800
> > Zheng Yejian <zhengyejian@huaweicloud.com> wrote:
> >
> >> On 2024/9/4 14:58, Sven Schnelle wrote:
> >> > Add a config option to disable/enable function argument
> >> > printing support during runtime.
> >> > 
> >> > Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
> >> > ---
> >> >   kernel/trace/Kconfig | 12 ++++++++++++
> >> >   1 file changed, 12 insertions(+)
> >> > 
> >> > diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
> >> > index 721c3b221048..8b9b6cdf39ac 100644
> >> > --- a/kernel/trace/Kconfig
> >> > +++ b/kernel/trace/Kconfig
> >> > @@ -242,6 +242,18 @@ config FUNCTION_GRAPH_RETVAL
> >> >   	  enable it via the trace option funcgraph-retval.
> >> >   	  See Documentation/trace/ftrace.rst
> >> >   
> >> > +config FUNCTION_TRACE_ARGS
> >> > +	bool "Kernel Function Tracer Arguments"
> >> > +	depends on HAVE_FUNCTION_ARG_ACCESS_API
> >> > +	depends on DEBUG_INFO_BTF && BPF_SYSCALL
> >> 
> >> Nice feature!
> >> 
> >> Just a nit, DEBUG_INFO_BTF currently depends on BPF_SYSCALL,
> >> so BPF_SYSCALL may not be necessary here. This feature
> >> also doesn't seem to depend on bpf.
> >
> > Indeed. Sven, you can check the PROBE_EVENTS_BTF_ARGS as
> > an example.
> >
> > config PROBE_EVENTS_BTF_ARGS
> >         depends on HAVE_FUNCTION_ARG_ACCESS_API
> >         depends on FPROBE_EVENTS || KPROBE_EVENTS
> >         depends on DEBUG_INFO_BTF && BPF_SYSCALL
> >         bool "Support BTF function arguments for probe events"
> 
> Now i'm confused - Zheng wrote that DEBUG_INFO_BTF depends on
> BPF_SYSCALL. I just verified that. So i could just remove BPF_SYSCALL
> from the dependencies - but your example also has BPF_SYSCALL listed.

Ah, sorry for confusion. In this case, just need DEBUG_INFO_BTF.
Hmm, I think I also need to remove BPF_SYSCALL.

Thanks,

> 
> Regards
> Sven
diff mbox series

Patch

diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index 721c3b221048..8b9b6cdf39ac 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -242,6 +242,18 @@  config FUNCTION_GRAPH_RETVAL
 	  enable it via the trace option funcgraph-retval.
 	  See Documentation/trace/ftrace.rst
 
+config FUNCTION_TRACE_ARGS
+	bool "Kernel Function Tracer Arguments"
+	depends on HAVE_FUNCTION_ARG_ACCESS_API
+	depends on DEBUG_INFO_BTF && BPF_SYSCALL
+	default n
+	help
+	  Support recording and printing of function arguments when using
+	  the function tracer or function graph tracer. This feature is off
+	  by default, and can be enabled via the trace option func-args (for
+	  the function tracer) and funcgraph-args (for the function graph
+	  tracer).
+
 config DYNAMIC_FTRACE
 	bool "enable/disable function tracing dynamically"
 	depends on FUNCTION_TRACER