aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2016-07-18 10:07:28 -0400
committerThomas Gleixner <tglx@linutronix.de>2016-07-22 15:53:17 -0400
commitbdab88e006504cd83fac98705814485cbe3ef5b4 (patch)
treedac9f2dda75a639c5e0e7b446e54a55e23525e9c
parent37b502f121adab26ccc2769c3063f0e1272be7de (diff)
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 <bigeasy@linutronix.de> Cc: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Bharata B Rao <bharata@linux.vnet.ibm.com> Cc: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Christophe Jaillet <christophe.jaillet@wanadoo.fr> Cc: Anton Blanchard <anton@samba.org> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Paul Mackerras <paulus@samba.org> Cc: Andrew Morton <akpm@linux-foundation.org> 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 <tglx@linutronix.de>
-rw-r--r--arch/powerpc/mm/numa.c48
-rw-r--r--include/linux/cpuhotplug.h1
2 files changed, 20 insertions, 29 deletions
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 669a15e7fa76..6dc07ddbfd04 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)
581 } 581 }
582} 582}
583 583
584static int cpu_numa_callback(struct notifier_block *nfb, unsigned long action, 584/* Must run before sched domains notifier. */
585 void *hcpu) 585static int ppc_numa_cpu_prepare(unsigned int cpu)
586{ 586{
587 unsigned long lcpu = (unsigned long)hcpu; 587 int nid;
588 int ret = NOTIFY_DONE, nid;
589 588
590 switch (action) { 589 nid = numa_setup_cpu(cpu);
591 case CPU_UP_PREPARE: 590 verify_cpu_node_mapping(cpu, nid);
592 case CPU_UP_PREPARE_FROZEN: 591 return 0;
593 nid = numa_setup_cpu(lcpu); 592}
594 verify_cpu_node_mapping((int)lcpu, nid); 593
595 ret = NOTIFY_OK; 594static int ppc_numa_cpu_dead(unsigned int cpu)
596 break; 595{
597#ifdef CONFIG_HOTPLUG_CPU 596#ifdef CONFIG_HOTPLUG_CPU
598 case CPU_DEAD: 597 unmap_cpu_from_node(cpu);
599 case CPU_DEAD_FROZEN:
600 case CPU_UP_CANCELED:
601 case CPU_UP_CANCELED_FROZEN:
602 unmap_cpu_from_node(lcpu);
603 ret = NOTIFY_OK;
604 break;
605#endif 598#endif
606 } 599 return 0;
607 return ret;
608} 600}
609 601
610/* 602/*
@@ -913,11 +905,6 @@ static void __init dump_numa_memory_topology(void)
913 } 905 }
914} 906}
915 907
916static struct notifier_block ppc64_numa_nb = {
917 .notifier_call = cpu_numa_callback,
918 .priority = 1 /* Must run before sched domains notifier. */
919};
920
921/* Initialize NODE_DATA for a node on the local memory */ 908/* Initialize NODE_DATA for a node on the local memory */
922static void __init setup_node_data(int nid, u64 start_pfn, u64 end_pfn) 909static void __init setup_node_data(int nid, u64 start_pfn, u64 end_pfn)
923{ 910{
@@ -985,15 +972,18 @@ void __init initmem_init(void)
985 setup_node_to_cpumask_map(); 972 setup_node_to_cpumask_map();
986 973
987 reset_numa_cpu_lookup_table(); 974 reset_numa_cpu_lookup_table();
988 register_cpu_notifier(&ppc64_numa_nb); 975
989 /* 976 /*
990 * We need the numa_cpu_lookup_table to be accurate for all CPUs, 977 * We need the numa_cpu_lookup_table to be accurate for all CPUs,
991 * even before we online them, so that we can use cpu_to_{node,mem} 978 * even before we online them, so that we can use cpu_to_{node,mem}
992 * early in boot, cf. smp_prepare_cpus(). 979 * early in boot, cf. smp_prepare_cpus().
980 * _nocalls() + manual invocation is used because cpuhp is not yet
981 * initialized for the boot CPU.
993 */ 982 */
994 for_each_present_cpu(cpu) { 983 cpuhp_setup_state_nocalls(CPUHP_POWER_NUMA_PREPARE, "POWER_NUMA_PREPARE",
995 numa_setup_cpu((unsigned long)cpu); 984 ppc_numa_cpu_prepare, ppc_numa_cpu_dead);
996 } 985 for_each_present_cpu(cpu)
986 numa_setup_cpu(cpu);
997} 987}
998 988
999static int __init early_numa(char *p) 989static int __init early_numa(char *p)
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
index 09ef54bcba39..5015f463d314 100644
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -15,6 +15,7 @@ enum cpuhp_state {
15 CPUHP_X86_HPET_DEAD, 15 CPUHP_X86_HPET_DEAD,
16 CPUHP_X86_APB_DEAD, 16 CPUHP_X86_APB_DEAD,
17 CPUHP_WORKQUEUE_PREP, 17 CPUHP_WORKQUEUE_PREP,
18 CPUHP_POWER_NUMA_PREPARE,
18 CPUHP_HRTIMERS_PREPARE, 19 CPUHP_HRTIMERS_PREPARE,
19 CPUHP_PROFILE_PREPARE, 20 CPUHP_PROFILE_PREPARE,
20 CPUHP_X2APIC_PREPARE, 21 CPUHP_X2APIC_PREPARE,