From owner-p4-projects@FreeBSD.ORG Thu Nov 12 13:37:42 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 33EC2106568F; Thu, 12 Nov 2009 13:37:42 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D39671065694 for ; Thu, 12 Nov 2009 13:37:41 +0000 (UTC) (envelope-from mav@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id B91CC8FC28 for ; Thu, 12 Nov 2009 13:37:41 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id nACDbfke062406 for ; Thu, 12 Nov 2009 13:37:41 GMT (envelope-from mav@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id nACDbfSa062404 for perforce@freebsd.org; Thu, 12 Nov 2009 13:37:41 GMT (envelope-from mav@freebsd.org) Date: Thu, 12 Nov 2009 13:37:41 GMT Message-Id: <200911121337.nACDbfSa062404@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to mav@freebsd.org using -f From: Alexander Motin To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 170543 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Nov 2009 13:37:42 -0000 http://p4web.freebsd.org/chv.cgi?CH=170543 Change 170543 by mav@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); }