From: "Russell King" <firstname.lastname@example.org>
> Daniel Kobras writes:
> > I'd like to know the terms under which saving and restoring processor
> > flags can be omitted? In other words, how can I determine if I have to
> > spin_lock_irqsave or if spin_lock_irq is sufficient? I had a look into
> > Documentation/spinlocks.txt, but unfortunately the _irq/_bh variants
> > aren't even mentioned.
> Basically, if you can guarantee that at the point when spin_lock_irq()
> is called, interrupts will always be enabled, then you can use
> spin_lock_irq() instead of spin_lock_irqsave().
And if you know that the interrupts are always disabled you can use
spin_lock(&lock) can also be used in your interrupt handler if your device
only uses one interrupt: the kernel guarantees that a interrupt handler is
never reentered, even if the interrupt handler runs with enabled interrupts.
The _bh variants disable bottom half delivery [softirqs, tasklets and the
old bottom halfs such as timers]. Within your bh handler you can use
spin_lock() instead of spin_lock_bh().
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to email@example.com Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Fri Jun 23 2000 - 21:00:14 EST