]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - kernel/cpu.c
smp/cfd: Convert core to hotplug state machine
[karo-tx-linux.git] / kernel / cpu.c
index d948e44c471ea89aa2953f7a687c6b5783bbdf0e..008e2fd40cb18cafa7eeb11a1a75f1d3e73eef26 100644 (file)
@@ -517,6 +517,13 @@ static int cpuhp_invoke_ap_callback(int cpu, enum cpuhp_state state,
        if (!cpu_online(cpu))
                return 0;
 
+       /*
+        * If we are up and running, use the hotplug thread. For early calls
+        * we invoke the thread function directly.
+        */
+       if (!st->thread)
+               return cpuhp_invoke_callback(cpu, state, cb);
+
        st->cb_state = state;
        st->cb = cb;
        /*
@@ -1173,6 +1180,31 @@ static struct cpuhp_step cpuhp_bp_states[] = {
                .teardown               = NULL,
                .cant_stop              = true,
        },
+       [CPUHP_PERF_PREPARE] = {
+               .name = "perf prepare",
+               .startup = perf_event_init_cpu,
+               .teardown = perf_event_exit_cpu,
+       },
+       [CPUHP_WORKQUEUE_PREP] = {
+               .name = "workqueue prepare",
+               .startup = workqueue_prepare_cpu,
+               .teardown = NULL,
+       },
+       [CPUHP_HRTIMERS_PREPARE] = {
+               .name = "hrtimers prepare",
+               .startup = hrtimers_prepare_cpu,
+               .teardown = hrtimers_dead_cpu,
+       },
+       [CPUHP_SMPCFD_PREPARE] = {
+               .name = "SMPCFD prepare",
+               .startup = smpcfd_prepare_cpu,
+               .teardown = smpcfd_dead_cpu,
+       },
+       [CPUHP_TIMERS_DEAD] = {
+               .name = "timers dead",
+               .startup = NULL,
+               .teardown = timers_dead_cpu,
+       },
        /*
         * Preparatory and dead notifiers. Will be replaced once the notifiers
         * are converted to states.
@@ -1191,6 +1223,10 @@ static struct cpuhp_step cpuhp_bp_states[] = {
                .teardown               = NULL,
                .cant_stop              = true,
        },
+       [CPUHP_AP_SMPCFD_DYING] = {
+               .startup = NULL,
+               .teardown = smpcfd_dying_cpu,
+       },
        /*
         * Handled on controll processor until the plugged processor manages
         * this itself.
@@ -1201,6 +1237,8 @@ static struct cpuhp_step cpuhp_bp_states[] = {
                .teardown               = takedown_cpu,
                .cant_stop              = true,
        },
+#else
+       [CPUHP_BRINGUP_CPU] = { },
 #endif
 };
 
@@ -1248,6 +1286,17 @@ static struct cpuhp_step cpuhp_ap_states[] = {
                .startup                = smpboot_unpark_threads,
                .teardown               = NULL,
        },
+       [CPUHP_AP_PERF_ONLINE] = {
+               .name = "perf online",
+               .startup = perf_event_init_cpu,
+               .teardown = perf_event_exit_cpu,
+       },
+       [CPUHP_AP_WORKQUEUE_ONLINE] = {
+               .name = "workqueue online",
+               .startup = workqueue_online_cpu,
+               .teardown = workqueue_offline_cpu,
+       },
+
        /*
         * Online/down_prepare notifiers. Will be removed once the notifiers
         * are converted to states.