Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1547400

[patch 1/2] smp/hotplug: Undo tglxs brainfart

From Thomas Gleixner <tglx@linutronix.de>
Newsgroups linux.kernel
Subject [patch 1/2] smp/hotplug: Undo tglxs brainfart
Date 2016-12-26 23:10 +0100
Message-ID <sSLCV-24U-3@gated-at.bofh.it> (permalink)
References <sSLCV-24U-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


The attempt to prevent overwriting an active state resulted in a disaster
which effectively disables all dynamically allocated hotplug states.

Cleanup the mess.

Fixes: dc280d936239 ("cpu/hotplug: Prevent overwriting of callbacks")
Reported-by: Markus Trippelsdorf <markus@trippelsdorf.de>
Reported-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 kernel/cpu.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -1471,6 +1471,7 @@ int __cpuhp_setup_state(enum cpuhp_state
 			bool multi_instance)
 {
 	int cpu, ret = 0;
+	bool dynstate;
 
 	if (cpuhp_cb_check(state) || !name)
 		return -EINVAL;
@@ -1480,6 +1481,12 @@ int __cpuhp_setup_state(enum cpuhp_state
 	ret = cpuhp_store_callbacks(state, name, startup, teardown,
 				    multi_instance);
 
+	dynstate = state == CPUHP_AP_ONLINE_DYN;
+	if (ret > 0 && dynstate) {
+		state = ret;
+		ret = 0;
+	}
+
 	if (ret || !invoke || !startup)
 		goto out;
 
@@ -1508,7 +1515,7 @@ int __cpuhp_setup_state(enum cpuhp_state
 	 * If the requested state is CPUHP_AP_ONLINE_DYN, return the
 	 * dynamically allocated state in case of success.
 	 */
-	if (!ret && state == CPUHP_AP_ONLINE_DYN)
+	if (!ret && dynstate)
 		return state;
 	return ret;
 }

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[patch 1/2] smp/hotplug: Undo tglxs brainfart Thomas Gleixner <tglx@linutronix.de> - 2016-12-26 23:10 +0100

csiph-web