arch/hotplug: Call into idle with a proper state
authorThomas Gleixner <tglx@linutronix.de>
Fri, 26 Feb 2016 18:43:40 +0000 (18:43 +0000)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 1 Mar 2016 19:36:57 +0000 (20:36 +0100)
Let the non boot cpus call into idle with the corresponding hotplug state, so
the hotplug core can handle the further bringup. That's a first step to
convert the boot side of the hotplugged cpus to do all the synchronization
with the other side through the state machine. For now it'll only start the
hotplug thread and kick the full bringup of the cpu.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-arch@vger.kernel.org
Cc: Rik van Riel <riel@redhat.com>
Cc: Rafael Wysocki <rafael.j.wysocki@intel.com>
Cc: "Srivatsa S. Bhat" <srivatsa@mit.edu>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Sebastian Siewior <bigeasy@linutronix.de>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Paul McKenney <paulmck@linux.vnet.ibm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul Turner <pjt@google.com>
Link: http://lkml.kernel.org/r/20160226182341.614102639@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
22 files changed:
arch/alpha/kernel/smp.c
arch/arc/kernel/smp.c
arch/arm/kernel/smp.c
arch/arm64/kernel/smp.c
arch/blackfin/mach-common/smp.c
arch/hexagon/kernel/smp.c
arch/ia64/kernel/smpboot.c
arch/m32r/kernel/smpboot.c
arch/metag/kernel/smp.c
arch/mips/kernel/smp.c
arch/mn10300/kernel/smp.c
arch/parisc/kernel/smp.c
arch/powerpc/kernel/smp.c
arch/s390/kernel/smp.c
arch/sh/kernel/smp.c
arch/sparc/kernel/smp_32.c
arch/sparc/kernel/smp_64.c
arch/tile/kernel/smpboot.c
arch/x86/kernel/smpboot.c
arch/x86/xen/smp.c
arch/xtensa/kernel/smp.c
include/linux/cpuhotplug.h

index 2f24447fef92071b0ba9b94d09f8ed1fdc25d2d1..46bf263c315318cabb1c1530e6584f2060512497 100644 (file)
@@ -168,7 +168,7 @@ smp_callin(void)
              cpuid, current, current->active_mm));
 
        preempt_disable();
-       cpu_startup_entry(CPUHP_ONLINE);
+       cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
 }
 
 /* Wait until hwrpb->txrdy is clear for cpu.  Return -1 on timeout.  */
index 424e937da5c897d02cca7b1bd5781614f8d5d045..4cb3add77c75cc8da0600f385c8851fa12559240 100644 (file)
@@ -142,7 +142,7 @@ void start_kernel_secondary(void)
 
        local_irq_enable();
        preempt_disable();
-       cpu_startup_entry(CPUHP_ONLINE);
+       cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
 }
 
 /*
index 37312f6749f3dd641f48803b67c8f26a4623a8a2..baee70267f2939367ab412a8adaa5df929bb3f10 100644 (file)
@@ -409,7 +409,7 @@ asmlinkage void secondary_start_kernel(void)
        /*
         * OK, it's off to the idle thread for us
         */
-       cpu_startup_entry(CPUHP_ONLINE);
+       cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
 }
 
 void __init smp_cpus_done(unsigned int max_cpus)
index b1adc51b2c2e7682212554ba8276b5e7c25fbff5..460765799c642396f8b5d2c202c846b481974ff9 100644 (file)
@@ -195,7 +195,7 @@ asmlinkage void secondary_start_kernel(void)
        /*
         * OK, it's off to the idle thread for us
         */
-       cpu_startup_entry(CPUHP_ONLINE);
+       cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
 }
 
 #ifdef CONFIG_HOTPLUG_CPU
index 0030e21cfceb3b885e8365168ba91b74ddee4f75..23c4ef5f8bdced2fb30b461f94b53c56694db4a4 100644 (file)
@@ -333,7 +333,7 @@ void secondary_start_kernel(void)
 
        /* We are done with local CPU inits, unblock the boot CPU. */
        set_cpu_online(cpu, true);
