From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754544AbcGVT7M (ORCPT ); Fri, 22 Jul 2016 15:59:12 -0400 Received: from terminus.zytor.com ([198.137.202.10]:58978 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754408AbcGVT7H (ORCPT ); Fri, 22 Jul 2016 15:59:07 -0400 Date: Fri, 22 Jul 2016 12:57:57 -0700 From: tip-bot for Sebastian Andrzej Siewior Message-ID: Cc: nikunj@linux.vnet.ibm.com, anton@samba.org, torvalds@linux-foundation.org, paulus@samba.org, hpa@zytor.com, christophe.jaillet@wanadoo.fr, tglx@linutronix.de, linux-kernel@vger.kernel.org, bigeasy@linutronix.de, mpe@ellerman.id.au, mingo@kernel.org, raghavendra.kt@linux.vnet.ibm.com, benh@kernel.crashing.org, akpm@linux-foundation.org, peterz@infradead.org, bharata@linux.vnet.ibm.com Reply-To: akpm@linux-foundation.org, peterz@infradead.org, bharata@linux.vnet.ibm.com, anton@samba.org, nikunj@linux.vnet.ibm.com, torvalds@linux-foundation.org, paulus@samba.org, hpa@zytor.com, linux-kernel@vger.kernel.org, bigeasy@linutronix.de, tglx@linutronix.de, christophe.jaillet@wanadoo.fr, mpe@ellerman.id.au, raghavendra.kt@linux.vnet.ibm.com, mingo@kernel.org, benh@kernel.crashing.org In-Reply-To: <20160718140727.GA13132@linutronix.de> References: <20160718140727.GA13132@linutronix.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:smp/hotplug] powerpc/numa: Convert to hotplug state machine Git-Commit-ID: bdab88e006504cd83fac98705814485cbe3ef5b4 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: bdab88e006504cd83fac98705814485cbe3ef5b4 Gitweb: http://git.kernel.org/tip/bdab88e006504cd83fac98705814485cbe3ef5b4 Author: Sebastian Andrzej Siewior AuthorDate: Mon, 18 Jul 2016 16:07:28 +0200 Committer: Thomas Gleixner CommitDate: Fri, 22 Jul 2016 21:53:17 +0200 powerpc/numa: Convert to hotplug state machine Install the callbacks via the state machine. On the boot cpu the callback is invoked manually because cpuhp is not up yet and everything must be preinitialized before additional CPUs are up. Signed-off-by: Sebastian Andrzej Siewior Cc: Nikunj A Dadhania Cc: Peter Zijlstra Cc: Benjamin Herrenschmidt Cc: Bharata B Rao Cc: Raghavendra K T Cc: Linus Torvalds Cc: Christophe Jaillet Cc: Anton Blanchard Cc: Michael Ellerman Cc: Paul Mackerras Cc: Andrew Morton Cc: linuxppc-dev@lists.ozlabs.org Cc: rt@linutronix.de Link: http://lkml.kernel.org/r/20160718140727.GA13132@linutronix.de Signed-off-by: Thomas Gleixner --- arch/powerpc/mm/numa.c | 48 ++++++++++++++++++---------------------------- include/linux/cpuhotplug.h | 1 + 2 files changed, 20 insertions(+), 29 deletions(-) diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index 669a15e..6dc07dd 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c @@ -581,30 +581,22 @@ static void verify_cpu_node_mapping(int cpu, int node) } } -static int cpu_numa_callback(struct notifier_block *nfb, unsigned long action, - void *hcpu) +/* Must run before sched domains notifier. */ +static int ppc_numa_cpu_prepare(unsigned int cpu) { - unsigned long lcpu = (unsigned long)hcpu; - int ret = NOTIFY_DONE, nid; + int nid; - switch (action) { - case CPU_UP_PREPARE: - case CPU_UP_PREPARE_FROZEN: - nid = numa_setup_cpu(lcpu); - verify_cpu_node_mapping((int)lcpu, nid); - ret = NOTIFY_OK; - break; + nid = numa_setup_cpu(cpu); + verify_cpu_node_mapping(cpu, nid); + return 0; +} + +static int ppc_numa_cpu_dead(unsigned int cpu) +{ #ifdef CONFIG_HOTPLUG_CPU - case CPU_DEAD: - case CPU_DEAD_FROZEN: - case CPU_UP_CANCELED: - case CPU_UP_CANCELED_FROZEN: - unmap_cpu_from_node(lcpu); - ret = NOTIFY_OK; - break; + unmap_cpu_from_node(cpu); #endif - } - return ret; + return 0; } /* @@ -913,11 +905,6 @@ static void __init dump_numa_memory_topology(void) } } -static struct notifier_block ppc64_numa_nb = { - .notifier_call = cpu_numa_callback, - .priority = 1 /* Must run before sched domains notifier. */ -}; - /* Initialize NODE_DATA for a node on the local memory */ static void __init setup_node_data(int nid, u64 start_pfn, u64 end_pfn) { @@ -985,15 +972,18 @@ void __init initmem_init(void) setup_node_to_cpumask_map(); reset_numa_cpu_lookup_table(); - register_cpu_notifier(&ppc64_numa_nb); + /* * We need the numa_cpu_lookup_table to be accurate for all CPUs, * even before we online them, so that we can use cpu_to_{node,mem} * early in boot, cf. smp_prepare_cpus(). + * _nocalls() + manual invocation is used because cpuhp is not yet + * initialized for the boot CPU. */ - for_each_present_cpu(cpu) { - numa_setup_cpu((unsigned long)cpu); - } + cpuhp_setup_state_nocalls(CPUHP_POWER_NUMA_PREPARE, "POWER_NUMA_PREPARE", + ppc_numa_cpu_prepare, ppc_numa_cpu_dead); + for_each_present_cpu(cpu) + numa_setup_cpu(cpu); } static int __init early_numa(char *p) diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h index 09ef54b..5015f46 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h @@ -15,6 +15,7 @@ enum cpuhp_state { CPUHP_X86_HPET_DEAD, CPUHP_X86_APB_DEAD, CPUHP_WORKQUEUE_PREP, + CPUHP_POWER_NUMA_PREPARE, CPUHP_HRTIMERS_PREPARE, CPUHP_PROFILE_PREPARE, CPUHP_X2APIC_PREPARE,