2009-01-11 10:02:58 spin_lock_irqsave in interrupt handler
Servaes Joordens (NETHERLANDS)
Message: 67765
Is it correct to have an spin_lock_irqsave in a interrup handler?
It is used in the ppi driver.
In my opinion this can lead to an problem:
Suppose an ioctl call is made and during this call the ppi dma interrupt occurs: then the interrupt blocks because the spin_lock is already locked by the ioctl call.
regards,
Servaes
QuoteReplyEditDelete
2009-01-11 10:09:04 Re: spin_lock_irqsave in interrupt handler
Mike Frysinger (UNITED STATES)
Message: 67766
it is invalid to sleep while holding a spinlock, so the issue you describe can never occur in a correctly written driver. i dont see any code in the ppi ioctl() function that will sleep (ignoring pr_debug() statements).
QuoteReplyEditDelete
2009-01-11 11:39:58 Re: spin_lock_irqsave in interrupt handler
Servaes Joordens (NETHERLANDS)
Message: 67767
Is the spinlock behaving as a mutex? In that case it will wait until the spin_lock is released in the ioctl function.
QuoteReplyEditDelete
2009-01-11 12:00:37 Re: spin_lock_irqsave in interrupt handler
Mike Frysinger (UNITED STATES)
Message: 67768
a spinlock is a spinlock, a mutex is a mutex. there is no sleeping by definition.
http://en.wikipedia.org/wiki/Spinlock
http://en.wikipedia.org/wiki/Mutual_exclusion
further more, the usage of the 'irqsave' variant means irqs are disabled, so there is no way for things to lead to a dead lock
http://docs.blackfin.uclinux.org/doku.php?id=auto_generated_kernel_docs:kernel-locking
http://docs.blackfin.uclinux.org/kernel/generated/kernel-locking/index.html
QuoteReplyEditDelete
2009-01-12 13:56:28 Re: spin_lock_irqsave in interrupt handler
Servaes Joordens (NETHERLANDS)
Message: 67819
thanks