Johannes Stezenbach wrote: > On Fri, Feb 21, 2003 at 01:50:18AM +0100, Oliver Endriss wrote: > > Locks should never be held longer than necessary. Taking a lock in > > the interrupt handler and releasing it in the tasklet might lead to > > deadlocks.
> s/might/will/ Hm, not necessarily, I wished it would. ;-) On a vanilla *UP* machine, spin_lock() and spin_unlock() do nothing at all. spin_lock_irq() resolves to a simple cli(). Let's assume that we have a buggy implementation which calls spin_lock_irq() in the ISR and spin_unlock_irq() in the tasklet. In the interrupt handler cli() has no effect because interrupts are disabled anyway. As soon as interrupts are automatically enabled at the end of the isr, the lock will be broken... In the tasklet, spin_unlock_irq() enables interrupts. (I believe that they are enabled anyway, when the tasklet starts, so nothing happens.) In this example the whole spinlock stuff does nothing at all. This will work until the critical area is accessed after the end of the interrupt handler and before the tasklet has finished processing the critical area. There is a good chance that these errors will remain undetected for some time on UP machines. That's why it is a good idea to enable spin lock debugging and compile the kernel for SMP... > ... > The whole point using of tasklets is to keep irq handlers short > so other irqs wont be blocked for too long. But if it's not possible > do defer work from the irq handler, then using tasklets is the > wrong approach. Sure. The most time-consuming part of the av7110 driver is busy-waiting in wait_for_debi_done(). Apparently, this happens very often, if you are using the card in transfer mode. IIRC this can consume about 25% of the processor cycles, no matter whether you have a slow or a fast cpu. (BTW this is an indication that the CPU is really waiting for the DVB card.) Using tasklets improves situation somewhat because some interrupts can be processed during busy-waiting, but does not really solve the busy-waiting problem. Oliver -- Info: To unsubscribe send a mail to [EMAIL PROTECTED] with "unsubscribe linux-dvb" as subject.
