how are callouts handled in cpu_idle() ?

Alexander Motin mav at
Sat Oct 1 09:49:15 UTC 2011

Adrian Chadd wrote:
> On 1 October 2011 17:25, Alexander Motin <mav at> wrote:
>> Use of critical section in cpu_idle() from the beginning was based on
>> number of assumptions about filter interrupt handler's limitations.
> [snip]
>> So, if you really need to use callout() in interrupt filter, we could
>> disable interrupts before calling cpu_idleclock(), as you have told. But
>> that is only a partial solution and you should be ready for the second
>> half of the problems. Depending on your needs I am not sure it will
>> satisfy you.
> I'm not using callouts from a swi in ath(4), at least not yet. I
> haven't yet gone over all the drivers in sys/dev/ to see if any of
> them are actually doing this.
> I was just making an observation.

All I've told above related only to filter interrupt handlers. Swi has
no any problems from this point. Swi is alike to regular threaded
interrupt handler, it has no this kind of limitations. If interrupt
fires after cpu_idleclock() and schedules swi, sched_runnable() will
return non-zero and sleep will be canceled. After that, when it is
finally called, swi have updated time and allowed to use callouts as it
wants to.

Alexander Motin

More information about the freebsd-hackers mailing list