Shared Interrupt Lines [was IRQ_NONE or IRQ_HANDLED]

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

 



On Sep 11, 2010, at 11:58 PM, Josh Cartwright wrote:
> Yes, if you have registered a handler on a shared IRQ, the first thing
> your handler must do is determine if it was your device which generated
> the interrupt.  If it wasn't your device, you return IRQ_NONE.
> 
> If you claim that you handled the interrupt by returning IRQ_HANDLED,
> but you really didn't do anything, there are situations where you will
> cause an interrupt storm and lock the system up tight (or at least one
> processor). Consider the following scenario:
> 
>   1. You've attached an interrupt to device A via request_irq().
>   2. Device A asserts the IRQ
>   3. You're handler is called
>   4. You don't quiesce the device, but you return IRQ_HANDLED
>   5. The core code sees that that you returned IRQ_HANDLED, so assumes the
>    . device has unasserted the IRQ and unmasks the IRQ
>   6. But the device is still asserting the IRQ!
>   7. The IRQ core code jumps back to 3
>   8. ...lockup!
> 
> Now, if you've attached yourself to a shared IRQ chain that contains a
> legitimate handler for device A, you _might_ be okay returning
> IRQ_HANDLED (because the core code will still continue down the chain
> and call the real handler, which _will_ quiesce the device).  But don't do
> this.  Especially if you register your registering your handler w/
> IRQF_SAMPLE_RANDOM, as you'll likely compromise the entropy of the
> system.


Let's assume that I have registered two handlers on a shared IRQ.

request_irq(irqn, handler1, IRQF_SHARED, "first", dev1);
request_irq(irqn, handler2, IRQF_SHARED, "second", dev2);

using two different dev1 and dev2 device structures.

When the interrupt is raised what is passed to handler1() and handler2() as second
argument? dev1 is passed to handler1() and dev2 to handler2() or both receive the
same value as pointer?
If each one receives the pointer to device structure indicated in request_irq() 
how this can help to differentiate between multiple device?

Thank you,

--
Carlo Caione






--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at 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