lkml.org 
[lkml]   [2012]   [Oct]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH] genirq: for edge interrupt IRQS_ONESHOT support with irq thread
Date


> -----Original Message-----
> From: Thomas Gleixner [mailto:tglx@linutronix.de]
> Sent: Friday, October 12, 2012 8:46 PM
> To: Liu, Chuansheng
> Cc: linux-kernel@vger.kernel.org
> Subject: RE: [PATCH] genirq: for edge interrupt IRQS_ONESHOT support with irq
> thread
>
> On Fri, 12 Oct 2012, Liu, Chuansheng wrote:
> > > -----Original Message-----
> > > From: Thomas Gleixner [mailto:tglx@linutronix.de]
> > > Sent: Friday, October 12, 2012 8:32 PM
> > > To: Liu, Chuansheng
> > > Cc: linux-kernel@vger.kernel.org
> > > Subject: Re: [PATCH] genirq: for edge interrupt IRQS_ONESHOT support
> with irq
> > > thread
> > >
> > > On Fri, 12 Oct 2012, Chuansheng Liu wrote:
> > > >
> > > > In our system, there is one edge interrupt, and we want it to be
> > > > irq thread with IRQS_ONESHOT, and found in handle_edge_irq(),
> > > > even with IRQS_ONESHOT, the irq is still unmasked without care of
> > > > flag IRQS_ONESHOT.
> > > >
> > > > It causes IRQS_ONESHOT can not work well for edge interrupt, but also
> > > > after the irq thread finished with flag IRQS_ONESHOT, the irq will be
> > > > possible to be unmasked again, it should be messing mask/unmask logic.
> > >
> > > This is just wrong. By masking edge interrupts you will run into
> > > situations where you will lose interrupts.
> > >
> > > Can you please explain, why you want to mask your edge interrupt?
>
> > When I request_irq with irq thread handler and flag IRQS_ONESHOT, if
> > do not mask the edge interrupt, the primary handler and irq thread
> > maybe run at the same time, and in my real case it causes spin
> > deadlock.
>
> Then your code is simply wrong and you need to fix it instead of hacking a
> workaround into the core code. Locking is not that hard.
I got means, so I want to use flag IRQS_ONESHOT to avoid the case that two
handlers running at the same time. Is it right direction?
But IRQS_ONESHOT does not work well for edge interrupt.
And pasting the IRQS_ONESHOT description:
* IRQS_ONESHOT - irq is not unmasked in primary handler

And I need irq handler is because some heavy work is needed, it can avoid local
irq disabling time thru irq handler.

>
> > You means it is not right with IRQS_ONESHOT for edge interrupt?
>
> It's wrong. Simnply because you can lose interrupts.
>
> interrupt raised
> handle_edge_irq()
> mask_ack_irq()
> handle_event()
> wake irq thread
> reti
>
> irq thread runs
> handle device interrupt()
> <--- device issues edge irq
> unmask_irq()
>
> This interrupt is not delivered. So your device stops working. Not
> what you want, right?
Device should not stop:) And even in current handle_edge_irq(), it is possible that losting
Interrupt if primary handler need some time and the irq is quick enough. I says the below
code, it just avoid one time lost.

desc->istate |= IRQS_PENDING;
mask_ack_irq(desc);


>
> Thanks,
>
> tglx


\
 
 \ /
  Last update: 2012-10-12 15:41    [W:1.476 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site