aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-09-04 16:53:53 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-09-04 16:53:53 -0400
commitd725c7ac8b96cbdc28266895c6f7080c55bf2f23 (patch)
tree369755212931a08450c9d5529e629ed4c63168f7
parent93cc1228b4a60584f3dadbd84f19f365bb945acb (diff)
parent0c96b27305faf06c068b45e07d28336c80dac286 (diff)
Merge branch 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull CPU hotplug fix from Thomas Gleixner: "A single fix to handle the removal of the first dynamic CPU hotplug state correctly" * 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: smp/hotplug: Handle removal correctly in cpuhp_store_callbacks()
-rw-r--r--kernel/cpu.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c
index bfbd649ccdc8..acf5308fad51 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -1253,7 +1253,17 @@ static int cpuhp_store_callbacks(enum cpuhp_state state, const char *name,
1253 struct cpuhp_step *sp; 1253 struct cpuhp_step *sp;
1254 int ret = 0; 1254 int ret = 0;
1255 1255
1256 if (state == CPUHP_AP_ONLINE_DYN || state == CPUHP_BP_PREPARE_DYN) { 1256 /*
1257 * If name is NULL, then the state gets removed.
1258 *
1259 * CPUHP_AP_ONLINE_DYN and CPUHP_BP_PREPARE_DYN are handed out on
1260 * the first allocation from these dynamic ranges, so the removal
1261 * would trigger a new allocation and clear the wrong (already
1262 * empty) state, leaving the callbacks of the to be cleared state
1263 * dangling, which causes wreckage on the next hotplug operation.
1264 */
1265 if (name && (state == CPUHP_AP_ONLINE_DYN ||
1266 state == CPUHP_BP_PREPARE_DYN)) {
1257 ret = cpuhp_reserve_state(state); 1267 ret = cpuhp_reserve_state(state);
1258 if (ret < 0) 1268 if (ret < 0)
1259 return ret; 1269 return ret;