From: ccross@google.com (Colin Cross)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 6/6] ARM: gic: use handle_fasteoi_irq for SPIs
Date: Sat, 30 Apr 2011 09:42:47 -0700 [thread overview]
Message-ID: <BANLkTikw=V2CdbwWsDOVZuoQ+cBw2yZdMA@mail.gmail.com> (raw)
In-Reply-To: <alpine.LFD.2.02.1104301135190.3005@ionos>
On Sat, Apr 30, 2011 at 2:54 AM, Thomas Gleixner <tglx@linutronix.de> wrote:
> On Fri, 29 Apr 2011, Colin Cross wrote:
>> > Cc: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
>> > Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>
>> > Acked-by: Catalin Marinas <catalin.marinas@arm.com>
>> > Signed-off-by: Will Deacon <will.deacon@arm.com>
>>
>> After further testing, I'm having a problem with this patch, although
>> I think its more of a core issue than the fault of this patch. ?One of
>> my interrupts is getting stuck with the PENDING flag set, and
>> preventing suspend. ?The flow that triggers this is:
>>
>> level triggered irq
>> ?handle_fasteoi_irq
>> ? handle_irq_event
>> ? ?isr
>> ? ? disable_irq_nosync
>> ? ? schedule_work (because it takes a sleeping i2c transaction to
>> deassert the irq pin)
>
> If you'd use a threaded irq handler the IRQ_ONESHOT mechanism would
> handle that problem for you. It masks the irq line before calling the
> handler and unmask happens after the threaded handler has run.
>
> disable_irq_nosync from an interrupt handler plus scheduling work is
> the historic "threaded" interrupt handler mechanism. It's kinda murky
> nowadays due to the lazy irq disable mechanism.
Yes, and in the specific case that reproduces this problem for me a
threaded handler would be appropriate. However, there are cases where
disable irq can legitimately be called from an interrupt handler. One
example I was given is a debounce timer - the interrupt handler
disables the irq and then sets a timer.
>> ? ?irq_eoi
>> same irq
>> ?handle_fasteoi_irq
>> ? mark irq pending
>> ? mask_irq
>> work function
>> ?causes level triggered irq to go low
>> ?enable_irq
>> ? unmask_irq
>> ? check_irq_resend (returns immediately)
>>
>> At this point, the irq is unmasked, but not being asserted, and marked
>> as pending. ?check_irq_resend doesn't clear the pending flag for level
>> triggered interrupts, so the pending flag will stay set until the next
>> time the interrupt occurs.
>
> Yes, that should be cleared unconditionally in check_irq_resend.
>
>> Should handle_fasteoi_irq mask the interrupt before eoi if it was
>> disabled by the interrupt handler? ?Otherwise, every level triggered
>> interrupt that is not deasserted by the interrupt handler will
>> interrupt the cpu twice. ?There is still the case where a driver
>
> No, we should stop doing the disable_irq_nosync from handlers and use
> threaded interrupts instead.
As in the example above, I don't think threaded interrupts cover all
the cases where disable_irq_nosync is used in an interrupt handler,
although 99% of the time they do. handle_level_irq already has this
optimization - it doesn't unmask the irq line if the handler returns
with the irq disabled. I think the patch I posted would need to check
for a level triggered interrupt, masking the line on an edge triggered
interrupt could lose the next interrupt.
>> disables the irq, the interrupt goes high, then goes low again before
>> enable_irq is called.
>
> So what you're saying is:
>
> irq ____ ? ? ? ? ? ? ? ? ?_______
> ? ? ? ?|________________| ? ? ? |_____________________
>
> ? ? ? ? ? ?| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|
> ? ? ? ? ISR/mask/eoi ? ? ? ? ? ? ? ?enable_irq/unmask
>
> So after the unmask the asserted new interrupt is not delivered?
> That's not a software problem :)
Of course its not delivered, the problem is that it is marked pending,
check_wakeup_irqs returns true and prevents suspend. Always clearing
the pending flag in check_if_resend fixes suspend after calling
enable_irq, but suspend will still fail if attempted between when the
irq line goes low and enable_irq is called (which could be never if
the driver has been disabled for some reason).
next prev parent reply other threads:[~2011-04-30 16:42 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-12 18:35 [PATCH v2 0/6] Use chained handler entry/exit functions in platform code Will Deacon
2011-04-12 18:35 ` [PATCH 1/6] ARM: omap: update GPIO chained IRQ handler to use entry/exit functions Will Deacon
2011-04-12 18:35 ` [PATCH 2/6] ARM: tegra: " Will Deacon
2011-05-01 7:26 ` Colin Cross
2011-05-01 12:42 ` Will Deacon
2011-04-12 18:35 ` [PATCH 3/6] ARM: s5pv310: update IRQ combiner to use chained " Will Deacon
2011-04-12 18:35 ` [PATCH 4/6] ARM: msm: update GPIO chained IRQ handler to use " Will Deacon
2011-04-15 18:27 ` David Brown
2011-04-18 17:57 ` Will Deacon
2011-04-16 1:51 ` Abhijeet Dharmapurikar
2011-04-18 17:56 ` Will Deacon
2011-04-12 18:35 ` [PATCH 5/6] ARM: nmk: update GPIO chained IRQ handler to " Will Deacon
2011-04-18 18:26 ` Linus Walleij
2011-04-18 19:04 ` Will Deacon
2011-04-18 23:46 ` Linus Walleij
2011-04-19 19:52 ` Grant Likely
2011-04-12 18:35 ` [PATCH 6/6] ARM: gic: use handle_fasteoi_irq for SPIs Will Deacon
2011-04-16 1:52 ` Abhijeet Dharmapurikar
2011-04-19 11:20 ` Santosh Shilimkar
2011-04-19 15:16 ` Will Deacon
2011-04-20 4:20 ` Santosh Shilimkar
2011-04-30 2:38 ` Colin Cross
2011-04-30 9:54 ` Thomas Gleixner
2011-04-30 16:42 ` Colin Cross [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-04-01 14:50 [PATCH 0/6] Use chained handler entry/exit functions in platform code Will Deacon
2011-04-01 14:50 ` [PATCH 6/6] ARM: gic: use handle_fasteoi_irq for SPIs Will Deacon
2011-04-01 20:31 ` Colin Cross
2011-04-03 3:27 ` Colin Cross
2011-04-03 6:06 ` Santosh Shilimkar
2011-04-03 12:18 ` Will Deacon
2011-04-03 12:20 ` Santosh Shilimkar
2011-04-03 12:17 ` Will Deacon
2011-04-03 22:38 ` Colin Cross
2011-04-05 12:48 ` Will Deacon
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='BANLkTikw=V2CdbwWsDOVZuoQ+cBw2yZdMA@mail.gmail.com' \
--to=ccross@google.com \
--cc=linux-arm-kernel@lists.infradead.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).