Skip to content

Commit

Permalink
cpu_down: move migrate_enable() back
Browse files Browse the repository at this point in the history
Commit 08c1ab6, "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>
  • Loading branch information
Tiejun Chen authored and jnettlet committed Sep 4, 2018
1 parent 6aa07da commit 964957c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1310,6 +1310,7 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen,
goto restore_cpus;
}

migrate_enable();
cpu_hotplug_begin();
ret = cpu_unplug_begin(cpu);
if (ret) {
Expand Down Expand Up @@ -1357,7 +1358,6 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen,
cpu_unplug_done(cpu);
out_cancel:
cpu_hotplug_done();
migrate_enable();
/* This post dead nonsense must die */
if (!ret && hasdied)
cpu_notify_nofail(CPU_POST_DEAD, cpu);
Expand Down

0 comments on commit 964957c

Please sign in to comment.