Machine wedges solid after one serial-port source-line addition...

Barry Bouwsma freebsd-misuser at remove-NOSPAM-to-reply.NOSPAM.dyndns.dk
Wed Sep 17 22:06:41 PDT 2003


[Ooops, looks like I sent out two mails to this list with the wrong
 address, so most of your anti-spam filters probably bitbucketed them
 where they belong.  Fixed, I hope, with an IPv6-only address.  But
 just reply to the list and drop me, I'll catch up from the archives... ]


Terry Lambert wrote:
> > Would anyone care to explain why the following simple patch could be
> > enough to wedge my machine solid?  (My original hack-patches without

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

I had a feeling it might be something like that.

In truth, I had experienced a repeatable machine hang *without* the printf()
that either happened immediately or after some hours -- I can't remember
which now -- and tried to simplify my code down to something simpler using
printf()...


> 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

Well, I only wanted the printf() to verify that that part of the code
was being hit as expected, for debugging.  My original code was calling
wakeup().

You see, what I'm attempting to do, without knowing what I'm doing,
is to implement the TIOCMIWAIT ioctl that apparently exists in Linux,
to notify a userland program that there's been a status change on one
or more of the modem status lines, and eliminate the need to poll the
status line in question, cutting that program's cost to run by a factor
of about 20 in the testing I did before the machine would wedge.

I did all this offline, with no examples to follow, but now I have
something to look at and see if I have the general idea.  So I should
probably shut up and study it.

So, since a printf() is right out, is it safe for me (as a non-
programmer, so forgive my ignorance of the basics) to simply use
little more than a wakeup() in its place?  Or does that, or the
tsleep() corresponding, need some sort of careful handling to avoid
the lockups I've experienced?


Thanks,
Barry Bouwsma



More information about the freebsd-hackers mailing list