From owner-svn-src-stable-9@FreeBSD.ORG Wed Oct 9 19:22:02 2013 Return-Path: Delivered-To: svn-src-stable-9@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 660D2651; Wed, 9 Oct 2013 19:22: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 535922EF9; Wed, 9 Oct 2013 19:22: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 r99JM25P074628; Wed, 9 Oct 2013 19:22:02 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r99JM1i3074624; Wed, 9 Oct 2013 19:22:01 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201310091922.r99JM1i3074624@svn.freebsd.org> From: Alexander Motin Date: Wed, 9 Oct 2013 19:22:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256223 - stable/9/sys/cam X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Oct 2013 19:22:02 -0000 Author: mav Date: Wed Oct 9 19:22:01 2013 New Revision: 256223 URL: http://svnweb.freebsd.org/changeset/base/256223 Log: MFC r254058: Remove droping topology mutex after iterating 100 periphs in CAMGETPASSTHRU. That is not so slow and so often operation to handle unneeded otherwise xsoftc.xpt_generation and respective locking complications. Modified: stable/9/sys/cam/cam_periph.c stable/9/sys/cam/cam_xpt.c stable/9/sys/cam/cam_xpt_periph.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/cam_periph.c ============================================================================== --- stable/9/sys/cam/cam_periph.c Wed Oct 9 19:19:53 2013 (r256222) +++ stable/9/sys/cam/cam_periph.c Wed Oct 9 19:22:01 2013 (r256223) @@ -258,7 +258,7 @@ failure: break; case 3: CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph destroyed\n")); - xpt_remove_periph(periph, /*topology_lock_held*/ 0); + xpt_remove_periph(periph); /* FALLTHROUGH */ case 2: xpt_lock_buses(); @@ -645,7 +645,7 @@ camperiphfree(struct cam_periph *periph) TAILQ_REMOVE(&(*p_drv)->units, periph, unit_links); (*p_drv)->generation++; - xpt_remove_periph(periph, /*topology_lock_held*/ 1); + xpt_remove_periph(periph); xpt_unlock_buses(); CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph destroyed\n")); Modified: stable/9/sys/cam/cam_xpt.c ============================================================================== --- stable/9/sys/cam/cam_xpt.c Wed Oct 9 19:19:53 2013 (r256222) +++ stable/9/sys/cam/cam_xpt.c Wed Oct 9 19:22:01 2013 (r256223) @@ -96,7 +96,6 @@ typedef enum { struct xpt_softc { xpt_flags flags; - u_int32_t xpt_generation; /* number of high powered commands that can go through right now */ STAILQ_HEAD(highpowerlist, cam_ed) highpowerq; @@ -608,24 +607,11 @@ xptdoioctl(struct cdev *dev, u_long cmd, struct periph_driver **p_drv; char *name; u_int unit; - u_int cur_generation; int base_periph_found; - int splbreaknum; ccb = (union ccb *)addr; unit = ccb->cgdl.unit_number; name = ccb->cgdl.periph_name; - /* - * Every 100 devices, we want to drop our lock protection to - * give the software interrupt handler a chance to run. - * Most systems won't run into this check, but this should - * avoid starvation in the software interrupt handler in - * large systems. - */ - splbreaknum = 100; - - ccb = (union ccb *)addr; - base_periph_found = 0; /* @@ -639,8 +625,6 @@ xptdoioctl(struct cdev *dev, u_long cmd, /* Keep the list from changing while we traverse it */ xpt_lock_buses(); -ptstartover: - cur_generation = xsoftc.xpt_generation; /* first find our driver in the list of drivers */ for (p_drv = periph_drivers; *p_drv != NULL; p_drv++) @@ -667,15 +651,8 @@ ptstartover: for (periph = TAILQ_FIRST(&(*p_drv)->units); periph != NULL; periph = TAILQ_NEXT(periph, unit_links)) { - if (periph->unit_number == unit) { + if (periph->unit_number == unit) break; - } else if (--splbreaknum == 0) { - xpt_unlock_buses(); - xpt_lock_buses(); - splbreaknum = 100; - if (cur_generation != xsoftc.xpt_generation) - goto ptstartover; - } } /* * If we found the peripheral driver that the user passed @@ -1015,15 +992,11 @@ xpt_add_periph(struct cam_periph *periph SLIST_INSERT_HEAD(periph_head, periph, periph_links); } - xpt_lock_buses(); - xsoftc.xpt_generation++; - xpt_unlock_buses(); - return (status); } void -xpt_remove_periph(struct cam_periph *periph, int topology_lock_held) +xpt_remove_periph(struct cam_periph *periph) { struct cam_ed *device; @@ -1043,14 +1016,6 @@ xpt_remove_periph(struct cam_periph *per SLIST_REMOVE(periph_head, periph, cam_periph, periph_links); } - - if (topology_lock_held == 0) - xpt_lock_buses(); - - xsoftc.xpt_generation++; - - if (topology_lock_held == 0) - xpt_unlock_buses(); } Modified: stable/9/sys/cam/cam_xpt_periph.h ============================================================================== --- stable/9/sys/cam/cam_xpt_periph.h Wed Oct 9 19:19:53 2013 (r256222) +++ stable/9/sys/cam/cam_xpt_periph.h Wed Oct 9 19:22:01 2013 (r256223) @@ -42,8 +42,7 @@ void xpt_polled_action(union ccb *ccb); void xpt_release_ccb(union ccb *released_ccb); void xpt_schedule(struct cam_periph *perph, u_int32_t new_priority); int32_t xpt_add_periph(struct cam_periph *periph); -void xpt_remove_periph(struct cam_periph *periph, - int topology_lock_held); +void xpt_remove_periph(struct cam_periph *periph); void xpt_announce_periph(struct cam_periph *periph, char *announce_string); void xpt_announce_quirks(struct cam_periph *periph,