From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754498AbcKIWwq (ORCPT ); Wed, 9 Nov 2016 17:52:46 -0500 Received: from terminus.zytor.com ([198.137.202.10]:55288 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754042AbcKIWwp (ORCPT ); Wed, 9 Nov 2016 17:52:45 -0500 Date: Wed, 9 Nov 2016 14:52:38 -0800 From: tip-bot for Sebastian Andrzej Siewior Message-ID: Cc: tglx@linutronix.de, hpa@zytor.com, akpm@linux-foundation.org, bigeasy@linutronix.de, linux-kernel@vger.kernel.org, mingo@kernel.org Reply-To: linux-kernel@vger.kernel.org, mingo@kernel.org, bigeasy@linutronix.de, akpm@linux-foundation.org, hpa@zytor.com, tglx@linutronix.de In-Reply-To: <20161103145021.28528-3-bigeasy@linutronix.de> References: <20161103145021.28528-3-bigeasy@linutronix.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:smp/hotplug] kernel/printk: Convert to hotplug state machine Git-Commit-ID: 90b14889d2f9b29d7e5b4b2d36251c13ce3dd13f X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 90b14889d2f9b29d7e5b4b2d36251c13ce3dd13f Gitweb: http://git.kernel.org/tip/90b14889d2f9b29d7e5b4b2d36251c13ce3dd13f Author: Sebastian Andrzej Siewior AuthorDate: Thu, 3 Nov 2016 15:49:58 +0100 Committer: Thomas Gleixner CommitDate: Wed, 9 Nov 2016 23:45:26 +0100 kernel/printk: Convert to hotplug state machine Install the callbacks via the state machine. Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Thomas Gleixner Cc: Andrew Morton Cc: rt@linutronix.de Link: http://lkml.kernel.org/r/20161103145021.28528-3-bigeasy@linutronix.de Signed-off-by: Thomas Gleixner --- include/linux/cpuhotplug.h | 1 + kernel/printk/printk.c | 29 +++++++++++++---------------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h index 69b74fa..4174083 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h @@ -31,6 +31,7 @@ enum cpuhp_state { CPUHP_S390_PFAULT_DEAD, CPUHP_BLK_MQ_DEAD, CPUHP_FS_BUFF_DEAD, + CPUHP_PRINTK_DEAD, CPUHP_WORKQUEUE_PREP, CPUHP_POWER_NUMA_PREPARE, CPUHP_HRTIMERS_PREPARE, diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index de08fc9..4487ffc 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -2185,27 +2185,18 @@ void resume_console(void) /** * console_cpu_notify - print deferred console messages after CPU hotplug - * @self: notifier struct - * @action: CPU hotplug event - * @hcpu: unused + * @cpu: unused * * If printk() is called from a CPU that is not online yet, the messages * will be spooled but will not show up on the console. This function is * called when a new CPU comes online (or fails to come up), and ensures * that any such output gets printed. */ -static int console_cpu_notify(struct notifier_block *self, - unsigned long action, void *hcpu) -{ - switch (action) { - case CPU_ONLINE: - case CPU_DEAD: - case CPU_DOWN_FAILED: - case CPU_UP_CANCELED: - console_lock(); - console_unlock(); - } - return NOTIFY_OK; +static int console_cpu_notify(unsigned int cpu) +{ + console_lock(); + console_unlock(); + return 0; } /** @@ -2843,6 +2834,7 @@ EXPORT_SYMBOL(unregister_console); static int __init printk_late_init(void) { struct console *con; + int ret; for_each_console(con) { if (!keep_bootcon && con->flags & CON_BOOT) { @@ -2857,7 +2849,12 @@ static int __init printk_late_init(void) unregister_console(con); } } - hotcpu_notifier(console_cpu_notify, 0); + ret = cpuhp_setup_state_nocalls(CPUHP_PRINTK_DEAD, "printk:dead", NULL, + console_cpu_notify); + WARN_ON(ret < 0); + ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "printk:online", + console_cpu_notify, NULL); + WARN_ON(ret < 0); return 0; } late_initcall(printk_late_init);