freebsd-skq/sys/cam
ken 03d0445c16 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.

The sysctl code does blocking mallocs (M_WAITOK), which causes problems
if malloc(9) actually needs to sleep.

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 queues (taskqueue_swi and taskqueue_swi_giant) run 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.  (It also runs outside of Giant -- clients must explicitly acquire
and release Giant in their taskqueue functions.)

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.  This taskqueue
		runs outside of Giant, so any functions queued to it would
		need to explicitly acquire/release Giant if they need it.

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.

taskqueue.9:	Update the taskqueue(9) man page to describe the new thread
		task queue, and the taskqueue_swi_giant queue.

MFC after:	3 days
2003-09-03 04:46:28 +00:00
..
scsi Move dynamic sysctl(8) variable creation for the cd(4) and da(4) drivers 2003-09-03 04:46:28 +00:00
cam_ccb.h Add a PATH_INQ flag, PIM_NO_6_BYTE, which indicates the SIM never wishes to 2003-07-28 06:15:59 +00:00
cam_debug.h Rewrite of the CAM error recovery code. 2001-03-27 05:45:52 +00:00
cam_periph.c Use __FBSDID(). 2003-06-10 17:50:20 +00:00
cam_periph.h Centralize the devstat handling for all GEOM disk device drivers 2003-03-08 08:01:31 +00:00
cam_queue.c Use __FBSDID(). 2003-06-10 17:50:20 +00:00
cam_queue.h
cam_sim.c Use __FBSDID(). 2003-06-10 17:50:20 +00:00
cam_sim.h Const'ify cam_sim.sim_name to quiet warnings. 2001-01-24 01:46:18 +00:00
cam_xpt_periph.h
cam_xpt_sim.h
cam_xpt.c Use __FBSDID(). 2003-06-10 17:50:20 +00:00
cam_xpt.h Rewrite of the CAM error recovery code. 2001-03-27 05:45:52 +00:00
cam.c Merge common XPT_CALC_GEOMETRY functions into a single convenience function. 2003-06-14 22:17:38 +00:00
cam.h Define the kern.cam sysctl in the cam layer, rather than multiply in several 2002-01-09 03:39:04 +00:00