All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] ftrace/module: Move ftrace_release_mod() to ddebug_cleanup label
       [not found] <CGME20180108051623epcas5p1a2b9d68d83fd54937d71e3d726e36d38@epcas5p1.samsung.com>
@ 2018-01-08  5:11 ` Namit Gupta
  2018-01-12 17:32   ` Jessica Yu
  0 siblings, 1 reply; 3+ messages in thread
From: Namit Gupta @ 2018-01-08  5:11 UTC (permalink / raw)
  To: rostedt, jeyu; +Cc: mingo, linux-kernel, pankaj.m, a.sahrawat, Namit Gupta

ftrace_module_init happen after dynamic_debug_setup, it is desired that
cleanup should be called after this label however in current implementation
it is called in free module label,ie:even though ftrace in not initialized,
from so many fail case ftrace_release_mod() will be called and unnecessary
traverse the whole list.
In below patch we moved ftrace_release_mod() from free_module label to
ddebug_cleanup label. that is the best possible location, other solution
is to make new label to ftrace_release_mod() but since ftrace_module_init()
is not return with minimum changes it should be in ddebug_cleanup label.

Signed-off-by: Namit Gupta <gupta.namit@samsung.com>

---
 kernel/module.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/kernel/module.c b/kernel/module.c
index de66ec8..e81a6d7 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -3779,6 +3779,7 @@ static int load_module(struct load_info *info, const char __user *uargs,
 	module_disable_nx(mod);
 
  ddebug_cleanup:
+	ftrace_release_mod(mod);
 	dynamic_debug_remove(mod, info->debug);
 	synchronize_sched();
 	kfree(mod->args);
@@ -3798,12 +3799,6 @@ static int load_module(struct load_info *info, const char __user *uargs,
 	synchronize_sched();
 	mutex_unlock(&module_mutex);
  free_module:
-	/*
-	 * Ftrace needs to clean up what it initialized.
-	 * This does nothing if ftrace_module_init() wasn't called,
-	 * but it must be called outside of module_mutex.
-	 */
-	ftrace_release_mod(mod);
 	/* Free lock-classes; relies on the preceding sync_rcu() */
 	lockdep_free_key_range(mod->core_layout.base, mod->core_layout.size);
 
-- 
1.9.1

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

* Re: [PATCH v3] ftrace/module: Move ftrace_release_mod() to ddebug_cleanup label
  2018-01-08  5:11 ` [PATCH v3] ftrace/module: Move ftrace_release_mod() to ddebug_cleanup label Namit Gupta
@ 2018-01-12 17:32   ` Jessica Yu
  2018-01-12 17:50     ` Steven Rostedt
  0 siblings, 1 reply; 3+ messages in thread
From: Jessica Yu @ 2018-01-12 17:32 UTC (permalink / raw)
  To: rostedt, Namit Gupta; +Cc: mingo, linux-kernel, pankaj.m, a.sahrawat

+++ Namit Gupta [08/01/18 10:41 +0530]:
>ftrace_module_init happen after dynamic_debug_setup, it is desired that
>cleanup should be called after this label however in current implementation
>it is called in free module label,ie:even though ftrace in not initialized,
>from so many fail case ftrace_release_mod() will be called and unnecessary
>traverse the whole list.
>In below patch we moved ftrace_release_mod() from free_module label to
>ddebug_cleanup label. that is the best possible location, other solution
>is to make new label to ftrace_release_mod() but since ftrace_module_init()
>is not return with minimum changes it should be in ddebug_cleanup label.
>
>Signed-off-by: Namit Gupta <gupta.namit@samsung.com>

Hi Steven,

Could I get an ACK for this patch?

Thanks!

Jessica

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

* Re: [PATCH v3] ftrace/module: Move ftrace_release_mod() to ddebug_cleanup label
  2018-01-12 17:32   ` Jessica Yu
@ 2018-01-12 17:50     ` Steven Rostedt
  0 siblings, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2018-01-12 17:50 UTC (permalink / raw)
  To: Jessica Yu; +Cc: Namit Gupta, mingo, linux-kernel, pankaj.m, a.sahrawat

On Fri, 12 Jan 2018 18:32:27 +0100
Jessica Yu <jeyu@kernel.org> wrote:

> +++ Namit Gupta [08/01/18 10:41 +0530]:
> >ftrace_module_init happen after dynamic_debug_setup, it is desired that
> >cleanup should be called after this label however in current implementation
> >it is called in free module label,ie:even though ftrace in not initialized,
> >from so many fail case ftrace_release_mod() will be called and unnecessary
> >traverse the whole list.
> >In below patch we moved ftrace_release_mod() from free_module label to
> >ddebug_cleanup label. that is the best possible location, other solution
> >is to make new label to ftrace_release_mod() but since ftrace_module_init()
> >is not return with minimum changes it should be in ddebug_cleanup label.
> >
> >Signed-off-by: Namit Gupta <gupta.namit@samsung.com>  
> 
> Hi Steven,
> 
> Could I get an ACK for this patch?
> 

Hi Jessica,

Thanks for asking, because this came in while I was traveling and is
buried in the "travel log" part of my inbox.

Please add:

Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

-- Steve

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

end of thread, other threads:[~2018-01-12 17:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20180108051623epcas5p1a2b9d68d83fd54937d71e3d726e36d38@epcas5p1.samsung.com>
2018-01-08  5:11 ` [PATCH v3] ftrace/module: Move ftrace_release_mod() to ddebug_cleanup label Namit Gupta
2018-01-12 17:32   ` Jessica Yu
2018-01-12 17:50     ` Steven Rostedt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.