Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Oct 2006 05:11:10 GMT
From:      Scott Long <scottl@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 108712 for review
Message-ID:  <200610300511.k9U5BANJ024035@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=108712

Change 108712 by scottl@scottl-x64 on 2006/10/30 05:10:43

	Remove the last of the GIANT_REQUIRED tags and shuffle some
	assertions so that a locked SIM will boot and do simple I/O.  There
	are some ugly hacks here that will need to be re-thought.

Affected files ...

.. //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#43 edit
.. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_da.c#15 edit
.. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_pass.c#13 edit

Differences ...

==== //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#43 (text+ko) ====

@@ -1500,7 +1500,7 @@
 	int32_t	 status;
 	struct periph_list *periph_head;
 
-	GIANT_REQUIRED;
+	mtx_assert(periph->sim->mtx, MA_OWNED);
 
 	device = periph->path->device;
 
@@ -1537,7 +1537,7 @@
 {
 	struct cam_ed *device;
 
-	GIANT_REQUIRED;
+	mtx_assert(periph->sim->mtx, MA_OWNED);
 
 	device = periph->path->device;
 
@@ -1575,7 +1575,7 @@
 	u_int	mb;
 	int	s;
 
-	GIANT_REQUIRED;
+	mtx_assert(periph->sim->mtx, MA_OWNED);
 
 	path = periph->path;
 	/*
@@ -1706,7 +1706,7 @@
 	struct cam_path *path;
 	struct ccb_trans_settings cts;
 
-	GIANT_REQUIRED;
+	mtx_assert(periph->sim->mtx, MA_OWNED);
 
 	path = periph->path;
 	/*
@@ -3011,8 +3011,6 @@
 {
 	int iopl;
 
-	GIANT_REQUIRED;
-
 	CAM_DEBUG(start_ccb->ccb_h.path, CAM_DEBUG_TRACE, ("xpt_action\n"));
 
 	start_ccb->ccb_h.status = CAM_REQ_INPROG;
@@ -3653,13 +3651,13 @@
 	struct	  cam_devq *devq;
 	struct	  cam_ed *dev;
 
-	GIANT_REQUIRED;
 
 	timeout = start_ccb->ccb_h.timeout;
 	sim = start_ccb->ccb_h.path->bus->sim;
 	devq = sim->devq;
 	dev = start_ccb->ccb_h.path->device;
 
+	mtx_assert(sim->mtx, MA_OWNED);
 	s = splcam();
 
 	/*
@@ -3716,7 +3714,7 @@
 	int s;
 	int runq;
 
-	GIANT_REQUIRED;
+	mtx_assert(perph->sim->mtx, MA_OWNED);
 
 	CAM_DEBUG(perph->path, CAM_DEBUG_TRACE, ("xpt_schedule\n"));
 	device = perph->path->device;
@@ -4042,7 +4040,9 @@
 void
 xpt_setup_ccb(struct ccb_hdr *ccb_h, struct cam_path *path, u_int32_t priority)
 {
+#if 0
 	mtx_assert(path->bus->sim->mtx, MA_OWNED);
+#endif
 
 	CAM_DEBUG(path, CAM_DEBUG_TRACE, ("xpt_setup_ccb\n"));
 	ccb_h->pinfo.priority = priority;
@@ -4070,7 +4070,10 @@
 	struct	   cam_path *path;
 	cam_status status;
 
-	GIANT_REQUIRED;
+#if 0
+	if (perph != NULL)
+		mtx_assert(perph->sim->mtx, MA_OWNED);
+#endif
 
 	path = (struct cam_path *)malloc(sizeof(*path), M_CAMXPT, M_NOWAIT);
 
@@ -4182,7 +4185,9 @@
 void
 xpt_free_path(struct cam_path *path)
 {
+#if 0
 	mtx_assert(path->bus->sim->mtx, MA_OWNED);
+#endif
 
 	CAM_DEBUG(path, CAM_DEBUG_TRACE, ("xpt_free_path\n"));
 	xpt_release_path(path);
@@ -4334,7 +4339,9 @@
 struct cam_sim *
 xpt_path_sim(struct cam_path *path)
 {
+#if 0
 	mtx_assert(path->bus->sim->mtx, MA_OWNED);
+#endif
 
 	return (path->bus->sim);
 }
@@ -4478,7 +4485,6 @@
 	union ccb *work_ccb;
 	cam_status status;
 
-	GIANT_REQUIRED;
 
 	status = xpt_compile_path(&bus_path, NULL, pathid,
 				  CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD);
@@ -4619,7 +4625,7 @@
 	struct cam_ed *device, *next_device;
 	int s;
 
-	GIANT_REQUIRED;
+	mtx_assert(path->bus->sim->mtx, MA_OWNED);
 
 	CAM_DEBUG(path, CAM_DEBUG_TRACE, ("xpt_async\n"));
 

==== //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_da.c#15 (text+ko) ====

@@ -956,6 +956,7 @@
 	case AC_FOUND_DEVICE:
 	{
 		struct ccb_getdev *cgd;
+		struct cam_sim *sim;
 		cam_status status;
  
 		cgd = (struct ccb_getdev *)arg;
@@ -972,11 +973,14 @@
 		 * this device and start the probe
 		 * process.
 		 */
+		sim = xpt_path_sim(cgd->ccb_h.path);
+		mtx_lock(sim->mtx);
 		status = cam_periph_alloc(daregister, daoninvalidate,
 					  dacleanup, dastart,
 					  "da", CAM_PERIPH_BIO,
 					  cgd->ccb_h.path, daasync,
 					  AC_FOUND_DEVICE, cgd);
+		mtx_unlock(sim->mtx);
 
 		if (status != CAM_REQ_CMP
 		 && status != CAM_REQ_INPROG)

==== //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_pass.c#13 (text+ko) ====

@@ -204,6 +204,7 @@
 	  struct cam_path *path, void *arg)
 {
 	struct cam_periph *periph;
+	struct cam_sim *sim;
 
 	periph = (struct cam_periph *)callback_arg;
 
@@ -222,10 +223,13 @@
 		 * this device and start the probe
 		 * process.
 		 */
+		sim = xpt_path_sim(cgd->ccb_h.path);
+		mtx_lock(sim->mtx);
 		status = cam_periph_alloc(passregister, passoninvalidate,
 					  passcleanup, passstart, "pass",
 					  CAM_PERIPH_BIO, cgd->ccb_h.path,
 					  passasync, AC_FOUND_DEVICE, cgd);
+		mtx_unlock(sim->mtx);
 
 		if (status != CAM_REQ_CMP
 		 && status != CAM_REQ_INPROG) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200610300511.k9U5BANJ024035>