I am a little bit confused when I read check_futex_deadlock():
It takes a parameter struct thread_info *ti and immediately do
struct task_struct *task = ti->task. Now we have the usual pair
(thread_info *ti, task_t *task) corresponding to the same process. Later
on in the function you do ti = lock_owner(lock), but do not update task.
Was this intented?
Anyway, I can't see that you have locked the necesary raw_spin_locks.
Forinstance lock_owner(lock) must be called with the lock->wait_lock taken
and task->blocked_on needs task->pi_lock locked.
To avoid deadlocks in all the deadlock detection you have to do the loop
something like
for(owner = current; owner; ) {
raw_spin_lock(&owner->pi_lock);
if(owner->task->blocked_on) {
lock = owner->task->blocked_on->lock;
raw_spin_lock(&lock->wait_lock);
owner2 = lock_owner(lock);
if(owner2) {
get_task_struct(owner2->task);
raw_spin_unlock(&lock->wait_lock)
raw_spin_unlock(&owner->pi_lock);
}
put_task_struct(owner->task);
owner = owner2;
if(owner2==current) DEADLOCK
}
Esben
David
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/