linux/kernel
Anton Blanchard e9028b0ff2 [PATCH] fix scheduler deadlock
We have noticed lockups during boot when stress testing kexec on ppc64.
Two cpus would deadlock in scheduler code trying to grab already taken
spinlocks.

The double_rq_lock code uses the address of the runqueue to order the
taking of multiple locks.  This address is a per cpu variable:

	if (rq1 < rq2) {
		spin_lock(&rq1->lock);
		spin_lock(&rq2->lock);
	} else {
		spin_lock(&rq2->lock);
		spin_lock(&rq1->lock);
	}

On the other hand, the code in wake_sleeping_dependent uses the cpu id
order to grab locks:

	for_each_cpu_mask(i, sibling_map)
		spin_lock(&cpu_rq(i)->lock);

This means we rely on the address of per cpu data increasing as cpu ids
increase.  While this will be true for the generic percpu implementation it
may not be true for arch specific implementations.

One way to solve this is to always take runqueues in cpu id order. To do
this we add a cpu variable to the runqueue and check it in the
double runqueue locking functions.

Signed-off-by: Anton Blanchard <anton@samba.org>
Acked-by: Ingo Molnar <mingo@elte.hu>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-23 07:38:02 -08:00
..
irq
power [PATCH] swsusp: fix breakage with swap on LVM 2006-02-17 13:59:27 -08:00
.gitignore
acct.c
audit.c
auditsc.c Merge ../powerpc-merge 2006-02-24 14:05:47 +11:00
capability.c
compat.c
configs.c
cpu.c
cpuset.c
dma.c
exec_domain.c
exit.c [PATCH] don't do exit_io_context() until we know we won't be doing any IO 2006-03-18 18:33:46 -05:00
extable.c
fork.c [PATCH] unshare: Error if passed unsupported flags 2006-03-22 07:53:55 -08:00
futex.c
hrtimer.c [PATCH] fix next_timer_interrupt() for hrtimer 2006-03-06 18:40:44 -08:00
intermodule.c
itimer.c
kallsyms.c
Kconfig.hz
Kconfig.preempt
kexec.c
kfifo.c
kmod.c
kprobes.c
ksysfs.c [PATCH] kobject: fix build error if CONFIG_SYSFS=n 2006-03-20 13:42:57 -08:00
kthread.c
Makefile
module.c [PATCH] fix module sysfs files reference counting 2006-03-20 13:42:58 -08:00
mutex-debug.c
mutex-debug.h
mutex.c
mutex.h
panic.c
params.c [PATCH] fix module sysfs files reference counting 2006-03-20 13:42:58 -08:00
pid.c
posix-cpu-timers.c
posix-timers.c [PATCH] posix-timers: fix requeue accounting when signal is ignored 2006-03-17 07:51:25 -08:00
printk.c
profile.c
ptrace.c
rcupdate.c [PATCH] add EXPORT_SYMBOL_GPL_FUTURE() to RCU subsystem 2006-03-20 13:42:58 -08:00
rcutorture.c
resource.c
sched.c [PATCH] fix scheduler deadlock 2006-03-23 07:38:02 -08:00
seccomp.c
signal.c
softirq.c [PATCH] on_each_cpu(): disable local interrupts 2006-03-22 07:53:59 -08:00
softlockup.c
spinlock.c
stop_machine.c
sys_ni.c [PATCH] Fix compile for CONFIG_SYSVIPC=n or CONFIG_SYSCTL=n 2006-02-20 20:00:11 -08:00
sys.c
sysctl.c [PATCH] fix file counting 2006-03-08 14:14:01 -08:00
time.c
timer.c [PATCH] time_interpolator: add __read_mostly 2006-03-17 07:51:25 -08:00
uid16.c
user.c
wait.c
workqueue.c [SCSI] add execute_in_process_context() API 2006-02-27 23:34:40 -06:00