nanosleep crashed my kernel
cswiger at mac.com
Thu May 29 22:04:25 PDT 2003
Anurag Chaudhary wrote:
> I used nanosleep() in my device driver, but it crashed the kernel saying
> pagefault in kernel mode.
> Can anybody please suggest some other method to be used in a kld to sleep
When you put the kernel to sleep, what were you expecting to wake it up? :-)
A literal answer would be an interrupt, but in many contexts, such as device
drivers, tend to block receipt of new interrupts while servicing the existing
one. Regardless, there is a critical design methodology involved: you shouldn't
ever block or busy-wait in the kernel, at least if you can possibly avoid it.
Look into continuations and performing a context swap to a runnable process
until the next interrupt happens and your device driver can make more progress.
More information about the freebsd-questions