Spinlocks, intr levels et al

From: Kanoj Sarcar (kanoj@google.engr.sgi.com)
Date: Wed Jan 05 2000 - 15:05:53 EST


I have read Documentation/spinlocks.txt.

My problem is this: I have a lock L that is acquired from intr level,
as well as from process context. Hence, L is grabbed/released with
spin_lock_irqsave/spin_unlock_irqrestore. While L is held from process
context, it is possible that the code needs to do an intercpu action
(eg flush_tlb_all). But this creates a deadlock - say process P1 on
cpu1 has the lock, and is trying to make all other cpus do some work.
Say P2 on cpu2 is also trying to get the lock, and has already done
the local_irq_save() part of spin_lock_irqsave(). It will not
respond to the intercpu intr from cpu1, neither can cpu1 continue
without having done the intercpu function successfully, thus not
being able to release the lock.

Has anyone else run into something similar, and has any elegant
solutions to offer? The only solution I can think of is to have a
new routine spin_lock_irqsave_intercpu() that raises intr level,
tries to get the lock, on failure drops the intr level, and retries.

Kanoj

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Jan 07 2000 - 21:00:04 EST