Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Sep 2003 03:03:25 -0700
From:      Terry Lambert <tlambert2@mindspring.com>
To:        FreeBSD List of Hackers <hackers@freebsd.org>
Subject:   Re: Machine wedges solid after one serial-port source-line addition...
Message-ID:  <3F66DFED.C3FA43EE@mindspring.com>
References:  <200309152127.h8FLRrv71220@Mail.NOSPAM.DynDNS.dK>

next in thread | previous in thread | raw e-mail | index | archive | help
Barry Bouwsma wrote:
> Would anyone care to explain why the following simple patch could be
> enough to wedge my machine solid?  (My original hack-patches without
> any console printf() debuggery did the same thing within seconds, as
> well...)  All it does is notify the console whenever a serial port DCD
> PPS signal transition is detected, as follows (patch against 4.foo; I
> haven't tried this with 5.bar or later -- also, not a real patch as I've
> included context and snipped my comments) :
[ ... ]
> I'm wondering if it's something really blindingly obvious that I should
> be but am not aware of, or something I gotta work on to track down.

You are calling printf() from a fast interrupt handler.

You shouldn't call printf() from any interrupt handler, and
particularly you shouldn't call it from something that can
and will have a FIFO overrun well before the printf() gets
back.

If you need to communicate information to a console log (or
wherever), then you should enqueue the information on the
status change, and wake up some thread to do the actual
processing of the information out to the console.

-- Terry



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3F66DFED.C3FA43EE>