-       cpu_startup_entry(CPUHP_ONLINE);
+       cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
 }
 
 void __init smp_prepare_boot_cpu(void)
index ff759f26b96aef8cbffbfc9c860aa7f2966ff27b..983bae7d2665cd6cc164e4584041b96f9e98f64e 100644 (file)
@@ -180,7 +180,7 @@ void start_secondary(void)
 
        local_irq_enable();
 
-       cpu_startup_entry(CPUHP_ONLINE);
+       cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
 }
 
 
index 0e76fad27975db388776f61e0cf8afd4241f1112..74fe317477e6273b48d0b97f29d96aeda7ba7872 100644 (file)
@@ -454,7 +454,7 @@ start_secondary (void *unused)
        preempt_disable();
        smp_callin();
 
-       cpu_startup_entry(CPUHP_ONLINE);
+       cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
        return 0;
 }
 
index a468467542f453d170e2ded0ac2e339ad574198f..f98d2f6519d633c85f3979e103f5bf5c3438cd28 100644 (file)
@@ -432,7 +432,7 @@ int __init start_secondary(void *unused)
         */
        local_flush_tlb_all();
 
-       cpu_startup_entry(CPUHP_ONLINE);
+       cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
        return 0;
 }
 
index c3c6f086488169cc06e53b1eb6eb07ea6b2e68ee..bad13232de51897c4040fda12772ae31a4dbcc1c 100644 (file)
@@ -396,7 +396,7 @@ asmlinkage void secondary_start_kernel(void)
        /*
         * OK, it's off to the idle thread for us
         */
-       cpu_startup_entry(CPUHP_ONLINE);
+       cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
 }
 
 void __init smp_cpus_done(unsigned int max_cpus)
index bd4385a8e6e86f7fbb9ca6d988f5eee155b9a8c7..f2112a8ddf157c5624a5f67a1f2740c81679301d 100644 (file)
@@ -191,7 +191,7 @@ asmlinkage void start_secondary(void)
        WARN_ON_ONCE(!irqs_disabled());
        mp_ops->smp_finish();
 
-       cpu_startup_entry(CPUHP_ONLINE);
+       cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
 }
 
 static void stop_this_cpu(void *dummy)
index f984193718b1003f03861e79cd137b4a8c23badd..426173c4b0b900c0315431ef1104932aa5f867a7 100644 (file)
@@ -675,7 +675,7 @@ int __init start_secondary(void *unused)
 #ifdef CONFIG_GENERIC_CLOCKEVENTS
        init_clockevents();
 #endif
-       cpu_startup_entry(CPUHP_ONLINE);
+       cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
        return 0;
 }
 
index 52e85973a283c96dff805586a19fa066ade0573e..c2a9cc55a62f63709e1d1e1b78d9a086ac3a2bf7 100644 (file)
@@ -305,7 +305,7 @@ void __init smp_callin(void)
 
        local_irq_enable();  /* Interrupts have been off until now */
 
-       cpu_startup_entry(CPUHP_ONLINE);
+       cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
 
        /* NOTREACHED */
        panic("smp_callin() AAAAaaaaahhhh....\n");
index ec9ec2058d2d3f3ec6db2dfbe25b35ab1f4cfb0b..cc13d4c832916bc13203ba308949ff13870782c8 100644 (file)
@@ -727,7 +727,7 @@ void start_secondary(void *unused)
 
        local_irq_enable();
 
-       cpu_startup_entry(CPUHP_ONLINE);
+       cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
 
        BUG();
 }
index 3c65a8eae34d35b6a670066db2bc80c8fa3ccf67..40a6b4f9c36cedd5400898572f32173c90bf0240 100644 (file)
@@ -798,7 +798,7 @@ static void smp_start_secondary(void *cpuvoid)
        set_cpu_online(smp_processor_id(), true);
        inc_irq_stat(CPU_RST);
        local_irq_enable();
