Re: [PATCH] serial: 8250 check iir rdi in interrupt

From: Alan Cox
Date: Tue Oct 30 2012 - 10:19:47 EST


On Fri, 26 Oct 2012 14:57:31 -0700
Min Zhang <mzhang@xxxxxxxxxx> wrote:

> On Fri, Oct 26, 2012 at 7:19 AM, Alan Cox <alan@xxxxxxxxxxxxxxxxxxx> wrote:
>
> > So we only need to check this in serial8250_handle_irq when IIR indicates
> > a data timeout interrupt ?
> >
> > Can we do
> >
> > if ((iir & 0x0F) == 0x0C) {
> > /* Expensive RDI check */
> > }
> >
> >
> >
> > Alan
>
> Checking data timeout interrupt is only for "too much work for irq"
> problem. There is another console freeze problem which is caused by
> reading receive FIFO when there is no RDI interrupt, such as during
> THRI transmit interrupt, so no timeout interrupt. This time one has to
> check two both IIR and LSR. After all these checking, it becomes the
> original patch anyway.
>
> I am posting another simpler revision to exclude timer handler from
> this workaround, and make this workaround default off and inline.

We have two problems one of which is understood. Your patch continues to
do an extra read in an absolutely critical hot path and one that on many
systems will cost upwards of 8uS.

Can we therefore work through this neatly one problem at a time ?

In addition it seems your patch causes data loss if your check triggers
and a character appears during the check, at which point I don't see what
stops your RX read from dropping a byte of real user data ?

Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/