Skip to content

Commit d10ef6f

Browse files
committed
cpu/hotplug: Document states better
Requested-by: Peter Zijlstra <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]>
1 parent 2a58c52 commit d10ef6f

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

kernel/cpu.c

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1172,19 +1172,28 @@ static struct cpuhp_step cpuhp_bp_states[] = {
11721172
.teardown = NULL,
11731173
.cant_stop = true,
11741174
},
1175+
/*
1176+
* Preparatory and dead notifiers. Will be replaced once the notifiers
1177+
* are converted to states.
1178+
*/
11751179
[CPUHP_NOTIFY_PREPARE] = {
11761180
.name = "notify:prepare",
11771181
.startup = notify_prepare,
11781182
.teardown = notify_dead,
11791183
.skip_onerr = true,
11801184
.cant_stop = true,
11811185
},
1186+
/* Kicks the plugged cpu into life */
11821187
[CPUHP_BRINGUP_CPU] = {
11831188
.name = "cpu:bringup",
11841189
.startup = bringup_cpu,
11851190
.teardown = NULL,
11861191
.cant_stop = true,
11871192
},
1193+
/*
1194+
* Handled on controll processor until the plugged processor manages
1195+
* this itself.
1196+
*/
11881197
[CPUHP_TEARDOWN_CPU] = {
11891198
.name = "cpu:teardown",
11901199
.startup = NULL,
@@ -1197,24 +1206,56 @@ static struct cpuhp_step cpuhp_bp_states[] = {
11971206
/* Application processor state steps */
11981207
static struct cpuhp_step cpuhp_ap_states[] = {
11991208
#ifdef CONFIG_SMP
1209+
/* Final state before CPU kills itself */
1210+
[CPUHP_AP_IDLE_DEAD] = {
1211+
.name = "idle:dead",
1212+
},
1213+
/*
1214+
* Last state before CPU enters the idle loop to die. Transient state
1215+
* for synchronization.
1216+
*/
1217+
[CPUHP_AP_OFFLINE] = {
1218+
.name = "ap:offline",
1219+
.cant_stop = true,
1220+
},
1221+
/*
1222+
* Low level startup/teardown notifiers. Run with interrupts
1223+
* disabled. Will be removed once the notifiers are converted to
1224+
* states.
1225+
*/
12001226
[CPUHP_AP_NOTIFY_STARTING] = {
12011227
.name = "notify:starting",
12021228
.startup = notify_starting,
12031229
.teardown = notify_dying,
12041230
.skip_onerr = true,
12051231
.cant_stop = true,
12061232
},
1233+
/* Entry state on starting. Interrupts enabled from here on. Transient
1234+
* state for synchronsization */
1235+
[CPUHP_AP_ONLINE] = {
1236+
.name = "ap:online",
1237+
},
1238+
/* Handle smpboot threads park/unpark */
12071239
[CPUHP_AP_SMPBOOT_THREADS] = {
12081240
.name = "smpboot:threads",
12091241
.startup = smpboot_unpark_threads,
12101242
.teardown = NULL,
12111243
},
1244+
/*
1245+
* Online/down_prepare notifiers. Will be removed once the notifiers
1246+
* are converted to states.
1247+
*/
12121248
[CPUHP_AP_NOTIFY_ONLINE] = {
12131249
.name = "notify:online",
12141250
.startup = notify_online,
12151251
.teardown = notify_down_prepare,
12161252
},
12171253
#endif
1254+
/*
1255+
* The dynamically registered state space is here
1256+
*/
1257+
1258+
/* CPU is fully up and running. */
12181259
[CPUHP_ONLINE] = {
12191260
.name = "online",
12201261
.startup = NULL,
@@ -1232,7 +1273,11 @@ static int cpuhp_cb_check(enum cpuhp_state state)
12321273

12331274
static bool cpuhp_is_ap_state(enum cpuhp_state state)
12341275
{
1235-
return state > CPUHP_BRINGUP_CPU;
1276+
/*
1277+
* The extra check for CPUHP_TEARDOWN_CPU is only for documentation
1278+
* purposes as that state is handled explicitely in cpu_down.
1279+
*/
1280+
return state > CPUHP_BRINGUP_CPU && state != CPUHP_TEARDOWN_CPU;
12361281
}
12371282

12381283
static struct cpuhp_step *cpuhp_get_step(enum cpuhp_state state)

0 commit comments

Comments
 (0)