Subject: Re: Interrupt, interrupt threads, continuations, and kernel lwps
To: Manuel Bouyer <bouyer@antioche.eu.org>
From: Andrew Doran <ad@NetBSD.org>
List: tech-kern
Date: 06/25/2007 13:55:43
On Thu, Jun 21, 2007 at 11:07:05AM +0200, Manuel Bouyer wrote:

> On Wed, Jun 20, 2007 at 10:54:14PM +0100, Andrew Doran wrote:
> > > Do you mean 'run the callout function' ?
> > > Isn't that done from the soft timer interrupt anyway?
> > 
> > The callout will run in thread context from the softclock interrupt, yup.
> > What I mean is that from a hardware ISR that does not have thread context
> > (like at IPL_NET) it wouldn't be possible to call callout_reset() or similar
> > functions. That would need to be deferred to a soft interrupt or a kernel
> > thread.
> 
> Do you have a way to do this easily ? A lot of drivers do schedule or
> stop callouts from their interrupt function.

Thinking about it further, maybe the only function that needs to do the
blocking synchronization (wait for the callout to complete) is callout_stop
itself. In that case, if a driver really needs to ensure that callouts occur
in a rigid order, then it would need to use a thread to call callout_stop
before the other operations, like callout_reset. Do you think that would
work?

Andrew