From owner-p4-projects@FreeBSD.ORG Sat Jan 23 21:19:11 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 4ED091065670; Sat, 23 Jan 2010 21:19:11 +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 EF632106566C for ; Sat, 23 Jan 2010 21:19:10 +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 DCDD08FC0A for ; Sat, 23 Jan 2010 21:19:10 +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 o0NLJArt024724 for ; Sat, 23 Jan 2010 21:19:10 GMT (envelope-from mav@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o0NLJAoR024722 for perforce@freebsd.org; Sat, 23 Jan 2010 21:19:10 GMT (envelope-from mav@freebsd.org) Date: Sat, 23 Jan 2010 21:19:10 GMT Message-Id: <201001232119.o0NLJAoR024722@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 173593 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: Sat, 23 Jan 2010 21:19:11 -0000 http://p4web.freebsd.org/chv.cgi?CH=173593 Change 173593 by mav@mav_mavtest on 2010/01/23 21:18:38 More fixes to freeze/scheduling code. Affected files ... .. //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#144 edit Differences ... ==== //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#144 (text+ko) ==== @@ -3202,8 +3202,9 @@ CAM_DEBUG_PRINT(CAM_DEBUG_XPT, ("changed priority to %d\n", new_priority)); - } - retval = 0; + retval = 1; + } else + retval = 0; } else { /* New entry on the queue */ if (new_priority < old_priority) @@ -3247,15 +3248,6 @@ qinfo = (struct cam_ed_qinfo *)camq_remove(&devq->alloc_queue, CAMQ_HEAD); device = qinfo->device; - - /* - * If the device has been "frozen", don't attempt - * to run it. - */ - if (cam_ccbq_frozen(&device->ccbq, - CAM_PRIORITY_TO_RL(qinfo->pinfo.priority)) > 0) - continue; - CAM_DEBUG_PRINT(CAM_DEBUG_XPT, ("running device %p\n", device)); @@ -3316,14 +3308,6 @@ qinfo = (struct cam_ed_qinfo *)camq_remove(&devq->send_queue, CAMQ_HEAD); device = qinfo->device; - - /* - * If the device has been "frozen", don't attempt - * to run it. - */ - if (cam_ccbq_frozen_top(&device->ccbq) > 0) - continue; - CAM_DEBUG_PRINT(CAM_DEBUG_XPT, ("running device %p\n", device)); @@ -4134,11 +4118,25 @@ u_int32_t xpt_freeze_devq_rl(struct cam_path *path, cam_rl rl, u_int count) { + struct cam_ed *dev = path->device; mtx_assert(path->bus->sim->mtx, MA_OWNED); - path->device->sim->devq->alloc_openings += - cam_ccbq_freeze(&path->device->ccbq, rl, count); - return (path->device->ccbq.queue.qfrozen_cnt[rl]); + dev->sim->devq->alloc_openings += + cam_ccbq_freeze(&dev->ccbq, rl, count); + /* Remove frozen device from allocq. */ + if (device_is_alloc_queued(dev) && + cam_ccbq_frozen(&dev->ccbq, CAM_PRIORITY_TO_RL( + CAMQ_GET_PRIO(&dev->drvq)))) { + camq_remove(&dev->sim->devq->alloc_queue, + dev->alloc_ccb_entry.pinfo.index); + } + /* Remove frozen device from sendq. */ + if (device_is_send_queued(dev) && + cam_ccbq_frozen_top(&dev->ccbq)) { + camq_remove(&dev->sim->devq->send_queue, + dev->send_ccb_entry.pinfo.index); + } + return (dev->ccbq.queue.qfrozen_cnt[rl]); } u_int32_t @@ -4196,8 +4194,8 @@ cam_ccbq_release(&dev->ccbq, rl, count); if (cam_ccbq_frozen(&dev->ccbq, CAM_PRIORITY_TO_RL( CAMQ_GET_PRIO(&dev->drvq))) == 0) { - xpt_schedule_dev_allocq(dev->target->bus, dev); - xpt_run_dev_allocq(dev->target->bus); + if (xpt_schedule_dev_allocq(dev->target->bus, dev)) + xpt_run_dev_allocq(dev->target->bus); } if (cam_ccbq_frozen_top(&dev->ccbq) == 0) { /* @@ -4960,21 +4958,19 @@ cam_ccbq_ccb_done(&dev->ccbq, (union ccb *)ccb_h); ccb_h->path->bus->sim->devq->send_active--; ccb_h->path->bus->sim->devq->send_openings++; + runq = TRUE; if (((dev->flags & CAM_DEV_REL_ON_COMPLETE) != 0 && (ccb_h->status&CAM_STATUS_MASK) != CAM_REQUEUE_REQ) || ((dev->flags & CAM_DEV_REL_ON_QUEUE_EMPTY) != 0 && (dev->ccbq.dev_active == 0))) { - xpt_release_devq(ccb_h->path, /*count*/1, - /*run_queue*/TRUE); + /*run_queue*/FALSE); } if ((dev->flags & CAM_DEV_TAG_AFTER_COUNT) != 0 && (--dev->tag_delay_count == 0)) xpt_start_tags(ccb_h->path); - - runq = xpt_schedule_dev_sendq(ccb_h->path->bus, dev); } if (ccb_h->status & CAM_RELEASE_SIMQ) {