Re: [PATCH] Tulip interrupt uses non IRQ safe spinlock
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: 2005-05-03 09:07:57
On Tue, May 03, 2005 at 09:25:26AM +0100, Mark Broadbent wrote:
quoted
quoted
See Documentation/spin-locking.txt line 137, this states that spin_[un]lock() should not be used in IRQ handlers."If you have a case where you have to protect a data structure across several CPU's and you want to use spinlocks you can potentially use cheaper versions of the spinlocks. IFF you know that the spinlocks are never used in interrupt handlers, you can use the non-irq versions: spin_lock(&lock); ... spin_unlock(&lock); "
Yes this isn't very clear. What it's trying to say that if you're in a softirq/user context and the spin lock may be taken in an IRQ context elsewhere then you must use the IRQ-disabling version. However, if you're in the IRQ context yourself, and yours is the only IRQ context that takes that spin lock, then you may use the straight spin_lock version. Cheers, -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmV>HI~} [off-list ref] Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt