Subject: Re: Serial console hangs
To: Andreas Gustafsson <gson@araneus.fi>
From: Bill Studenmund <skippy@macro.stanford.edu>
List: port-i386
Date: 09/01/1998 11:45:45
On Tue, 1 Sep 1998, Andreas Gustafsson wrote:

> After writing the character to the UART, the putc routine spins in a
> loop waiting for the transmission to finish.  Only then does it clear
> the interrupt.  This guarantees there will be no interrupt after putc
> has finished.

That changes things.

> In other words, the solution is simply to remove the 'bus_space_read'
> at the end of 'com_common_putc' which clears the interrupts (as
> suggested in PR #4263).
> 
> I have two machines that suffered from the serial console hang bug,
> both with the console running at 4800 bps.  They both hung _every_
> time I booted, but always resumed booting when I pressed a key on the
> console keyboard (because the incoming character generates an
> interrupt).  Applying the patch below fixed the problem with no
> apparent ill side effects.

I don't think this is the solution. I think the reason putc is clearing
the interupt is to make its activities have zero impact on the tty system,
which it does when the tty is silent. Your whole (valid) point is that
this scheme has a big impact when the tty is active.

I think a better solution is to make the interupt clearing happen only if
the tty is not transmitting. If it's transmitting, leave the interupt. If
the tty's silent, clear it.

Take care,

Bill