summaryrefslogtreecommitdiffstats
path: root/sys/cam/cam_queue.c
Commit message (Collapse)AuthorAgeFilesLines
* Update CAM CCB accounting for the new status quo.mav2014-09-141-2/+0
| | | | | | | | | | | | devq_openings counter lost its meaning after allocation queues has gone. held counter is still meaningful, but problematic to update due to separate locking of CCB allocation and queuing. To fix that replace devq_openings counter with allocated counter. held is now calculated on request as difference between number of allocated, queued and active CCBs. MFC after: 1 month
* Merge CAM locking changes from the projects/camlock branch to radicallymav2013-10-211-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | reduce lock congestion and improve SMP scalability of the SCSI/ATA stack, preparing the ground for the coming next GEOM direct dispatch support. Replace big per-SIM locks with bunch of smaller ones: - per-LUN locks to protect device and peripheral drivers state; - per-target locks to protect list of LUNs on target; - per-bus locks to protect reference counting; - per-send queue locks to protect queue of CCBs to be sent; - per-done queue locks to protect queue of completed CCBs; - remaining per-SIM locks now protect only HBA driver internals. While holding LUN lock it is allowed (while not recommended for performance reasons) to take SIM lock. The opposite acquisition order is forbidden. All the other locks are leaf locks, that can be taken anywhere, but should not be cascaded. Many functions, such as: xpt_action(), xpt_done(), xpt_async(), xpt_create_path(), etc. are no longer require (but allow) SIM lock to be held. To keep compatibility and solve cases where SIM lock can't be dropped, all xpt_async() calls in addition to xpt_done() calls are queued to completion threads for async processing in clean environment without SIM lock held. Instead of single CAM SWI thread, used for commands completion processing before, use multiple (depending on number of CPUs) threads. Load balanced between them using "hash" of the device B:T:L address. HBA drivers that can drop SIM lock during completion processing and have sufficient number of completion threads to efficiently scale to multiple CPUs can use new function xpt_done_direct() to avoid extra context switch. Make ahci(4) driver to use this mechanism depending on hardware setup. Sponsored by: iXsystems, Inc. MFC after: 2 months
* MFprojects/camlock r249505:mav2013-08-051-23/+8
| | | | | | | | | | | | | | | Change CCB queue resize logic to be able safely handle overallocations: - (re)allocate queue space in power of 2 chunks with 64 elements minimum and never shrink it; with only 4/8 bytes per element size is insignificant. - automatically reallocate the queue to double size if it is overflowed. - if queue reallocation failed, store extra CCBs in unsorted TAILQ, fetching them back as soon as some queue element is freed. To free space in CCB for TAILQ linking, change highpowerq from keeping high-power CCBs to keeping devices frozen due to high-power CCBs. This encloses all pieces of queue resize logic inside of cam_queue.[ch], removing some not obvious duties from xpt_release_ccb().
* MFprojects/camlock r248890, r248897, r248898, r248900, r248903, r248905,mav2013-04-141-17/+4
| | | | | | | | | | | | | | | | | | r248917, r248918, r248978, r249001, r249014, r249030: Remove multilevel freezing mechanism, implemented to handle specifics of the ATA/SATA error recovery, when post-reset recovery commands should be allocated when queues are already full of payload requests. Instead of removing frozen CCBs with specified range of priorities from the queue to provide free openings, use simple hack, allowing explicit CCBs over- allocation for requests with priority higher (numerically lower) then CAM_PRIORITY_OOB threshold. Simplify CCB allocation logic by removing SIM-level allocation queue. After that SIM-level queue manages only CCBs execution, while allocation logic is localized within each single device. Suggested by: gibbs
* Increase device CCB queue array size by CAM_RL_VALUES - 1 (4) elements.mav2012-10-111-2/+3
| | | | | | | | | | It is required to store extra recovery requests in case of bus resets. On ATA/SATA this fixes assertion panics on HEAD with INVARIANTS enabled or possible memory corruptions otherwise if timeout/reset happens when device CCB queue is already full. Reported by: gibbs@ MFC after: 1 week
* Change queue overflow checks from DIAGNOSTIC+panic() to KASSERT() to makemav2012-09-281-9/+7
| | | | | them enabled on HEAD by default. It is probably better to do single compare then hunt for unexpected memory corruption.
* Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.ed2011-11-071-3/+3
| | | | This means that their use is restricted to a single C file.
* MFp4:mav2009-11-141-1/+0
| | | | Some more missed parts from previous commits.
* After thinking again, implement cam_ccbq_fini().mav2009-10-221-1/+8
| | | | This is effectively NULL change, but makes this API a bit more consistent.
* - Providing fine-grained malloc statistic by replacing M_DEVBUF withavatar2005-07-011-13/+18
| | | | | | | | | | | | | module-specific malloc types. These should help us to pinpoint the possible memory leakage in the future. - Implementing xpt_alloc_ccb_nowait() and replacing all malloc/free based CCB memory management with xpt_alloc_ccb[_nowait]/xpt_free_ccb. Hopefully this would be helpful if someday we move the CCB allocator to use UMA instead of malloc(). Encouraged by: jeffr, rwatson Reviewed by: gibbs, scottl Approved by: re (scottl)
* Start each of the license/copyright comments with /*-imp2005-01-051-1/+1
|
* Use __FBSDID().obrien2003-06-101-2/+4
|
* Fix typos, mostly s/ an / a / where appropriate and a few s/an/and/schweikh2002-12-301-1/+1
| | | | Add FreeBSD Id tag where missing.
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Fix a long standing bug in the camq teardown code.gibbs1999-08-161-3/+3
|
* cam_periph.c:gibbs1999-04-191-21/+36
| | | | | | | | | | | | | | | | | Move handling of CAM_AUTOSENSE_FAIL into block dealing with all other scsi status errors. cam_queue.c: cam_queue.h: Fix 'off by one' heap bug in a more efficient manner. Since heap algorithms like to deal with indexes started from 1, offset our heap array pointer at allocation time to make this so for a C environment. This makes the implementation of the algorithm a bit more efficient. cam_xpt.c: Use macros for accessing the head of the heap so that code is isolated from implementation details of the heap.
* Remove camq_regen(). We already perform modular comparisonsgibbs1999-04-071-44/+6
| | | | | | | for generation counts, so no further steps to deal with generation count wrap are required. Fix an off by one problem in the camq heap code.
* CAM Transport Layer (XPT).gibbs1998-09-151-0/+441
Submitted by: The CAM Team
OpenPOWER on IntegriCloud