linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] jump_label: invoke jump_label_test() via early_initcall()
@ 2017-11-13 21:48 Jason Baron
  2017-11-13 22:15 ` Paul E. McKenney
  2017-11-14  9:32 ` [tip:locking/urgent] jump_label: Invoke " tip-bot for Jason Baron
  0 siblings, 2 replies; 3+ messages in thread
From: Jason Baron @ 2017-11-13 21:48 UTC (permalink / raw)
  To: rostedt, peterz; +Cc: linux-kernel, Paul E. McKenney, Ingo Molnar

Fengguang Wu reported that running the rcuperf test during boot can cause
the jump_label_test() to hit a WARN_ON(). The issue is that the core jump
label code relies on kernel_text_address() to detect when it can no longer
update branches that may be contained in __init sections. The
kernel_text_address() in turn assumes that if the system_state variable is
greter than or equal to SYSTEM_RUNNING then __init sections are no longer
valid (since the assumption is that they have been freed). However, when
rcuperf is setup to run in early boot it can call kernel_power_off() which
sets the system_state to SYSTEM_POWER_OFF.

Since rcuperf initialization is invoked via a module_init(), we can make
the dependency of jump_label_test() needing to complete before rcuperf
explicit by calling it via early_initcall().

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Jason Baron <jbaron@akamai.com>
---
 kernel/jump_label.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/jump_label.c b/kernel/jump_label.c
index 0bf2e8f5..7c3774a 100644
--- a/kernel/jump_label.c
+++ b/kernel/jump_label.c
@@ -769,7 +769,7 @@ static __init int jump_label_test(void)
 
 	return 0;
 }
-late_initcall(jump_label_test);
+early_initcall(jump_label_test);
 #endif /* STATIC_KEYS_SELFTEST */
 
 #endif /* HAVE_JUMP_LABEL */
-- 
2.6.1

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

* Re: [PATCH] jump_label: invoke jump_label_test() via early_initcall()
  2017-11-13 21:48 [PATCH] jump_label: invoke jump_label_test() via early_initcall() Jason Baron
@ 2017-11-13 22:15 ` Paul E. McKenney
  2017-11-14  9:32 ` [tip:locking/urgent] jump_label: Invoke " tip-bot for Jason Baron
  1 sibling, 0 replies; 3+ messages in thread
From: Paul E. McKenney @ 2017-11-13 22:15 UTC (permalink / raw)
  To: Jason Baron; +Cc: rostedt, peterz, linux-kernel, Ingo Molnar

On Mon, Nov 13, 2017 at 04:48:47PM -0500, Jason Baron wrote:
> Fengguang Wu reported that running the rcuperf test during boot can cause
> the jump_label_test() to hit a WARN_ON(). The issue is that the core jump
> label code relies on kernel_text_address() to detect when it can no longer
> update branches that may be contained in __init sections. The
> kernel_text_address() in turn assumes that if the system_state variable is
> greter than or equal to SYSTEM_RUNNING then __init sections are no longer
> valid (since the assumption is that they have been freed). However, when
> rcuperf is setup to run in early boot it can call kernel_power_off() which
> sets the system_state to SYSTEM_POWER_OFF.
> 
> Since rcuperf initialization is invoked via a module_init(), we can make
> the dependency of jump_label_test() needing to complete before rcuperf
> explicit by calling it via early_initcall().
> 
> Reported-by: Fengguang Wu <fengguang.wu@intel.com>
> Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Ingo Molnar <mingo@kernel.org>
> Signed-off-by: Jason Baron <jbaron@akamai.com>

Looks way simpler than handling this three times in rcuperf, rcutorture,
and locktorture!

Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

> ---
>  kernel/jump_label.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/jump_label.c b/kernel/jump_label.c
> index 0bf2e8f5..7c3774a 100644
> --- a/kernel/jump_label.c
> +++ b/kernel/jump_label.c
> @@ -769,7 +769,7 @@ static __init int jump_label_test(void)
> 
>  	return 0;
>  }
> -late_initcall(jump_label_test);
> +early_initcall(jump_label_test);
>  #endif /* STATIC_KEYS_SELFTEST */
> 
>  #endif /* HAVE_JUMP_LABEL */
> -- 
> 2.6.1
> 

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

* [tip:locking/urgent] jump_label: Invoke jump_label_test() via early_initcall()
  2017-11-13 21:48 [PATCH] jump_label: invoke jump_label_test() via early_initcall() Jason Baron
  2017-11-13 22:15 ` Paul E. McKenney
@ 2017-11-14  9:32 ` tip-bot for Jason Baron
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Jason Baron @ 2017-11-14  9:32 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, peterz, mingo, rostedt, paulmck, hpa, torvalds,
	tglx, jbaron, fengguang.wu

Commit-ID:  92ee46efeb505ead3ab06d3c5ce695637ed5f152
Gitweb:     https://git.kernel.org/tip/92ee46efeb505ead3ab06d3c5ce695637ed5f152
Author:     Jason Baron <jbaron@akamai.com>
AuthorDate: Mon, 13 Nov 2017 16:48:47 -0500
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 14 Nov 2017 08:41:41 +0100

jump_label: Invoke jump_label_test() via early_initcall()

Fengguang Wu reported that running the rcuperf test during boot can cause
the jump_label_test() to hit a WARN_ON(). The issue is that the core jump
label code relies on kernel_text_address() to detect when it can no longer
update branches that may be contained in __init sections. The
kernel_text_address() in turn assumes that if the system_state variable is
greter than or equal to SYSTEM_RUNNING then __init sections are no longer
valid (since the assumption is that they have been freed). However, when
rcuperf is setup to run in early boot it can call kernel_power_off() which
sets the system_state to SYSTEM_POWER_OFF.

Since rcuperf initialization is invoked via a module_init(), we can make
the dependency of jump_label_test() needing to complete before rcuperf
explicit by calling it via early_initcall().

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Jason Baron <jbaron@akamai.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1510609727-2238-1-git-send-email-jbaron@akamai.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/jump_label.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/jump_label.c b/kernel/jump_label.c
index 8ff4ca4..8594d24 100644
--- a/kernel/jump_label.c
+++ b/kernel/jump_label.c
@@ -769,7 +769,7 @@ static __init int jump_label_test(void)
 
 	return 0;
 }
-late_initcall(jump_label_test);
+early_initcall(jump_label_test);
 #endif /* STATIC_KEYS_SELFTEST */
 
 #endif /* HAVE_JUMP_LABEL */

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

end of thread, other threads:[~2017-11-14  9:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-13 21:48 [PATCH] jump_label: invoke jump_label_test() via early_initcall() Jason Baron
2017-11-13 22:15 ` Paul E. McKenney
2017-11-14  9:32 ` [tip:locking/urgent] jump_label: Invoke " tip-bot for Jason Baron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).