K 10 svn:author V 3 ken K 8 svn:date V 27 2003-09-10T00:40:40.000000Z K 7 svn:log V 2266 MFC: Move dynamic sysctl(8) variable creation for the cd(4) and da(4) drivers out of cdregister() and daregister(), which are run from interrupt context. Files/revisions merged: scsi_da.c: 1.157, 1.158 scsi_cd.c: 1.81 subr_taskqueue.c: 1.17 taskqueue.h: 1.8 cd.4: 1.33 da.4: 1.42 cd.9: 1.18 not merged: taskqueue.9 rev 1.7, 1.8 (not in RELENG_4) This code is necessarily a little bit different than the version committed to -current, mainly in the area of mutexes. (Which become splfoo() in -stable.) The sysctl code does blocking mallocs (M_WAITOK), which causes problems if malloc(9) actually needs to sleep. (And causes a panic for people running with INVARIANTS turned on.) The eventual fix for this issue will involve moving the CAM probe process inside a kernel thread. For now, though, I have fixed the issue by moving dynamic sysctl variable creation for these two drivers to a task queue running in a kernel thread. The existing task queue in -stable (taskqueue_swi) runs in software interrupt handlers, which wouldn't fix the problem at hand. So I have created a new task queue, taskqueue_thread, that runs inside a kernel thread. scsi_cd.c: Remove sysctl variable creation code from cdregister(), and move it to a new function, cdsysctlinit(). Queue cdsysctlinit() to the taskqueue_thread taskqueue once we have fully registered the cd(4) driver instance. scsi_da.c: Remove sysctl variable creation code from daregister(), and move it to move it to a new function, dasysctlinit(). Queue dasysctlinit() to the taskqueue_thread taskqueue once we have fully registered the da(4) instance. taskqueue.h: Declare the new taskqueue_thread taskqueue, update some comments. subr_taskqueue.c: Create the new kernel thread taskqueue. cd.4: Update the cd(4) man page to talk about the minimum command size sysctl/loader tunable. Also note that the changer variables are available as loader tunables as well. da.4: Update the da(4) man page to cover the retry_count, default_timeout and minimum_cmd_size sysctl variables/loader tunables. Remove references to /dev/r???, they aren't used any longer. cd.9: Update the cd(9) man page to describe the CD_Q_10_BYTE_ONLY quirk. Approved by: re (scottl, murray) END