PERFORCE change 170543 for review
Alexander Motin
mav at FreeBSD.org
Thu Nov 12 13:37:42 UTC 2009
http://p4web.freebsd.org/chv.cgi?CH=170543
Change 170543 by mav at mav_mavbook on 2009/11/12 13:37:13
Remove code that 10 years ago was closing race between sim_action()
and device/SIM freeze. It just impossible with present CAM locking,
but caused some unexpected side effects.
Affected files ...
.. //depot/projects/scottl-camlock/src/sys/cam/cam_queue.c#6 edit
.. //depot/projects/scottl-camlock/src/sys/cam/cam_queue.h#5 edit
.. //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#127 edit
Differences ...
==== //depot/projects/scottl-camlock/src/sys/cam/cam_queue.c#6 (text+ko) ====
@@ -334,7 +334,6 @@
}
ccbq->devq_openings = openings;
ccbq->dev_openings = openings;
- TAILQ_INIT(&ccbq->active_ccbs);
return (0);
}
==== //depot/projects/scottl-camlock/src/sys/cam/cam_queue.h#5 (text+ko) ====
@@ -60,7 +60,6 @@
int dev_openings;
int dev_active;
int held;
- struct ccb_hdr_tailq active_ccbs;
};
struct cam_ed;
@@ -209,9 +208,6 @@
cam_ccbq_send_ccb(struct cam_ccbq *ccbq, union ccb *send_ccb)
{
- TAILQ_INSERT_TAIL(&ccbq->active_ccbs,
- &(send_ccb->ccb_h),
- xpt_links.tqe);
send_ccb->ccb_h.pinfo.index = CAM_ACTIVE_INDEX;
ccbq->dev_active++;
ccbq->dev_openings--;
@@ -220,8 +216,7 @@
static __inline void
cam_ccbq_ccb_done(struct cam_ccbq *ccbq, union ccb *done_ccb)
{
- TAILQ_REMOVE(&ccbq->active_ccbs, &done_ccb->ccb_h,
- xpt_links.tqe);
+
ccbq->dev_active--;
ccbq->dev_openings++;
ccbq->held++;
==== //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#127 (text+ko) ====
@@ -3327,9 +3327,7 @@
}
mtx_unlock(&xsoftc.xpt_lock);
}
- devq->active_dev = device;
cam_ccbq_remove_ccb(&device->ccbq, work_ccb);
-
cam_ccbq_send_ccb(&device->ccbq, work_ccb);
devq->send_openings--;
@@ -3367,8 +3365,6 @@
*/
sim = work_ccb->ccb_h.path->bus->sim;
(*(sim->sim_action))(sim, work_ccb);
-
- devq->active_dev = NULL;
}
devq->send_queue.qfrozen_cnt--;
}
@@ -4099,45 +4095,18 @@
u_int32_t
xpt_freeze_devq(struct cam_path *path, u_int count)
{
- struct ccb_hdr *ccbh;
mtx_assert(path->bus->sim->mtx, MA_OWNED);
-
path->device->ccbq.queue.qfrozen_cnt += count;
-
- /*
- * Mark the last CCB in the queue as needing
- * to be requeued if the driver hasn't
- * changed it's state yet. This fixes a race
- * where a ccb is just about to be queued to
- * a controller driver when it's interrupt routine
- * freezes the queue. To completly close the
- * hole, controller drives must check to see
- * if a ccb's status is still CAM_REQ_INPROG
- * just before they queue
- * the CCB. See ahc_action/ahc_freeze_devq for
- * an example.
- */
- ccbh = TAILQ_LAST(&path->device->ccbq.active_ccbs, ccb_hdr_tailq);
- if (ccbh && ccbh->status == CAM_REQ_INPROG)
- ccbh->status = CAM_REQUEUE_REQ;
return (path->device->ccbq.queue.qfrozen_cnt);
}
u_int32_t
xpt_freeze_simq(struct cam_sim *sim, u_int count)
{
+
mtx_assert(sim->mtx, MA_OWNED);
-
sim->devq->send_queue.qfrozen_cnt += count;
- if (sim->devq->active_dev != NULL) {
- struct ccb_hdr *ccbh;
-
- ccbh = TAILQ_LAST(&sim->devq->active_dev->ccbq.active_ccbs,
- ccb_hdr_tailq);
- if (ccbh && ccbh->status == CAM_REQ_INPROG)
- ccbh->status = CAM_REQUEUE_REQ;
- }
return (sim->devq->send_queue.qfrozen_cnt);
}
More information about the p4-projects
mailing list