Commit 31ad9081 authored by Rusty Russell's avatar Rusty Russell Committed by Ingo Molnar

work_on_cpu: don't try to get_online_cpus() in work_on_cpu.

Impact: remove potential circular lock dependency with cpu hotplug lock

This has caused more problems than it solved, with a pile of cpu
hotplug locking issues.

Followup patches will get_online_cpus() in callers that need it, but
if they don't do it they're no worse than before when they were using
set_cpus_allowed without locking.
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
Signed-off-by: default avatarMike Travis <travis@sgi.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent c7f8562a
...@@ -991,8 +991,8 @@ static void do_work_for_cpu(struct work_struct *w) ...@@ -991,8 +991,8 @@ static void do_work_for_cpu(struct work_struct *w)
* @fn: the function to run * @fn: the function to run
* @arg: the function arg * @arg: the function arg
* *
* This will return -EINVAL in the cpu is not online, or the return value * This will return the value @fn returns.
* of @fn otherwise. * It is up to the caller to ensure that the cpu doesn't go offline.
*/ */
long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg) long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg)
{ {
...@@ -1001,14 +1001,8 @@ long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg) ...@@ -1001,14 +1001,8 @@ long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg)
INIT_WORK(&wfc.work, do_work_for_cpu); INIT_WORK(&wfc.work, do_work_for_cpu);
wfc.fn = fn; wfc.fn = fn;
wfc.arg = arg; wfc.arg = arg;
get_online_cpus();
if (unlikely(!cpu_online(cpu)))
wfc.ret = -EINVAL;
else {
schedule_work_on(cpu, &wfc.work); schedule_work_on(cpu, &wfc.work);
flush_work(&wfc.work); flush_work(&wfc.work);
}
put_online_cpus();
return wfc.ret; return wfc.ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment