Subject: calling tsleep() from [interrupt] routines? [Yes, evil!]
To: None <firstname.lastname@example.org>
From: Gordon W. Ross <email@example.com>
Date: 06/28/1995 19:11:52
> Path: Beverly.Rhein.DE!not-for-mail
> From: firstname.lastname@example.org
> Summary: I get kernel panic if tsleep()ing from a ite.c HW support routine
> I've nearly finished my A2410 kernel support for NetBSD-Amiga.
> Only serious problem I see, is that I busy-wait for a circular buffer to
> get emptied by the TMS34010 processor on the A2410. I tried to put a
> tsleep() in there, but always get a panic (a kernel access error) sooner
> or later.
> My code is a set of support functions for grf.c / ite.c. I've got the
> impression that this is already called at some kind of soft int/ timer
> level, at least the kernel traceback I managed to get out of the kernel
> debugger looked like my stuff was called below another tsleep().
> Is it allowed to call a tsleep() from inside a timer int? Should I tell
> the tty stuff somehow that it should please call me again later instead?
You should only call tsleep() when you have "user context".
> Any idea, anybody?
For an example of how to do slow graphics screen updates at
low priority, see one of the following:
src/sys/arch/sun3/dev/kd.c (note: kdstart, kd_later)
src/sys/arch/sparc/dev/cons.c (cnfbstart, cnfbdma)
Of course, I like the sun3 one a little better, partly because
it uses the src/dev/cons.c interface, and (let's be honest 8^)
partly because I've had my fingers in it.