Skip to contentSkip to conversation

rcutorture: don't mark torture_init_{begin,end} with __init

PATCH In review Will Deacon 2 participants 3 messages Apr 28, 2014 – Apr 29, 2014 Torture-test modules

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rcutorture: don't mark torture_init_{begin,end} with __init

By the time rcutorture is initialised via its module_init callback, the .init.text section of torture.ko has already been freed, so the calls to torture_init{begin,end} end up branching to junk.

This patch removes the __init annotations from torture_init_{begin,end} to make sure the code is there when we want to call it.

Cc Paul E. McKenney <[email protected]>
Cc Josh Triplett <[email protected]>

---

Just lost a day to this -- I was sure my static relocation handling must be to blame!

 kernel/torture.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/torture.c +2 -2
index acc9afc2f26e..d5ef30ce6eb5 100644
@@ -596,7 +596,7 @@ static void torture_stutter_cleanup(void)
  * The runnable parameter points to a flag that controls whether or not
  * the test is currently runnable.  If there is no such flag, pass in NULL.
  */
-void __init torture_init_begin(char *ttype, bool v, int *runnable)
+void torture_init_begin(char *ttype, bool v, int *runnable)
 {
 	mutex_lock(&fullstop_mutex);
 	torture_type = ttype;
@@ -610,7 +610,7 @@ EXPORT_SYMBOL_GPL(torture_init_begin);
 /*
  * Tell the torture module that initialization is complete.
  */
-void __init torture_init_end(void)
+void torture_init_end(void)
 {
 	mutex_unlock(&fullstop_mutex);
 	register_reboot_notifier(&torture_shutdown_nb);
Signature · 1 line
1.9.2
#1 lore raw
Quoted 10 lines · Will Deacon

By the time rcutorture is initialised via its module_init callback, the .init.text section of torture.ko has already been freed, so the calls to torture_init{begin,end} end up branching to junk.

This patch removes the __init annotations from torture_init_{begin,end} to make sure the code is there when we want to call it.

Cc Paul E. McKenney <[email protected]>
Cc Josh Triplett <[email protected]>

Good catch, and apologies for the wasted day, but someone beat you to this. By only 12 days, which is a bit surprising given how long this has been lurking.

Thanx, Paul

Quoted 33 lines

---

Just lost a day to this -- I was sure my static relocation handling must be to blame!

 kernel/torture.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/torture.c +2 -2
index acc9afc2f26e..d5ef30ce6eb5 100644
@@ -596,7 +596,7 @@ static void torture_stutter_cleanup(void)
  * The runnable parameter points to a flag that controls whether or not
  * the test is currently runnable.  If there is no such flag, pass in NULL.
  */
-void __init torture_init_begin(char *ttype, bool v, int *runnable)
+void torture_init_begin(char *ttype, bool v, int *runnable)
 {
 	mutex_lock(&fullstop_mutex);
 	torture_type = ttype;
@@ -610,7 +610,7 @@ EXPORT_SYMBOL_GPL(torture_init_begin);
 /*
  * Tell the torture module that initialization is complete.
  */
-void __init torture_init_end(void)
+void torture_init_end(void)
 {
 	mutex_unlock(&fullstop_mutex);
 	register_reboot_notifier(&torture_shutdown_nb);
Signature · 1 line
1.9.2
#2 lore raw
Quoted 8 lines · Paul E. McKenney
Quoted 7 lines · Will Deacon

By the time rcutorture is initialised via its module_init callback, the .init.text section of torture.ko has already been freed, so the calls to torture_init{begin,end} end up branching to junk.

This patch removes the __init annotations from torture_init_{begin,end} to make sure the code is there when we want to call it.

Quoted 7 lines
Quoted 3 lines
Cc Paul E. McKenney <[email protected]>
Cc Josh Triplett <[email protected]>

Good catch, and apologies for the wasted day, but someone beat you to this. By only 12 days, which is a bit surprising given how long this has been lurking.

Oh well, at least it's getting fixed!

Will