From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754693AbcKIW5L (ORCPT ); Wed, 9 Nov 2016 17:57:11 -0500 Received: from terminus.zytor.com ([198.137.202.10]:55496 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753269AbcKIW5J (ORCPT ); Wed, 9 Nov 2016 17:57:09 -0500 Date: Wed, 9 Nov 2016 14:57:01 -0800 From: tip-bot for Sebastian Andrzej Siewior Message-ID: Cc: hpa@zytor.com, mingo@kernel.org, heiko.carstens@de.ibm.com, schwidefsky@de.ibm.com, linux-kernel@vger.kernel.org, tglx@linutronix.de, bigeasy@linutronix.de Reply-To: bigeasy@linutronix.de, tglx@linutronix.de, linux-kernel@vger.kernel.org, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, mingo@kernel.org, hpa@zytor.com In-Reply-To: <20161104144502.7kd4bxz2rxqvtack@linutronix.de> References: <20161104144502.7kd4bxz2rxqvtack@linutronix.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:smp/hotplug] s390/smp: Convert to hotplug state machine Git-Commit-ID: dfbbd86a0f1c3ceec15b64c8f2149a903806ed8c 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: dfbbd86a0f1c3ceec15b64c8f2149a903806ed8c Gitweb: http://git.kernel.org/tip/dfbbd86a0f1c3ceec15b64c8f2149a903806ed8c Author: Sebastian Andrzej Siewior AuthorDate: Fri, 4 Nov 2016 15:45:03 +0100 Committer: Thomas Gleixner CommitDate: Wed, 9 Nov 2016 23:45:28 +0100 s390/smp: Convert to hotplug state machine cpuhp_setup_state() invokes the startup callback on all online cpus with the proper protection, so we can remove the cpu hotplug protection from the init function and the creation of the per cpu files for online cpus in smp_add_present_cpu(). smp_add_present_cpu() is called also called from __smp_rescan_cpus(), but this callpath never adds an online cpu, it merily adds newly present cpus, so the creation of the cpu files is not required. Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Thomas Gleixner Acked-by: Heiko Carstens Cc: Martin Schwidefsky Cc: linux-s390@vger.kernel.org Cc: rt@linutronix.de Link: http://lkml.kernel.org/r/20161104144502.7kd4bxz2rxqvtack@linutronix.de Signed-off-by: Thomas Gleixner --- arch/s390/kernel/smp.c | 37 +++++++++++-------------------------- 1 file changed, 11 insertions(+), 26 deletions(-) diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c index 2a9c03d..870fb5a 100644 --- a/arch/s390/kernel/smp.c +++ b/arch/s390/kernel/smp.c @@ -1047,23 +1047,18 @@ static struct attribute_group cpu_online_attr_group = { .attrs = cpu_online_attrs, }; -static int smp_cpu_notify(struct notifier_block *self, unsigned long action, - void *hcpu) +static int smp_cpu_online(unsigned int cpu) { - unsigned int cpu = (unsigned int)(long)hcpu; struct device *s = &per_cpu(cpu_device, cpu)->dev; - int err = 0; - switch (action & ~CPU_TASKS_FROZEN) { - case CPU_ONLINE: - case CPU_DOWN_FAILED: - err = sysfs_create_group(&s->kobj, &cpu_online_attr_group); - break; - case CPU_DOWN_PREPARE: - sysfs_remove_group(&s->kobj, &cpu_online_attr_group); - break; - } - return notifier_from_errno(err); + return sysfs_create_group(&s->kobj, &cpu_online_attr_group); +} +static int smp_cpu_pre_down(unsigned int cpu) +{ + struct device *s = &per_cpu(cpu_device, cpu)->dev; + + sysfs_remove_group(&s->kobj, &cpu_online_attr_group); + return 0; } static int smp_add_present_cpu(int cpu) @@ -1084,20 +1079,12 @@ static int smp_add_present_cpu(int cpu) rc = sysfs_create_group(&s->kobj, &cpu_common_attr_group); if (rc) goto out_cpu; - if (cpu_online(cpu)) { - rc = sysfs_create_group(&s->kobj, &cpu_online_attr_group); - if (rc) - goto out_online; - } rc = topology_cpu_init(c); if (rc) goto out_topology; return 0; out_topology: - if (cpu_online(cpu)) - sysfs_remove_group(&s->kobj, &cpu_online_attr_group); -out_online: sysfs_remove_group(&s->kobj, &cpu_common_attr_group); out_cpu: #ifdef CONFIG_HOTPLUG_CPU @@ -1150,17 +1137,15 @@ static int __init s390_smp_init(void) if (rc) return rc; #endif - cpu_notifier_register_begin(); for_each_present_cpu(cpu) { rc = smp_add_present_cpu(cpu); if (rc) goto out; } - __hotcpu_notifier(smp_cpu_notify, 0); - + rc = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "s390/smp:online", + smp_cpu_online, smp_cpu_pre_down); out: - cpu_notifier_register_done(); return rc; } subsys_initcall(s390_smp_init);