Date: Wed, 28 Jan 2009 14:12:04 +0100 From: Philip S <philip-freebsd1@soeberg.net> To: freebsd-drivers@freebsd.org Subject: taskqueue(9); taskqueue_thread usage from within interrupt context on BSD6.x Message-ID: <498059A4.7030909@soeberg.net>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?498059A4.7030909>