local_irq_save not masking interrupts
Esben Nielsen
nielsen.esben at gogglemail.com
Thu Sep 28 02:52:13 EST 2006
On Tue, 26 Sep 2006, Alex Zeffertt wrote:
> Hi list,
>
> I'm having a strange problem with interrupts. My platform is the
> MPC832xEMDS and the BSP I'm using (from Freescale) uses Linux-2.6.11.
>
> In the code below I enter a critical section with local_irq_save(),
> call request_irq() (from mpc832xemds_phy_interrupt_enable) 4 times,
> then exit the critical section using local_irq_restore.
>
> /* Enable interrupts from PHYs */
> local_irq_save(flags);
> for (i = 0; i < driver_data->num_phys; i++) {
> struct atm_dev *dev = driver_data->dev_data[i]->dev;
> printk("%s/%d\n",__FUNCTION__,__LINE__);
> RETURN_ON_ERROR(mpc832xemds_phy_interrupt_enable(dev));
> }
> local_irq_restore(flags);
>
This is a pure side-comment:
Please, don't use local_irq_save() for a critical region. Use
spin_lock_irqsave(), for 3 reasons:
1) SMP.
2) Preempt-realtime is like SMP not happy about using local_irq_save().
3) Read-ability: It is more clear what data is protected when there is a
named lock object in the code.
You might not care about 1) and 2) but 3) should matter for you. And
remember: When CONFIG_SMP is not set spin_lock_irqsave() will just
become a local_irq_save().
Esben
More information about the Linuxppc-embedded
mailing list