From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753421AbdIDH4Z (ORCPT ); Mon, 4 Sep 2017 03:56:25 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:41176 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751949AbdIDH4X (ORCPT ); Mon, 4 Sep 2017 03:56:23 -0400 Date: Mon, 4 Sep 2017 09:56:21 +0200 (CEST) From: Thomas Gleixner To: Linus Torvalds cc: LKML , Ingo Molnar , "H. Peter Anvin" Subject: [GIT pull] cpu hotplug updates for 4.14 Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Linus, please pull the latest smp-hotplug-for-linus git tree from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git smp-hotplug-for-linus A single fix to handle the removal of the first dynamic CPU hotplug state correctly. Thanks, tglx ------------------> Ethan Barnes (1): smp/hotplug: Handle removal correctly in cpuhp_store_callbacks() kernel/cpu.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/kernel/cpu.c b/kernel/cpu.c index eee033134262..a88c29ab09be 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -1252,7 +1252,17 @@ static int cpuhp_store_callbacks(enum cpuhp_state state, const char *name, struct cpuhp_step *sp; int ret = 0; - if (state == CPUHP_AP_ONLINE_DYN || state == CPUHP_BP_PREPARE_DYN) { + /* + * If name is NULL, then the state gets removed. + * + * CPUHP_AP_ONLINE_DYN and CPUHP_BP_PREPARE_DYN are handed out on + * the first allocation from these dynamic ranges, so the removal + * would trigger a new allocation and clear the wrong (already + * empty) state, leaving the callbacks of the to be cleared state + * dangling, which causes wreckage on the next hotplug operation. + */ + if (name && (state == CPUHP_AP_ONLINE_DYN || + state == CPUHP_BP_PREPARE_DYN)) { ret = cpuhp_reserve_state(state); if (ret < 0) return ret;