From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: avorontsov@ru.mvista.com
Cc: Ingo Molnar <mingo@elte.hu>,
Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
Sergei Shtylyov <sshtylyov@ru.mvista.com>,
linux-kernel@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>,
Steven Rostedt <rostedt@goodmis.org>,
Daniel Walker <dwalker@mvista.com>
Subject: Re: [RT] MPIC edge sensitive issues with hardirq preemption (was: Re: [PATCH v2 -rt] ide: workaround buggy hardware issues with preemptable hardirqs)
Date: Tue, 01 Jul 2008 07:59:57 +1000 [thread overview]
Message-ID: <1214863197.20711.57.camel@pasglop> (raw)
In-Reply-To: <20080630190132.GA6492@polina.dev.rtsoft.ru>
>
> Thanks for the idea. With hardirq preempton, fasteoi path does not replay
> edge interrupts indeed (at least for MPIC).
>
> Here how I tested this: I have external interrupt connected to the button
> on this board, thus I registered irq handler which is doing exactly this
> (irq is edge sensitive):
>
> printk("handled\n"); mdelay(2000);
>
> Without hardirq preemption: pressing button twice prints two messages.
> With hardirq preemption: pressing button twice prints just one message.
>
> This happens because:
> - irq has come;
> - fasteoi handler mask()s it, and wakes up the thread;
Do we eoi first ? We should.
> - thread calls irq handler;
> - another IRQ is coming, but MPIC's IRQ is still masked and MPIC does not
> see it.
> - thread unmasks the IRQ, second IRQ got lost.
>
> But how this could be a bug in the PIC code? IMO this is a bug in the
> kernel/irq code, since it assumes that fasteoi PIC will retrigger masked
> edge sources... This isn't true for at least MPIC. To make this work for
> all fasteoi PICs, we should mask edge sensitive interrupts very very
> carefully.
Well, retriggering of edge irqs while masked is some new "assumption"
that I deduced from your explanations of how RT works and indeed is not
provided by most PICs which will disable edge detection on masked
interrupts...
I'll double check if the MPIC/OpenPIC spec says anything about this.
I think it's a bug in the RT code to assume that. It should not mask
edge interrupts basically. That does mean that it would have to
differenciate edge and level, and thus can't use the same fasteoi
handler for both I suppose...
> Also...
>
> I found that I completely messed with MPIC's sense types: my brain was
> jammed with the idea that MPIC irq type 0 is low level sensitive, but the
> true thing is that it is rising edge sensitive. (Ah, I know where I got
> confused, type 0 is active-low for ISA PICs).
>
> So in all my previous emails I was wrong when I was saying "mpic is
> programmed to low level sensitive". It was programmed for rising edge
> sensitive. An all my further reasonings were flawed because of this.
>
> Re-programming MPIC to high level sensitive also makes IDE work. But
> this doesn't mean that IRQ code is correct.
>
> So, in the end, this isn't IDE issue... Much thanks to everyone for
> ideas and help... instead of one bug, it seems I've found two. :-)
> None in the IDE code.
>
>
> Following patch fixes MPIC edge sensitive interrupts processing with
> hardirqs preemption.
>
> We're still using handle_fasteoi_irq, but passing control to
> thread_edge_irq if interrupt is edge sensitive. Otherwise usual fasteoi
> path handles the IRQ.
>
> Plys, we're masking edge interrupt _and_ marking it as pending and masked
> only if we're already handling one (exactly as we do with !preemptable
> hardirqs). And the trick is that thread_edge_irq() will unmask it before
> executing handle_IRQ_event.
>
>
> So here is the patch, how does it look?
>
> (quite weird that I have to pass irq trigger flags to desc->status,
> but really, there is no other way. it seems safe though, because
> all irqactions should conform only to one trigger type).
I'll let Thomas and Ingo provide feedback here...
Ben.
next prev parent reply other threads:[~2008-06-30 22:13 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-23 23:40 [PATCH -rt] ide: fix interrupts processing issue with preempt-able hardirqs Anton Vorontsov
2008-06-23 23:51 ` Ingo Molnar
2008-06-24 0:00 ` Anton Vorontsov
2008-06-25 12:34 ` Anton Vorontsov
2008-06-25 12:32 ` Alan Cox
2008-06-25 14:12 ` Anton Vorontsov
2008-06-25 13:15 ` Sergei Shtylyov
2008-06-25 14:22 ` Anton Vorontsov
2008-06-25 14:32 ` Alan Cox
2008-06-25 15:26 ` Anton Vorontsov
2008-06-25 14:59 ` Anton Vorontsov
2008-06-28 0:54 ` [PATCH v2 -rt] ide: workaround buggy hardware issues with preemptable hardirqs Anton Vorontsov
2008-06-28 1:09 ` Anton Vorontsov
2008-06-28 9:15 ` Alan Cox
2008-06-28 9:14 ` Alan Cox
2008-06-28 10:43 ` Sergei Shtylyov
2008-06-29 12:49 ` Alan Cox
2008-06-29 13:17 ` Sergei Shtylyov
2008-06-29 14:23 ` Anton Vorontsov
2008-06-28 10:30 ` Sergei Shtylyov
2008-06-28 11:31 ` Anton Vorontsov
2008-06-28 11:52 ` Sergei Shtylyov
2008-06-29 23:26 ` Benjamin Herrenschmidt
2008-06-30 19:01 ` [RT] MPIC edge sensitive issues with hardirq preemption (was: Re: [PATCH v2 -rt] ide: workaround buggy hardware issues with preemptable hardirqs) Anton Vorontsov
2008-06-30 21:59 ` Benjamin Herrenschmidt [this message]
2008-06-30 22:37 ` Anton Vorontsov
2008-07-01 10:41 ` [RT] MPIC edge sensitive issues with hardirq preemption Sergei Shtylyov
2008-07-01 11:34 ` Anton Vorontsov
2008-06-23 23:52 ` [PATCH -rt] ide: fix interrupts processing issue with preempt-able hardirqs Anton Vorontsov
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=1214863197.20711.57.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=avorontsov@ru.mvista.com \
--cc=bzolnier@gmail.com \
--cc=dwalker@mvista.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.org \
--cc=sshtylyov@ru.mvista.com \
--cc=tglx@linutronix.de \
/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