aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/cpu.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-07-29 16:55:30 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-07-29 16:55:30 -0400
commita6408f6cb63ac0958fee7dbce7861ffb540d8a49 (patch)
treec94a835d343974171951e3b805e6bbbb02852ebc /kernel/cpu.c
parent1a81a8f2a5918956e214bb718099a89e500e7ec5 (diff)
parent4fae16dffb812f0e0d98a0b2b0856ca48ca63e6c (diff)
Merge branch 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull smp hotplug updates from Thomas Gleixner: "This is the next part of the hotplug rework. - Convert all notifiers with a priority assigned - Convert all CPU_STARTING/DYING notifiers The final removal of the STARTING/DYING infrastructure will happen when the merge window closes. Another 700 hundred line of unpenetrable maze gone :)" * 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (70 commits) timers/core: Correct callback order during CPU hot plug leds/trigger/cpu: Move from CPU_STARTING to ONLINE level powerpc/numa: Convert to hotplug state machine arm/perf: Fix hotplug state machine conversion irqchip/armada: Avoid unused function warnings ARC/time: Convert to hotplug state machine clocksource/atlas7: Convert to hotplug state machine clocksource/armada-370-xp: Convert to hotplug state machine clocksource/exynos_mct: Convert to hotplug state machine clocksource/arm_global_timer: Convert to hotplug state machine rcu: Convert rcutree to hotplug state machine KVM/arm/arm64/vgic-new: Convert to hotplug state machine smp/cfd: Convert core to hotplug state machine x86/x2apic: Convert to CPU hotplug state machine profile: Convert to hotplug state machine timers/core: Convert to hotplug state machine hrtimer: Convert to hotplug state machine x86/tboot: Convert to hotplug state machine arm64/armv8 deprecated: Convert to hotplug state machine hwtracing/coresight-etm4x: Convert to hotplug state machine ...
Diffstat (limited to 'kernel/cpu.c')
-rw-r--r--kernel/cpu.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 7b61887f7ccd..341bf80f80bd 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -517,6 +517,13 @@ static int cpuhp_invoke_ap_callback(int cpu, enum cpuhp_state state,
517 if (!cpu_online(cpu)) 517 if (!cpu_online(cpu))
518 return 0; 518 return 0;
519 519
520 /*
521 * If we are up and running, use the hotplug thread. For early calls
522 * we invoke the thread function directly.
523 */
524 if (!st->thread)
525 return cpuhp_invoke_callback(cpu, state, cb);
526
520 st->cb_state = state; 527 st->cb_state = state;
521 st->cb = cb; 528 st->cb = cb;
522 /* 529 /*
@@ -1173,6 +1180,31 @@ static struct cpuhp_step cpuhp_bp_states[] = {
1173 .teardown = NULL, 1180 .teardown = NULL,
1174 .cant_stop = true, 1181 .cant_stop = true,
1175 }, 1182 },
1183 [CPUHP_PERF_PREPARE] = {
1184 .name = "perf prepare",
1185 .startup = perf_event_init_cpu,
1186 .teardown = perf_event_exit_cpu,
1187 },
1188 [CPUHP_WORKQUEUE_PREP] = {
1189 .name = "workqueue prepare",
1190 .startup = workqueue_prepare_cpu,
1191 .teardown = NULL,
1192 },
1193 [CPUHP_HRTIMERS_PREPARE] = {
1194 .name = "hrtimers prepare",
1195 .startup = hrtimers_prepare_cpu,
1196 .teardown = hrtimers_dead_cpu,
1197 },
1198 [CPUHP_SMPCFD_PREPARE] = {
1199 .name = "SMPCFD prepare",
1200 .startup = smpcfd_prepare_cpu,
1201 .teardown = smpcfd_dead_cpu,
1202 },
1203 [CPUHP_RCUTREE_PREP] = {
1204 .name = "RCU-tree prepare",
1205 .startup = rcutree_prepare_cpu,
1206 .teardown = rcutree_dead_cpu,
1207 },
1176 /* 1208 /*
1177 * Preparatory and dead notifiers. Will be replaced once the notifiers 1209 * Preparatory and dead notifiers. Will be replaced once the notifiers
1178 * are converted to states. 1210 * are converted to states.
@@ -1184,6 +1216,16 @@ static struct cpuhp_step cpuhp_bp_states[] = {
1184 .skip_onerr = true, 1216 .skip_onerr = true,
1185 .cant_stop = true, 1217 .cant_stop = true,
1186 }, 1218 },
1219 /*
1220 * On the tear-down path, timers_dead_cpu() must be invoked
1221 * before blk_mq_queue_reinit_notify() from notify_dead(),
1222 * otherwise a RCU stall occurs.
1223 */
1224 [CPUHP_TIMERS_DEAD] = {
1225 .name = "timers dead",
1226 .startup = NULL,
1227 .teardown = timers_dead_cpu,
1228 },
1187 /* Kicks the plugged cpu into life */ 1229 /* Kicks the plugged cpu into life */
1188 [CPUHP_BRINGUP_CPU] = { 1230 [CPUHP_BRINGUP_CPU] = {
1189 .name = "cpu:bringup", 1231 .name = "cpu:bringup",
@@ -1191,6 +1233,10 @@ static struct cpuhp_step cpuhp_bp_states[] = {
1191 .teardown = NULL, 1233 .teardown = NULL,
1192 .cant_stop = true, 1234 .cant_stop = true,
1193 }, 1235 },
1236 [CPUHP_AP_SMPCFD_DYING] = {
1237 .startup = NULL,
1238 .teardown = smpcfd_dying_cpu,
1239 },
1194 /* 1240 /*
1195 * Handled on controll processor until the plugged processor manages 1241 * Handled on controll processor until the plugged processor manages
1196 * this itself. 1242 * this itself.
@@ -1227,6 +1273,10 @@ static struct cpuhp_step cpuhp_ap_states[] = {
1227 .startup = sched_cpu_starting, 1273 .startup = sched_cpu_starting,
1228 .teardown = sched_cpu_dying, 1274 .teardown = sched_cpu_dying,
1229 }, 1275 },
1276 [CPUHP_AP_RCUTREE_DYING] = {
1277 .startup = NULL,
1278 .teardown = rcutree_dying_cpu,
1279 },
1230 /* 1280 /*
1231 * Low level startup/teardown notifiers. Run with interrupts 1281 * Low level startup/teardown notifiers. Run with interrupts
1232 * disabled. Will be removed once the notifiers are converted to 1282 * disabled. Will be removed once the notifiers are converted to
@@ -1250,6 +1300,22 @@ static struct cpuhp_step cpuhp_ap_states[] = {
1250 .startup = smpboot_unpark_threads, 1300 .startup = smpboot_unpark_threads,
1251 .teardown = NULL, 1301 .teardown = NULL,
1252 }, 1302 },
1303 [CPUHP_AP_PERF_ONLINE] = {
1304 .name = "perf online",
1305 .startup = perf_event_init_cpu,
1306 .teardown = perf_event_exit_cpu,
1307 },
1308 [CPUHP_AP_WORKQUEUE_ONLINE] = {
1309 .name = "workqueue online",
1310 .startup = workqueue_online_cpu,
1311 .teardown = workqueue_offline_cpu,
1312 },
1313 [CPUHP_AP_RCUTREE_ONLINE] = {
1314 .name = "RCU-tree online",
1315 .startup = rcutree_online_cpu,
1316 .teardown = rcutree_offline_cpu,
1317 },
1318
1253 /* 1319 /*
1254 * Online/down_prepare notifiers. Will be removed once the notifiers 1320 * Online/down_prepare notifiers. Will be removed once the notifiers
1255 * are converted to states. 1321 * are converted to states.