freebsd-drivers

[Prev] Thread [Next]  |  [Prev] Date [Next]

taskqueue(9); taskqueue_thread usage from within interrupt context on BSD6.x Philip S Wed Jan 28 06:00:40 2009

Hi,

I need to defer part of my interrupt handler to a kernel thread and am currently doing this by using my own thread based on taskqueue(9) (via taskqueue_create_fast -> taskqueue_start_threads)

My original support target where FreeBSD 6.3 and newer but now I need to support the entire 6 branch and in 6.0 taskqueue_start_threads does not exist.

So, in taskqueue(9) for BSD6.0 the following is written:
>>>
The thread queue can be used, for instance, by interrupt level routines
that need to call kernel functions that do things that can only be done
from a thread context.  (e.g., call malloc with the M_WAITOK flag.)
<<<
This is excellent. To conserve resources I can use the predefined [taskqueue_thread] symbol and enqueue on that in my interrupt handler, instead of reverting to kthreads.

But how?

taskqueue_thread is at boot constructed as an MTX_DEF mutex and 6.0 taskqueue_enqueue does not detect the type of mutex for the passed taskqueue pointer, so I must use taskqueue_enqueue_fast, which obviously does not work on taskqueue_thread. (Can't go mtx_lock_spin() on MTX_DEFs, and can't go use mtx_lock() from within an interrupt context)

How am I supposed to implement that above snippet from within my interrupt context handler?

Thanx,
/Phil
_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-drivers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"