From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753478AbdEPSzF (ORCPT ); Tue, 16 May 2017 14:55:05 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:41327 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753104AbdEPSwz (ORCPT ); Tue, 16 May 2017 14:52:55 -0400 Message-Id: <20170516184736.196214622@linutronix.de> User-Agent: quilt/0.63-1 Date: Tue, 16 May 2017 20:42:47 +0200 From: Thomas Gleixner To: LKML Cc: Peter Zijlstra , Ingo Molnar , Steven Rostedt , Mark Rutland , Greg Kroah-Hartman , Boris Ostrovsky , Juergen Gross Subject: [patch V2 16/17] init: Introduce SYSTEM_SCHEDULING state References: <20170516184231.564888231@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Disposition: inline; filename=init--Introduce-SYSTEM_SCHEDULING-state.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Thomas Gleixner Cc: Boris Ostrovsky Cc: Juergen Gross Cc: Greg Kroah-Hartman --- V2: Use only one intermediate state and document that state order matters. drivers/xen/manage.c | 1 + include/linux/kernel.h | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c @@ -190,6 +190,7 @@ static void do_poweroff(void) { switch (system_state) { case SYSTEM_BOOTING: + case SYSTEM_SCHEDULING: orderly_poweroff(true); break; case SYSTEM_RUNNING: --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -490,9 +490,13 @@ extern int root_mountflags; 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 { SYSTEM_BOOTING, + SYSTEM_SCHEDULING, SYSTEM_RUNNING, SYSTEM_HALT, SYSTEM_POWER_OFF,