aboutsummaryrefslogtreecommitdiff
path: root/sys/cam/cam_queue.h
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2013-10-21 12:00:26 +0000
committerAlexander Motin <mav@FreeBSD.org>2013-10-21 12:00:26 +0000
commit227d67aa5469398eb77e5eca2e525e6aae7b3a61 (patch)
tree2241bb08977b8fb8347e216b1dd8011b6627f617 /sys/cam/cam_queue.h
parente45e2255e88f6ce44bae133e7e59910ac4e1177d (diff)
downloadsrc-227d67aa5469398eb77e5eca2e525e6aae7b3a61.tar.gz
src-227d67aa5469398eb77e5eca2e525e6aae7b3a61.zip
Merge CAM locking changes from the projects/camlock branch to radically
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
Notes
Notes: svn path=/head/; revision=256843
Diffstat (limited to 'sys/cam/cam_queue.h')
-rw-r--r--sys/cam/cam_queue.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/cam/cam_queue.h b/sys/cam/cam_queue.h
index 0bb449117662..0f74e8241a40 100644
--- a/sys/cam/cam_queue.h
+++ b/sys/cam/cam_queue.h
@@ -33,6 +33,8 @@
#ifdef _KERNEL
+#include <sys/lock.h>
+#include <sys/mutex.h>
#include <sys/queue.h>
#include <cam/cam.h>
@@ -59,8 +61,8 @@ struct cam_ccbq {
struct camq queue;
struct ccb_hdr_tailq queue_extra_head;
int queue_extra_entries;
+ int total_openings;
int devq_openings;
- int devq_allocating;
int dev_openings;
int dev_active;
int held;
@@ -69,9 +71,10 @@ struct cam_ccbq {
struct cam_ed;
struct cam_devq {
- struct camq send_queue;
- int send_openings;
- int send_active;
+ struct mtx send_mtx;
+ struct camq send_queue;
+ int send_openings;
+ int send_active;
};