Hi,

Le Fri, 21 Sep 2007 17:27:17 +0530,
"Rajendra Stalekar" <[EMAIL PROTECTED]> a écrit :

> [rajendra stalekar] AFAIK, spinlocks anyway disable interrupts,
> however, once it gets unlocked it enables it. The reason why we call
> spin_lock_irqsave could be that , if the interrupt did comes by, it
> would be kept pending and then once it i.e. spin_lock_irqrestore , it
> will invoke the interrupt handler. 

It depends which kind of locking you need. spin_lock() and
spin_unlock() allows to take/release a spinlock, but they do not
disable interrupts. On UP, they only disable preemption (if preemption
is enabled). This is because spin_lock() and spin_unlock() only allows
to protect against mutual access from two process contexts.

On the opposite, spin_lock_irqsave() and spin_unlock_irqrestore()
disable/enable the interrupts, because they are designed to provide
mutual exclusion between process context and interrupt context.

Have a look at
http://free-electrons.com/kerneldoc/latest/DocBook/kernel-locking/index.html.

Sincerly,

Thomas
-- 
Thomas Petazzoni - [EMAIL PROTECTED]
http://{thomas,sos,kos}.enix.org - http://www.toulibre.org
http://www.{livret,agenda}dulibre.org

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [EMAIL PROTECTED]
Please read the FAQ at http://kernelnewbies.org/FAQ

Reply via email to