-       cpu_startup_entry(CPUHP_ONLINE);
+       cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
 }
 
 /* Upping and downing of CPUs */
index de6be008fc0140ff7086bd4c153619f7213fc8cd..13f633add29ac46f21850400d63e6dafdc3d63c8 100644 (file)
@@ -203,7 +203,7 @@ asmlinkage void start_secondary(void)
        set_cpu_online(cpu, true);
        per_cpu(cpu_state, cpu) = CPU_ONLINE;
 
-       cpu_startup_entry(CPUHP_ONLINE);
+       cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
 }
 
 extern struct {
index b3a5d81b20f0f7c4fcaf669d11c90f733b2db4f2..fb30e7c6a5b15bac54e052010784327f62290589 100644 (file)
@@ -364,7 +364,7 @@ static void sparc_start_secondary(void *arg)
        local_irq_enable();
 
        wmb();
-       cpu_startup_entry(CPUHP_ONLINE);
+       cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
 
        /* We should never reach here! */
        BUG();
index 19cd08d1867285f059f768402e4df14c64d7871d..8a6151a628ce9bd6b5de8a3b60f8c7e3911d6aa7 100644 (file)
@@ -134,7 +134,7 @@ void smp_callin(void)
 
        local_irq_enable();
 
-       cpu_startup_entry(CPUHP_ONLINE);
+       cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
 }
 
 void cpu_panic(void)
index 20d52a98e1716be9a2ea5a58353ec78d6a44a6b9..6c0abaacec335be522041bd4634dc0561f708375 100644 (file)
@@ -208,7 +208,7 @@ void online_secondary(void)
        /* Set up tile-timer clock-event device on this cpu */
        setup_tile_timer();
 
-       cpu_startup_entry(CPUHP_ONLINE);
+       cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
 }
 
 int __cpu_up(unsigned int cpu, struct task_struct *tidle)
index 24d57f77b3c19615840ac4f09c8c0fd299864698..293b22a7ab0278dbdd845909f69629cc13f2a825 100644 (file)
@@ -248,7 +248,7 @@ static void notrace start_secondary(void *unused)
        x86_cpuinit.setup_percpu_clockev();
 
        wmb();
-       cpu_startup_entry(CPUHP_ONLINE);
+       cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
 }
 
 void __init smp_store_boot_cpu_info(void)
index 3f4ebf0261f28620a96cdd1cd6366c311c6761b5..3c6d17fd423a82006d89c71e7345bb6a566aec09 100644 (file)
@@ -112,7 +112,7 @@ asmlinkage __visible void cpu_bringup_and_idle(int cpu)
                xen_pvh_secondary_vcpu_init(cpu);
 #endif
        cpu_bringup();
-       cpu_startup_entry(CPUHP_ONLINE);
+       cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
 }
 
 static void xen_smp_intr_free(unsigned int cpu)
index 4d02e38514f5460cc9c3a65d7b4d390be1c9e3aa..fc4ad21a5ed44f9b170d9587c0934e581f75cd01 100644 (file)
@@ -157,7 +157,7 @@ void secondary_start_kernel(void)
 
        complete(&cpu_running);
 
-       cpu_startup_entry(CPUHP_ONLINE);
+       cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
 }
 
 static void mx_cpu_start(void *p)
index 8a715bb1e192b15717493641b85d3b0208476d07..4aa263adc536dee04ecff034e696c4987dbed36b 100644 (file)
@@ -13,6 +13,7 @@ enum cpuhp_state {
        CPUHP_CPU_SET_ACTIVE,
        CPUHP_KICK_AP_THREAD,
        CPUHP_BP_ONLINE,
+       CPUHP_AP_ONLINE_IDLE,
        CPUHP_AP_SMPBOOT_THREADS,
        CPUHP_AP_NOTIFY_ONLINE,
        CPUHP_AP_ONLINE_DYN,