freebsd-src/sys/cam/scsi
Kenneth D. Merry cb32189e23 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_all.c Use __FBSDID(). 2003-06-10 18:14:05 +00:00
scsi_all.h Add support to CAM for devices with more than 2^32 blocks. (2TB if you're 2003-04-30 00:35:22 +00:00
scsi_cd.c Move dynamic sysctl(8) variable creation for the cd(4) and da(4) drivers 2003-09-03 04:46:28 +00:00
scsi_cd.h Fix ATAPI/USB/Firewire CDROM drive handling in cd(4) and hopefully fix 2003-02-21 06:19:38 +00:00
scsi_ch.c Use __FBSDID(). 2003-06-10 18:14:05 +00:00
scsi_ch.h Use symbolic constants instead of "4". 2003-05-31 16:54:37 +00:00
scsi_da.c Move dynamic sysctl(8) variable creation for the cd(4) and da(4) drivers 2003-09-03 04:46:28 +00:00
scsi_da.h Implement a new camcontrol function, 'camcontrol format'. 2000-05-21 23:57:52 +00:00
scsi_dvcfg.h Add PC-Card/ISA SCSI host adpater drivers from NetBSD/pc98 2000-10-23 12:55:51 +00:00
scsi_iu.h Add definitions for the task management codes sent in SPI4 2003-01-20 18:05:46 +00:00
scsi_low.c Merge common XPT_CALC_GEOMETRY functions into a single convenience function. 2003-06-14 22:17:41 +00:00
scsi_low.h use __packed. 2002-09-23 18:54:32 +00:00
scsi_low_pisa.c Use __FBSDID(). 2003-06-10 18:14:05 +00:00
scsi_low_pisa.h Remove __P. 2002-03-20 08:56:31 +00:00
scsi_message.h scsi_message.h: 2002-06-05 19:05:01 +00:00
scsi_pass.c Use __FBSDID(). 2003-06-10 18:14:05 +00:00
scsi_pass.h Rewrite of the CAM error recovery code. 2001-03-27 05:45:52 +00:00
scsi_pt.c Use __FBSDID(). 2003-06-10 18:14:05 +00:00
scsi_pt.h Spell declarations correctly. 2001-01-12 02:49:40 +00:00
scsi_sa.c Use __FBSDID(). 2003-06-10 18:14:05 +00:00
scsi_sa.h Spell declarations correctly. 2001-01-12 02:49:40 +00:00
scsi_ses.c Use __FBSDID(). 2003-06-10 18:14:05 +00:00
scsi_ses.h Move the kernel specific stuff into scsi_ses.c. Redo the ioctls 2000-01-15 22:40:04 +00:00
scsi_targ_bh.c Use __FBSDID(). 2003-06-10 18:14:05 +00:00
scsi_target.c Use __FBSDID(). 2003-06-10 18:14:05 +00:00
scsi_targetio.h New SCSI target emulator code 2002-11-22 22:55:51 +00:00