CAM locking

Hidetoshi Shimokawa simokawa at FreeBSD.ORG
Fri Jun 1 03:10:53 UTC 2007


Hi Scott,

Thank you for your work on CAM.
I have some questions about lock assertion.

1. Now, xpt_done() should be called with a sim lock for QUEUED ccbs.
   Why don't you add an assertion in xpt_done()?

2. CAMDEBUG seems useless with WITNESS because xpt_path_path_id() requires
   a sim lock. Can we safely drop the assertion?

I have some problem with scsi_target and I'll describe it in another mail.

Regards,

=============================================
(cd /usr/src && patch -p6) < diff_to_current
=============================================
--- //depot/vendor/freebsd/src/sys/cam/cam_xpt.c	2007/05/16 17:02:05
+++ //depot/user/simokawa/firewire_lock/sys/cam/cam_xpt.c	2007/05/23 08:44:59
@@ -4222,7 +4222,9 @@
 path_id_t
 xpt_path_path_id(struct cam_path *path)
 {
+#if 0
 	mtx_assert(path->bus->sim->mtx, MA_OWNED);
+#endif
 
 	return(path->bus->path_id);
 }
@@ -4840,6 +4842,7 @@
 		sim = done_ccb->ccb_h.path->bus->sim;
 		switch (done_ccb->ccb_h.path->periph->type) {
 		case CAM_PERIPH_BIO:
+			mtx_assert(sim->mtx, MA_OWNED);
 			TAILQ_INSERT_TAIL(&sim->sim_doneq, &done_ccb->ccb_h,
 					  sim_links.tqe);
 			done_ccb->ccb_h.pinfo.index = CAM_DONEQ_INDEX;

/\ Hidetoshi Shimokawa
\/  simokawa at FreeBSD.ORG


More information about the freebsd-scsi mailing list