]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
cpu_down: move migrate_enable() back
authorTiejun Chen <tiejun.chen@windriver.com>
Thu, 7 Nov 2013 02:06:07 +0000 (10:06 +0800)
committerMichal Sojka <sojka@merica.cz>
Sun, 13 Sep 2015 07:47:39 +0000 (09:47 +0200)
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.

Cc: stable-rt@vger.kernel.org
Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
kernel/cpu.c

index c96cb6735d35e4d40e70ff778847f6a1f9d44a17..ddc57402539fc58246066bc2f49cc2ef23ea1afe 100644 (file)
@@ -665,6 +665,7 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
                err = -EBUSY;
                goto restore_cpus;
        }
+       migrate_enable();
 
        cpu_hotplug_begin();
        err = cpu_unplug_begin(cpu);
@@ -737,7 +738,6 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
 out_release:
        cpu_unplug_done(cpu);
 out_cancel:
-       migrate_enable();
        cpu_hotplug_done();
        if (!err)
                cpu_notify_nofail(CPU_POST_DEAD | mod, hcpu);