Blob Blame History Raw
From: Tiejun Chen <tiejun.chen@windriver.com>
Date: Thu, 7 Nov 2013 10:06:07 +0800
Subject: cpu_down: move migrate_enable() back
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git
Git-commit: ec6a532eee6ebf503b0e0b54fbcab45c865e47c3
Patch-mainline: Queued in subsystem maintainer repository
References: SLE Realtime Extension

Commit 08c1ab68, "hotplug-use-migrate-disable.patch", intends to
use migrate_enable()/migrate_disable() to replace that combination
of preempt_enable() and preempt_disable(), but actually in
!CONFIG_PREEMPT_RT_FULL case, migrate_enable()/migrate_disable()
are still equal to preempt_enable()/preempt_disable(). So that
followed cpu_hotplug_begin()/cpu_unplug_begin(cpu) would go schedule()
to trigger schedule_debug() like this:

_cpu_down()
	|
	+ migrate_disable() = preempt_disable()
	|
	+ cpu_hotplug_begin() or cpu_unplug_begin()
		|
		+ schedule()
			|
			+ __schedule()
				|
				+ preempt_disable();
				|
				+ __schedule_bug() is true!

So we should move migrate_enable() as the original scheme.


Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
Signed-off-by: Mike Galbraith <mgalbraith@suse.de>
---
 kernel/cpu.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -1097,6 +1097,7 @@ static int __ref _cpu_down(unsigned int
 		goto restore_cpus;
 	}
 
+	migrate_enable();
 	cpu_hotplug_begin();
 	ret = cpu_unplug_begin(cpu);
 	if (ret) {
@@ -1143,7 +1144,6 @@ static int __ref _cpu_down(unsigned int
 	cpu_unplug_done(cpu);
 out_cancel:
 	cpu_hotplug_done();
-	migrate_enable();
 restore_cpus:
 	set_cpus_allowed_ptr(current, cpumask_org);
 	free_cpumask_var(cpumask_org);