Re: spinlock_irq & spinlock_irq_save

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

 



* Daniele Bellucci (bellucda@tiscali.it) wrote:
> Hi list,
> i'm a bit confused about the usage of spinlock_irq & spinlock_irq_save...
> when do i need to save flags? ... and when i don't need to take care about  flags?
> 

spin_lock_irq/spin_unlock_irq will blindly disable irq then re-enable.
this is fine if you _know_ irq is enabled.

spin_lock_irqsave/spin_unlock_irqrestore allows you to save the current
irq state, disable, then restore to original state.  this is required
when you _don't know_ if the irq was originally enabled.

imagine:  irq off -> spin_lock_irq/spin_unlock_irq -> oops, irq is now on

thanks,
-chris
-- 
Linux Security Modules     http://lsm.immunix.org     http://lsm.bkbits.net
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux