From: Esben Nielsen <nielsen.esben@gogglemail.com>
To: Alex Zeffertt <ajz@cambridgebroadband.com>
Cc: linuxppc-embedded@ozlabs.org
Subject: Re: local_irq_save not masking interrupts
Date: Wed, 27 Sep 2006 18:52:13 +0200 (CEST) [thread overview]
Message-ID: <Pine.LNX.4.64.0609271802460.9792@frodo.shire> (raw)
In-Reply-To: <4518FA21.8050801@cambridgebroadband.com>
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
prev parent reply other threads:[~2006-09-27 16:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-26 10:00 local_irq_save not masking interrupts Alex Zeffertt
2006-09-26 10:19 ` Liu Dave-r63238
2006-09-26 10:28 ` Alex Zeffertt
2006-09-26 16:02 ` Scott Wood
2006-09-26 16:17 ` Alex Zeffertt
2006-09-26 16:27 ` Scott Wood
2006-09-26 16:42 ` Alex Zeffertt
2006-09-26 16:52 ` Scott Wood
2006-09-27 16:52 ` Esben Nielsen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0609271802460.9792@frodo.shire \
--to=nielsen.esben@gogglemail.com \
--cc=ajz@cambridgebroadband.com \
--cc=linuxppc-embedded@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).