Re: [PATCH] ftrace: add kernel command line graph function filtering

From: Stefan Assmann
Date: Mon Oct 12 2009 - 06:06:57 EST


On 12.10.2009 11:09, Frédéric Weisbecker wrote:
> 2009/10/12 Stefan Assmann <sassmann@xxxxxxxxxx>:
>> From 894e934e782ddaa33eb6d156d8326cdf479b5f62 Mon Sep 17 00:00:00 2001
>> From: Stefan Assmann <sassmann@xxxxxxxxxx>
>> Date: Mon, 12 Oct 2009 09:11:47 +0200
>> Subject: [PATCH] ftrace: add kernel command line graph function filtering
>>
>> Add a command line parameter to allow limiting the function graphs that
>> are traced on boot up, when ftrace=function_graph is specified.
>>
>> This patch adds the following command line option:
>> ftrace_graph_filter=function-list
>
>
> If we use this parameter, we undoubtedly want to launch the function
> graph tracer.
> I'd then suggest to arm ftrace=function_graph automatically if we have
> ftrace_graph_filter
> set.
>
>
>>
>> Where function-list is a comma separated list of functions to filter.
>>
>> Signed-off-by: Stefan Assmann <sassmann@xxxxxxxxxx>
>> ---
>> Documentation/kernel-parameters.txt | 9 ++++++++-
>> kernel/trace/ftrace.c | 34 ++++++++++++++++++++++++++++++++++
>> 2 files changed, 42 insertions(+), 1 deletions(-)
>>
>> diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
>> index 9107b38..144eb83 100644
>> --- a/Documentation/kernel-parameters.txt
>> +++ b/Documentation/kernel-parameters.txt
>> @@ -771,7 +771,14 @@ and is between 256 and 4096 characters. It is defined in the file
>> tracer at boot up. function-list is a comma separated
>> list of functions. This list can be changed at run
>> time by the set_ftrace_filter file in the debugfs
>> - tracing directory.
>> + tracing directory.
>> +
>> + ftrace_graph_filter=[function-list]
>> + [FTRACE] Limit the functions traced by the function
>> + graph tracer at boot up. function-list is a comma
>> + separated list of functions. This list can be changed
>> + at run time by the set_graph_function file in the
>> + debugfs tracing directory.
>
>
>
> May be you should use a more detailed definition of this parameter.
> Limiting a function traced by the function graph tracer is ambiguous.
>
> It means we can have either:
>
> function_to_trace();
>
> or:
>
> function_to_trace() {
> foo() {
> bar();
> }
> }
>
> We want the second thing.
> May be instead you can write:
>
> "Limit the top level callers functions traced by the function
> graph tracer at boot up."
>
> Otherwise, looks good to me:
>
> Acked-by: Frederic Weisbecker <fweisbec@xxxxxxxxx>
>
> Thanks.

Thanks for reviewing Frédéric!
I hope the following is what you had in mind.

Stefan