Subject: Question about callout_xxx processing in the kernel
To: None <>
From: Brian Buhrow <>
List: tech-kern
Date: 04/09/2003 15:35:38
	Hello.  I've been working on the twe(4) driver, and I find I have some
questions about the callout_xxx functions.
	I implemented a watchdog timer which gets setup with callout_reset(9)
whenever data is queued for the twe card.  If the card does the right thing
and interrupts when the command is complete, then I'd like to clear the
watchdog timer.  Otherwise, I'd like the timer to fire and my watchdog to
kick the twe card.
	I've implementd all of this and it works great.  However, one side
effect I've noticed is that it appears that softclock interrupts get
disabled under certain circumstances, causing schedcpu() to never be
called.  I have a feeling this has to do with the way I'm clearing the
callout function I've been working on.  The documentation doesn't say if
callout_stop(9) needs to be called at a particular interrupt level.
Currently, I call all my callout_xxx functions at what ever interrupt
happened to be in force at the time the function which uses them was called
out.  For example, the twe_enqueue() function raises its priority to
splbio() when it does part of its work.  However, I do not call the
callout_reset(9) routine until interrupts have been reset with splx(s).  This
seems in keeping with the way other drivers do it.  However, at interrupt
time, I call callout_stop() since I don't actually need the watchdog
running anymore if an interrupt occurs.  I believe this is where my trouble

	So, the question is, 
do I need to call callout_stop() at a particular interrupt level, or does
it really matter?  For that matter, can callout_reset(9) be called  at any
interrupt level as well, or do I need to arrange for a specific interupt
level in order to  call callout_reset(9)

Any tips would be greatly appreciated.