mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ftrace: use helper function clear_ftrace_function
@ 2018-01-30  0:46 Yisheng Xie
  2018-01-30 10:13 ` Steven Rostedt
  0 siblings, 1 reply; 3+ messages in thread
From: Yisheng Xie @ 2018-01-30  0:46 UTC (permalink / raw)
  To: rostedt, mingo; +Cc: linux-kernel, Yisheng Xie

We have helper function clear_ftrace_function(), use it instead of hard
code. And this should not have any functional change.

Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
---
 kernel/trace/ftrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 554b517..ba78e03 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -6779,7 +6779,7 @@ int unregister_ftrace_function(struct ftrace_ops *ops)
 
 	} else {
 		/* stopping ftrace calls (just send to ftrace_stub) */
-		ftrace_trace_function = ftrace_stub;
+		clear_ftrace_function();
 
 		ftrace_shutdown_sysctl();
 	}
-- 
1.7.12.4

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

* Re: [PATCH] ftrace: use helper function clear_ftrace_function
  2018-01-30  0:46 [PATCH] ftrace: use helper function clear_ftrace_function Yisheng Xie
@ 2018-01-30 10:13 ` Steven Rostedt
  2018-01-30 11:39   ` Yisheng Xie
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2018-01-30 10:13 UTC (permalink / raw)
  To: Yisheng Xie; +Cc: mingo, linux-kernel

On Tue, 30 Jan 2018 08:46:01 +0800
Yisheng Xie <xieyisheng1@huawei.com> wrote:

> We have helper function clear_ftrace_function(), use it instead of hard
> code. And this should not have any functional change.
> 
> Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
> ---
>  kernel/trace/ftrace.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index 554b517..ba78e03 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -6779,7 +6779,7 @@ int unregister_ftrace_function(struct ftrace_ops *ops)
>  
>  	} else {
>  		/* stopping ftrace calls (just send to ftrace_stub) */
> -		ftrace_trace_function = ftrace_stub;
> +		clear_ftrace_function();
>  
>  		ftrace_shutdown_sysctl();
>  	}

Honestly, I rather nuke that function and clear_ftrace_function_probe()
along with it. They are not used outside of ftrace.c and they don't
actually help.

-- Steve

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

* Re: [PATCH] ftrace: use helper function clear_ftrace_function
  2018-01-30 10:13 ` Steven Rostedt
@ 2018-01-30 11:39   ` Yisheng Xie
  0 siblings, 0 replies; 3+ messages in thread
From: Yisheng Xie @ 2018-01-30 11:39 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: mingo, linux-kernel

Hi Steve,

On 2018/1/30 18:13, Steven Rostedt wrote:
> On Tue, 30 Jan 2018 08:46:01 +0800
> Yisheng Xie <xieyisheng1@huawei.com> wrote:
> 
>> We have helper function clear_ftrace_function(), use it instead of hard
>> code. And this should not have any functional change.
>>
>> Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
>> ---
>>  kernel/trace/ftrace.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
>> index 554b517..ba78e03 100644
>> --- a/kernel/trace/ftrace.c
>> +++ b/kernel/trace/ftrace.c
>> @@ -6779,7 +6779,7 @@ int unregister_ftrace_function(struct ftrace_ops *ops)
>>  
>>  	} else {
>>  		/* stopping ftrace calls (just send to ftrace_stub) */
>> -		ftrace_trace_function = ftrace_stub;
>> +		clear_ftrace_function();
>>  
>>  		ftrace_shutdown_sysctl();
>>  	}
> 
> Honestly, I rather nuke that function and clear_ftrace_function_probe()

Do you means clear_ftrace_function_probes() ? I do not find clear_ftrace_function_probe
in mainline or trace tree:
  https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git/

clear_ftrace_function_probes() is used in trace.c instead of ftrace.c, and meanwhile it
has a local variable:

	struct ftrace_func_probe *probe, *n;

which defined in ftrace.c. So I am a litter puzzle about how to nuke it without moving
struct ftrace_func_probe 's definition to first class.

I'm not sure whether I am missing anything.

> along with it. They are not used outside of ftrace.c and they don't
> actually help.

For clear_ftrace_function it really can be nuked, for it's only used in ftrace.c.

Thanks
Yisheng

> 
> -- Steve
> 
> 

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

end of thread, other threads:[~2018-01-30 11:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-30  0:46 [PATCH] ftrace: use helper function clear_ftrace_function Yisheng Xie
2018-01-30 10:13 ` Steven Rostedt
2018-01-30 11:39   ` Yisheng Xie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®