<br><tt><font size=2>Hi,</font></tt>
<br>
<br><tt><font size=2>we are a bit worried about putting this into the mainstream
part of non real time linux.</font></tt>
<br><tt><font size=2>There interrupts work perfectly fine, and it was a
bit of a challenge to get there for all</font></tt>
<br><tt><font size=2>cases / configurations / machines.</font></tt>
<br>
<br><tt><font size=2>Could you try to enable these changes only for RT-Linux
via a real-time kconfig switch?</font></tt>
<br><tt><font size=2>This way we make sure we don't break the scheme for
eHEA / eHCA. </font></tt>
<br>
<br><tt><font size=2>Regards,<br>
Jan-Bernd</font></tt><font size=2 face="sans-serif"> & Christoph</font>
<br>
<br><tt><font size=2>Sebastien Dugue <sebastien.dugue@bull.net> wrote
on 15.09.2008 10:04:06:<br>
<br>
> <br>
> WARNING: HACK - HACK - HACK<br>
> <br>
> Under the RT kernel (with hardirq preemption) the eHEA driver
hangs right<br>
> after booting. Fiddling with the hardirqs and softirqs priorities
allows to<br>
> run a bit longer but as soon as the network gets under load, the hang<br>
> returns. After investigating, it appears that the driver is loosing
<br>
> interrupts.<br>
> <br>
> To make a long story short, looking at the code, it appears
that the XICS<br>
> maps all its interrupts to level sensitive interrupts (I don't know
<br>
> if it's the<br>
> reality or if it's due to an incomplete implementation - no datasheets<br>
> available to check) and use the fasteoi processing flow.<br>
> <br>
> When entering the low level handler, level sensitive interrupts
are masked,<br>
> then eio'd in interrupt context and then unmasked at the end of hardirq<br>
> processing.<br>
> That's fine as any interrupt comming in-between will still be processed
since<br>
> the kernel replays those pending interrupts.<br>
> <br>
> However, it appears that the eHEA interrupts are behaving as
edge sensitive<br>
> interrupts and are routed through the XICS which process those as
level<br>
> sensitive using the fasteoi handler __OR__ the XICS loses interruptswhen
they<br>
> are masked.<br>
> <br>
> Therefore the masking done in the handler causes any interrupt
<br>
> happening while<br>
> in the handler to be lost.<br>
> <br>
> So this patch maps the interrupts being requested through<br>
> ibmebus_request_irq() as edge sensitive interrupts (this concerns
<br>
> both the eHEA<br>
> and the eHCA - only users of ibmebus_request_irq()) and changes the
way edge<br>
> interrupts are processed by the fasteoi handler.<br>
> <br>
> It works for the eHEA, dunno for the eHCA.<br>
> <br>
> So, unless all the designers of the XICS & eHEA have been
shot to keep it<br>
> a secret, could someone knowledgeable shed some light on this issue.<br>
> <br>
> Thanks,<br>
> <br>
> Sebastien.<br>
> <br>
> Not-Signed-off-by: Sebastien Dugue <sebastien.dugue@bull.net><br>
> ---<br>
> arch/powerpc/kernel/ibmebus.c | 11 ++++++++++-<br>
> kernel/irq/chip.c
| 5 +++--<br>
> kernel/irq/manage.c |
9 ++++++---<br>
> 3 files changed, 19 insertions(+), 6 deletions(-)<br>
> <br>
> diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c<br>
> index 9971159..5200323 100644<br>
> --- a/arch/powerpc/kernel/ibmebus.c<br>
> +++ b/arch/powerpc/kernel/ibmebus.c<br>
> @@ -41,6 +41,7 @@<br>
> #include <linux/kobject.h><br>
> #include <linux/dma-mapping.h><br>
> #include <linux/interrupt.h><br>
> +#include <linux/irq.h><br>
> #include <linux/of.h><br>
> #include <linux/of_platform.h><br>
> #include <asm/ibmebus.h><br>
> @@ -213,11 +214,19 @@ int ibmebus_request_irq(u32 ist, irq_handler_t
handler,<br>
> void *dev_id)<br>
> {<br>
> unsigned int irq = irq_create_mapping(NULL, ist);<br>
> + struct irq_desc *desc;<br>
> + int ret;<br>
> <br>
> if (irq == NO_IRQ)<br>
> return -EINVAL;<br>
> <br>
> - return request_irq(irq, handler, irq_flags, devname, dev_id);<br>
> + ret = request_irq(irq, handler, irq_flags, devname, dev_id);<br>
> +<br>
> + desc = irq_desc + irq;<br>
> + desc->status &= ~(IRQ_TYPE_SENSE_MASK | IRQ_LEVEL);<br>
> + desc->status |= IRQ_TYPE_EDGE_RISING;<br>
> +<br>
> + return ret;<br>
> }<br>
> EXPORT_SYMBOL(ibmebus_request_irq);<br>
> <br>
> diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c<br>
> index b7b397a..6d366ca 100644<br>
> --- a/kernel/irq/chip.c<br>
> +++ b/kernel/irq/chip.c<br>
> @@ -430,7 +430,7 @@ handle_fasteoi_irq(unsigned int irq, struct <br>
> irq_desc *desc)<br>
> action = desc->action;<br>
> if (unlikely(!action || (desc->status & (IRQ_INPROGRESS
|<br>
>
IRQ_DISABLED)))) {<br>
> - desc->status |= IRQ_PENDING;<br>
> + desc->status |= IRQ_PENDING | IRQ_MASKED;<br>
> if (desc->chip->mask)<br>
> desc->chip->mask(irq);<br>
> goto out;<br>
> @@ -439,9 +439,10 @@ handle_fasteoi_irq(unsigned int irq, struct <br>
> irq_desc *desc)<br>
> desc->status |= IRQ_INPROGRESS;<br>
> /*<br>
> * In the threaded case we fall back to a mask+eoi
sequence:<br>
> + * excepted for edge interrupts which are not masked.<br>
> */<br>
> if (redirect_hardirq(desc)) {<br>
> - if (desc->chip->mask)<br>
> + if (desc->chip->mask && !(desc->status
& IRQ_TYPE_EDGE_BOTH))<br>
> desc->chip->mask(irq);<br>
> goto out;<br>
> }<br>
> diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c<br>
> index 3bffa20..3e39c71 100644<br>
> --- a/kernel/irq/manage.c<br>
> +++ b/kernel/irq/manage.c<br>
> @@ -788,9 +788,12 @@ static void do_hardirq(struct irq_desc *desc)<br>
> thread_simple_irq(desc);<br>
> else if (desc->handle_irq == handle_level_irq)<br>
> thread_level_irq(desc);<br>
> - else if (desc->handle_irq == handle_fasteoi_irq)<br>
> - thread_fasteoi_irq(desc);<br>
> - else if (desc->handle_irq == handle_edge_irq)<br>
> + else if (desc->handle_irq == handle_fasteoi_irq) {<br>
> + if (desc->status & IRQ_TYPE_EDGE_BOTH)<br>
> + thread_edge_irq(desc);<br>
> + else<br>
> + thread_fasteoi_irq(desc);<br>
> + } else if (desc->handle_irq == handle_edge_irq)<br>
> thread_edge_irq(desc);<br>
> else<br>
> thread_do_irq(desc);<br>
> -- <br>
> 1.6.0.1.308.gede4c<br>
> <br>
</font></tt>