* Disabling an interrupt
@ 2011-03-01 8:55 Jacky Lam
2011-03-02 22:15 ` Sri Ram Vemulpali
2011-03-02 22:49 ` Dave Hylands
0 siblings, 2 replies; 5+ messages in thread
From: Jacky Lam @ 2011-03-01 8:55 UTC (permalink / raw)
To: kernelnewbies
Hi,
It's long before when I want to enable/disable an interrupt, I call
enable_irq()/disable_irq(). However, recently, I do that again.
disable_irq() do nothing. I looked into the code and find disable_irq()
is pointing to a empty function default_disable(). This change is
started from 2.6.20.
I want to know what should I do if I want to disable an interrupt now?
Thanks.
Jacky
^ permalink raw reply [flat|nested] 5+ messages in thread
* Disabling an interrupt
2011-03-01 8:55 Disabling an interrupt Jacky Lam
@ 2011-03-02 22:15 ` Sri Ram Vemulpali
2011-03-02 22:49 ` Dave Hylands
1 sibling, 0 replies; 5+ messages in thread
From: Sri Ram Vemulpali @ 2011-03-02 22:15 UTC (permalink / raw)
To: kernelnewbies
http://lxr.linux.no/linux+v2.6.37.2/kernel/irq/manage.c#L217
Check the above link.
--Sri
On Tue, Mar 1, 2011 at 3:55 AM, Jacky Lam <lamshuyin@gmail.com> wrote:
> Hi,
>
> ? ? It's long before when I want to enable/disable an interrupt, I call
> enable_irq()/disable_irq(). However, recently, I do that again.
> disable_irq() do nothing. I looked into the code and find disable_irq()
> is pointing to a empty function default_disable(). This change is
> started from 2.6.20.
>
> ? ? I want to know what should I do if I want to disable an interrupt now?
>
> ? ? Thanks.
>
> Jacky
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
--
Regards,
Sri.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Disabling an interrupt
2011-03-01 8:55 Disabling an interrupt Jacky Lam
2011-03-02 22:15 ` Sri Ram Vemulpali
@ 2011-03-02 22:49 ` Dave Hylands
2011-03-03 1:26 ` Jacky Lam
1 sibling, 1 reply; 5+ messages in thread
From: Dave Hylands @ 2011-03-02 22:49 UTC (permalink / raw)
To: kernelnewbies
Hi Jacky,
Sending to the list as well.
On Tue, Mar 1, 2011 at 1:55 AM, Jacky Lam <lamshuyin@gmail.com> wrote:
> Hi,
>
> It's long before when I want to enable/disable an interrupt, I call
> enable_irq()/disable_irq(). However, recently, I do that again.
> disable_irq() do nothing. I looked into the code and find disable_irq()
> is pointing to a empty function default_disable(). This change is
> started from 2.6.20.
>
> I want to know what should I do if I want to disable an interrupt now?
So disable/enable_irq are nestable, and you're expected to call them
in the order disable/enable.
You need to call enable_irq exactly the same number of times that you
call disable_irq.
If you start wth inerrtupts enabled and do
enable_irq
...do some stuff...
disable_irq
then disable_irq will do nothing since it just decremented the count
that enable_irq incremented.
Another way of looking at it is that disable_irq increments a count,
and enable_irq decrements a count.
The interrupt is only "really" disabled when the count transitions
from 0 to 1, and the interrupt is only "really" enabled when the count
transitions from 1 to 0.
Dave Hylands
^ permalink raw reply [flat|nested] 5+ messages in thread
* Disabling an interrupt
2011-03-02 22:49 ` Dave Hylands
@ 2011-03-03 1:26 ` Jacky Lam
2011-03-03 2:51 ` Dave Hylands
0 siblings, 1 reply; 5+ messages in thread
From: Jacky Lam @ 2011-03-03 1:26 UTC (permalink / raw)
To: kernelnewbies
Hi Dave,
I have confirmed the execution has go into
desc <http://lxr.linux.no/linux+*/+code=desc>->irq_data
<http://lxr.linux.no/linux+*/+code=irq_data>.chip
<http://lxr.linux.no/linux+*/+code=chip>->irq_disable
<http://lxr.linux.no/linux+*/+code=irq_disable>(&desc
<http://lxr.linux.no/linux+*/+code=desc>->irq_data
<http://lxr.linux.no/linux+*/+code=irq_data>);
However, irq_disable points to kernel/irq/chip.c:default_disable() which do nothings.
Unlike default_enable() which called by enable_irq() will unmask the IRQ accordingly.
I don't understand the reason behind.
BR,
Jacky
On 3/3/2011 6:49 AM, Dave Hylands wrote:
> Hi Jacky,
>
> Sending to the list as well.
>
> On Tue, Mar 1, 2011 at 1:55 AM, Jacky Lam<lamshuyin@gmail.com> wrote:
>> Hi,
>>
>> It's long before when I want to enable/disable an interrupt, I call
>> enable_irq()/disable_irq(). However, recently, I do that again.
>> disable_irq() do nothing. I looked into the code and find disable_irq()
>> is pointing to a empty function default_disable(). This change is
>> started from 2.6.20.
>>
>> I want to know what should I do if I want to disable an interrupt now?
> So disable/enable_irq are nestable, and you're expected to call them
> in the order disable/enable.
>
> You need to call enable_irq exactly the same number of times that you
> call disable_irq.
>
> If you start wth inerrtupts enabled and do
> enable_irq
> ...do some stuff...
> disable_irq
>
> then disable_irq will do nothing since it just decremented the count
> that enable_irq incremented.
>
> Another way of looking at it is that disable_irq increments a count,
> and enable_irq decrements a count.
> The interrupt is only "really" disabled when the count transitions
> from 0 to 1, and the interrupt is only "really" enabled when the count
> transitions from 1 to 0.
>
> Dave Hylands
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110303/d0660954/attachment.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Disabling an interrupt
2011-03-03 1:26 ` Jacky Lam
@ 2011-03-03 2:51 ` Dave Hylands
0 siblings, 0 replies; 5+ messages in thread
From: Dave Hylands @ 2011-03-03 2:51 UTC (permalink / raw)
To: kernelnewbies
Hi Jacky,
On Wed, Mar 2, 2011 at 6:26 PM, Jacky Lam <lamshuyin@gmail.com> wrote:
> Hi Dave,
>
> ??? I have confirmed the execution has go into
> ??? ??? desc->irq_data.chip->irq_disable(&desc->irq_data);
>
> However, irq_disable points to kernel/irq/chip.c:default_disable() which
> do nothings.
> Unlike default_enable() which called by enable_irq() will unmask the IRQ
> accordingly.
>
> I don't understand the reason behind.
Which irq chip is being used?
It's really up to the individual irq chip driver to implement things
in an appropriate manner.
Since the IRQ_DISABLED flag is set, if the interrupt happens to fire
again, your handler shouldn't be called. The generic handler masks
interrupts when they occur, and if the IRQ_DISABLED flag is set then
it will leave the interrupt masked (i.e. disabled). Look at the the
__do_IRQ function in handle.c
<http://lxr.linux.no/linux+v2.6.36.4/kernel/irq/handle.c#L446>
So even though it looks like its not doing things, the interrupt is
still effectively disabled.
--
Dave Hylands
Shuswap, BC, Canada
http://www.davehylands.com
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-03-03 2:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-01 8:55 Disabling an interrupt Jacky Lam
2011-03-02 22:15 ` Sri Ram Vemulpali
2011-03-02 22:49 ` Dave Hylands
2011-03-03 1:26 ` Jacky Lam
2011-03-03 2:51 ` Dave Hylands
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).