From owner-svn-src-projects@FreeBSD.ORG Wed Aug 14 12:43:02 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 40F32116; Wed, 14 Aug 2013 12:43:02 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1E912271E; Wed, 14 Aug 2013 12:43:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7ECh1qH046185; Wed, 14 Aug 2013 12:43:01 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7ECh1Dt046184; Wed, 14 Aug 2013 12:43:01 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201308141243.r7ECh1Dt046184@svn.freebsd.org> From: Alexander Motin Date: Wed, 14 Aug 2013 12:43:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r254325 - projects/camlock/sys/cam X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Aug 2013 12:43:02 -0000 Author: mav Date: Wed Aug 14 12:43:01 2013 New Revision: 254325 URL: http://svnweb.freebsd.org/changeset/base/254325 Log: Don't use send_mtx to protect what left from allocation queue. It left from previous failed locking attempt and no longer needed. The allocation queues are protected now by new per-device mutexes. Modified: projects/camlock/sys/cam/cam_xpt.c Modified: projects/camlock/sys/cam/cam_xpt.c ============================================================================== --- projects/camlock/sys/cam/cam_xpt.c Wed Aug 14 12:06:46 2013 (r254324) +++ projects/camlock/sys/cam/cam_xpt.c Wed Aug 14 12:43:01 2013 (r254325) @@ -3044,13 +3044,12 @@ xpt_schedule(struct cam_periph *periph, struct cam_devq *devq; CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("xpt_schedule\n")); + cam_periph_assert(periph, MA_OWNED); devq = periph->sim->devq; - mtx_lock(&devq->send_mtx); if (new_priority < periph->scheduled_priority) { periph->scheduled_priority = new_priority; xpt_run_allocq(periph); } - mtx_unlock(&devq->send_mtx); } @@ -3109,7 +3108,7 @@ xpt_run_allocq(struct cam_periph *periph uint32_t prio; devq = periph->sim->devq; - mtx_assert(&devq->send_mtx, MA_OWNED); + cam_periph_assert(periph, MA_OWNED); if (periph->periph_allocating) return; periph->periph_allocating = 1; @@ -3145,9 +3144,7 @@ xpt_run_allocq(struct cam_periph *periph periph->scheduled_priority = CAM_PRIORITY_NONE; CAM_DEBUG_PRINT(CAM_DEBUG_XPT, ("calling periph_start()\n")); - mtx_unlock(&devq->send_mtx); periph->periph_start(periph, ccb); - mtx_lock(&devq->send_mtx); } } periph->periph_allocating = 0; @@ -3710,16 +3707,15 @@ xpt_release_ccb(union ccb *free_ccb) struct cam_periph *periph; CAM_DEBUG_PRINT(CAM_DEBUG_XPT, ("xpt_release_ccb\n")); + xpt_path_assert(free_ccb->ccb_h.path, MA_OWNED); device = free_ccb->ccb_h.path->device; devq = device->sim->devq; periph = free_ccb->ccb_h.path->periph; xpt_free_ccb(free_ccb); - mtx_lock(&devq->send_mtx); periph->periph_allocated--; cam_ccbq_release_opening(&device->ccbq); xpt_run_allocq(periph); - mtx_unlock(&devq->send_mtx); } /* Functions accessed by SIM drivers */ @@ -4446,25 +4442,20 @@ xpt_get_ccb(struct cam_periph *periph) union ccb * cam_periph_getccb(struct cam_periph *periph, u_int32_t priority) { - struct cam_devq *devq; struct ccb_hdr *ccb_h; CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("cam_periph_getccb\n")); - devq = periph->sim->devq; - cam_periph_unlock(periph); - mtx_lock(&devq->send_mtx); + cam_periph_assert(periph, MA_OWNED); while ((ccb_h = SLIST_FIRST(&periph->ccb_list)) == NULL || ccb_h->pinfo.priority != priority) { if (priority < periph->immediate_priority) { periph->immediate_priority = priority; xpt_run_allocq(periph); } else - mtx_sleep(&periph->ccb_list, &devq->send_mtx, PRIBIO, + cam_periph_sleep(periph, &periph->ccb_list, PRIBIO, "cgticb", 0); } SLIST_REMOVE_HEAD(&periph->ccb_list, periph_links.sle); - mtx_unlock(&devq->send_mtx); - cam_periph_lock(periph); return ((union ccb *)ccb_h); }