aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2016-03-08 04:36:13 -0500
committerThomas Gleixner <tglx@linutronix.de>2016-03-12 14:57:38 -0500
commitd10ef6f9380b8853c4b48eb104268fccfdc0b0c5 (patch)
treefa8c286cb350bbc211cc79d93fc33888acf903a3
parent2a58c527bb566b7abad96289fa5b973040c33c82 (diff)
cpu/hotplug: Document states better
Requested-by: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--kernel/cpu.c47
1 files changed, 46 insertions, 1 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c
index bcee286b7c73..6ea42e8da861 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -1172,6 +1172,10 @@ static struct cpuhp_step cpuhp_bp_states[] = {
1172 .teardown = NULL, 1172 .teardown = NULL,
1173 .cant_stop = true, 1173 .cant_stop = true,
1174 }, 1174 },
1175 /*
1176 * Preparatory and dead notifiers. Will be replaced once the notifiers
1177 * are converted to states.
1178 */
1175 [CPUHP_NOTIFY_PREPARE] = { 1179 [CPUHP_NOTIFY_PREPARE] = {
1176 .name = "notify:prepare", 1180 .name = "notify:prepare",
1177 .startup = notify_prepare, 1181 .startup = notify_prepare,
@@ -1179,12 +1183,17 @@ static struct cpuhp_step cpuhp_bp_states[] = {
1179 .skip_onerr = true, 1183 .skip_onerr = true,
1180 .cant_stop = true, 1184 .cant_stop = true,
1181 }, 1185 },
1186 /* Kicks the plugged cpu into life */
1182 [CPUHP_BRINGUP_CPU] = { 1187 [CPUHP_BRINGUP_CPU] = {
1183 .name = "cpu:bringup", 1188 .name = "cpu:bringup",
1184 .startup = bringup_cpu, 1189 .startup = bringup_cpu,
1185 .teardown = NULL, 1190 .teardown = NULL,
1186 .cant_stop = true, 1191 .cant_stop = true,
1187 }, 1192 },
1193 /*
1194 * Handled on controll processor until the plugged processor manages
1195 * this itself.
1196 */
1188 [CPUHP_TEARDOWN_CPU] = { 1197 [CPUHP_TEARDOWN_CPU] = {
1189 .name = "cpu:teardown", 1198 .name = "cpu:teardown",
1190 .startup = NULL, 1199 .startup = NULL,
@@ -1197,6 +1206,23 @@ static struct cpuhp_step cpuhp_bp_states[] = {
1197/* Application processor state steps */ 1206/* Application processor state steps */
1198static struct cpuhp_step cpuhp_ap_states[] = { 1207static struct cpuhp_step cpuhp_ap_states[] = {
1199#ifdef CONFIG_SMP 1208#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 */
1200 [CPUHP_AP_NOTIFY_STARTING] = { 1226 [CPUHP_AP_NOTIFY_STARTING] = {
1201 .name = "notify:starting", 1227 .name = "notify:starting",
1202 .startup = notify_starting, 1228 .startup = notify_starting,
@@ -1204,17 +1230,32 @@ static struct cpuhp_step cpuhp_ap_states[] = {
1204 .skip_onerr = true, 1230 .skip_onerr = true,
1205 .cant_stop = true, 1231 .cant_stop = true,
1206 }, 1232 },
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 */
1207 [CPUHP_AP_SMPBOOT_THREADS] = { 1239 [CPUHP_AP_SMPBOOT_THREADS] = {
1208 .name = "smpboot:threads", 1240 .name = "smpboot:threads",
1209 .startup = smpboot_unpark_threads, 1241 .startup = smpboot_unpark_threads,
1210 .teardown = NULL, 1242 .teardown = NULL,
1211 }, 1243 },
1244 /*
1245 * Online/down_prepare notifiers. Will be removed once the notifiers
1246 * are converted to states.
1247 */
1212 [CPUHP_AP_NOTIFY_ONLINE] = { 1248 [CPUHP_AP_NOTIFY_ONLINE] = {
1213 .name = "notify:online", 1249 .name = "notify:online",
1214 .startup = notify_online, 1250 .startup = notify_online,
1215 .teardown = notify_down_prepare, 1251 .teardown = notify_down_prepare,
1216 }, 1252 },
1217#endif 1253#endif
1254 /*
1255 * The dynamically registered state space is here
1256 */
1257
1258 /* CPU is fully up and running. */
1218 [CPUHP_ONLINE] = { 1259 [CPUHP_ONLINE] = {
1219 .name = "online", 1260 .name = "online",
1220 .startup = NULL, 1261 .startup = NULL,
@@ -1232,7 +1273,11 @@ static int cpuhp_cb_check(enum cpuhp_state state)
1232 1273
1233static bool cpuhp_is_ap_state(enum cpuhp_state state) 1274static bool cpuhp_is_ap_state(enum cpuhp_state state)
1234{ 1275{
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;
1236} 1281}
1237 1282
1238static struct cpuhp_step *cpuhp_get_step(enum cpuhp_state state) 1283static struct cpuhp_step *cpuhp_get_step(enum cpuhp_state state)