Re: dev/ic/com.c, callouts and cv_wait

Brad Spencer <[email protected]>
Newsgroups gmane.os.netbsd.devel.kernel
Message-ID <[email protected]>
matthew green <[email protected]> writes:

>> I have used cv_wait from kernel threads before, but I have never
>> attempted to do use them from a callout (I don't think).  Did I miss
>> something, or is this case not allowed??
>
> callouts run from softint threads, and softint threads are a
> limited resource -- only one per level per cpu, so if one of
> them blocks waiting for something, it means *all* processing
> at that level is blocked until the resource is back.  we tend
> to disallow this usage because it can lead to weird locking
> and hang/starvation issues.

Thank you sir.  That explains the situation.

> you may want to create a dedicated kernel thread to run the
> real processing in, using the callout to trigger that thread
> perhaps, or avoid it entirely and directly triggering the
> thread from whatever is triggering the softint now.

Ya, I have though of using a kthread as all the callout is doing is
creating a loop to check the interrupt status register at a paticular
tick interval.  It should be possible to use a kthread to do the same
thing and not bother with the callout at all.

> there's also workqueue(9) that might supply much of the setup
> you need.
>
>
> .mrg.





-- 
Brad Spencer - [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.