[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

spin_lock_irqsave() and spin_lock usage



Hi all,

I have a query related to the usage of spin_lock_irqsave() and
spin_lock() function calls.
lets say I am in some critical section and I have two different locks,
these locks are nested inside other, I can acquire these nested locks
in two ways, I am not sure which one is more justified. The two
possible way are as follows, please tell me the correct way?

spin_lock_irqsave(&x_lock, x_lock_flags) ;
.
 spin_lock_irqsave(&y_lock, y_lock_flags) ; <---- is this 'irqsave' justified?
.
.
.
spin_unlock_irqrestore(&y_lock, y_lock_flags) ;

spin_unlock_irqrestore(x_lock, x_lock_flags) ;

OR

spin_lock_irqsave(&x_lock, x_lock_flags) ;
.
 spin_lock(&y_lock) ;
.
.
.
spin_unlock(&y_lock) ;

spin_unlock_irqrestore(x_lock, x_lock_flags) ;

Which one is more correct or there are some other implications?

Devesh.

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