Subject: Re: Interrupt, interrupt threads, continuations, and kernel lwps
To: Andrew Doran <ad@NetBSD.org>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: tech-kern
Date: 06/25/2007 20:03:52
On Mon, Jun 25, 2007 at 01:55:43PM +0100, Andrew Doran wrote:
> > 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?

Would it still be possible to call callout_stop() from interrupt context
if we don't care waiting for the call to complete ? For most cases in drivers
the callout is scheduled for several seconds (at minimum) in the future while
the interrupt will happen within milliseconds, so in the common case
the callout will be armed for a very short period. 

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--