RE: [PATCH v2] ftrace/module: Move ftrace_release_mod to ddebug_cleanup label
From: NAMIT GUPTA
Date: Thu Dec 28 2017 - 01:15:27 EST
Â
Hello Steve,
As per the discussion I sent patch v2.
Please find.
Thanks,
Namit Gupta
--------- Original Message ---------
Sender : NAMIT GUPTAÂ<gupta.namit@xxxxxxxxxxx>Â./Senior Chief Engineer/SRI-Delhi-Platform S/W 1 Team/Samsung Electronics
Date : 2017-12-12 17:29 (GMT+5:30)
Title : [PATCH v2] ftrace/module: Move ftrace_release_mod to ddebug_cleanup label
Â
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@xxxxxxxxxxx>
Â
---
Âkernel/module.cÂ|Â7Â+------
Â1ÂfileÂchanged,Â1Âinsertion(+),Â6Âdeletions(-)
Â
diffÂ--gitÂa/kernel/module.cÂb/kernel/module.c
indexÂ0d1cb8d..4be966aÂ100644
---Âa/kernel/module.c
+++Âb/kernel/module.c
@@Â-3523,6Â+3523,7Â@@ÂstaticÂintÂload_module(structÂload_infoÂ*info,ÂconstÂcharÂ__userÂ*uargs,
ÂÂÂÂÂÂÂÂÂunset_module_core_ro_nx(mod);
Â
ÂÂddebug_cleanup:
+ÂÂÂÂÂÂÂÂftrace_release_mod(mod);
ÂÂÂÂÂÂÂÂÂdynamic_debug_remove(info->debug);
ÂÂÂÂÂÂÂÂÂsynchronize_sched();
ÂÂÂÂÂÂÂÂÂkfree(mod->args);
@@Â-3541,12Â+3542,6Â@@ÂstaticÂintÂload_module(structÂload_infoÂ*info,ÂconstÂcharÂ__userÂ*uargs,
ÂÂÂÂÂÂÂÂÂsynchronize_rcu();
ÂÂÂÂÂÂÂÂÂ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->module_core,Âmod->core_size);
Â
--Â
1.9.1
Â
Â