Commit 69a78ff2 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Ingo Molnar

init: Introduce SYSTEM_SCHEDULING state

might_sleep() debugging and smp_processor_id() debugging should be active
right after the scheduler starts working. The init task can invoke
smp_processor_id() from preemptible context as it is pinned on the boot cpu
until sched_smp_init() removes the pinning and lets it schedule on all non
isolated cpus.

Add a new state which allows to enable those checks earlier and add it to
the xen do_poweroff() function.

No functional change.
Tested-by: default avatarMark Rutland <mark.rutland@arm.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
Acked-by: default avatarMark Rutland <mark.rutland@arm.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Juergen Gross <jgross@suse.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/20170516184736.196214622@linutronix.deSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent c6202adf
...@@ -190,6 +190,7 @@ static void do_poweroff(void) ...@@ -190,6 +190,7 @@ static void do_poweroff(void)
{ {
switch (system_state) { switch (system_state) {
case SYSTEM_BOOTING: case SYSTEM_BOOTING:
case SYSTEM_SCHEDULING:
orderly_poweroff(true); orderly_poweroff(true);
break; break;
case SYSTEM_RUNNING: case SYSTEM_RUNNING:
......
...@@ -490,9 +490,13 @@ extern int root_mountflags; ...@@ -490,9 +490,13 @@ extern int root_mountflags;
extern bool early_boot_irqs_disabled; extern bool early_boot_irqs_disabled;
/* Values used for system_state */ /*
* Values used for system_state. Ordering of the states must not be changed
* as code checks for <, <=, >, >= STATE.
*/
extern enum system_states { extern enum system_states {
SYSTEM_BOOTING, SYSTEM_BOOTING,
SYSTEM_SCHEDULING,
SYSTEM_RUNNING, SYSTEM_RUNNING,
SYSTEM_HALT, SYSTEM_HALT,
SYSTEM_POWER_OFF, SYSTEM_POWER_OFF,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment