Subject: Re: Serial console hangs
To: Martin Husemann <>
From: David Stanhope <>
List: port-i386
Date: 05/30/1998 02:49:38
-----Original Message-----
From: Martin Husemann <>
To: port-i386@NetBSD.ORG <port-i386@NetBSD.ORG>
Date: Thursday, August 13, 1998 2:59 AM
Subject: Serial console hangs

>There is a race condition somewhere between kernel output and normal
>output when you use a serial console. This is a long standing bug, and
>I vaguely remember seeing an analysis of the race here quite some time ago.
>The symptoms are: as soon as the init process starts, the console hangs
>I can reproduce this about 4 out of 5 times I reboot a machine running
>-current, with ISDN4BSD added (which outputs a lot of information at
>device attach time) and using a serial console at 19200 bps.
>As soon as I comment out the printf's in I4B the boot always succeeds.
>I would spent some work on fixing this, but don't have any idea where
>to start looking. Any hints?


I have seen this many times, and my analisis goes as follows:

in the kernel putc routine in 'com.c', assuming a program is outputing data
started by 'init') and then the kernel wants to do a 'putc' what happens is:

putc waits for the uart to have room, then outputs the character, then
clears the interrupt
flag, the problem with this is that this will keep an interrupt from
signalling to the com
interrupt handler that it needs to load more characters. When this hang
occurs output
will still come from the kernal but all normal com output is stopped. What
worked for
me was to not clear the interrupt flag at the end of the putc routine. This
has the affect
of sometimes causing extra interrupts but since there isn't a lot of kernal
putc activity,
this should be ok. It has been a while since I worked with serial consoles
but the code
in com.c still looks somewhat similar.
            Dave Stanhope