From owner-svn-src-stable@freebsd.org Mon Oct 5 07:10:10 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8512FA10CC6; Mon, 5 Oct 2015 07:10:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5C39E388; Mon, 5 Oct 2015 07:10:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t957AAYA067515; Mon, 5 Oct 2015 07:10:10 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t957AALA067514; Mon, 5 Oct 2015 07:10:10 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510050710.t957AALA067514@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 5 Oct 2015 07:10:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r288695 - stable/10/sys/cam X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Oct 2015 07:10:10 -0000 Author: mav Date: Mon Oct 5 07:10:09 2015 New Revision: 288695 URL: https://svnweb.freebsd.org/changeset/base/288695 Log: MFC r277440 (by will): Restore the CAM XPT peripheral generation counter, and export it via sysctl. Define it as an atomic uint32_t. These increments happen infrequently enough for the atomic overhead to be a problem, and since they're now independent atomics, they won't contend with xpt_lock_buses(). This counter is useful as a means of cheaply identifying whether any changes have been made to the CAM peripheral list. Userland programs have no guarantee that the counter won't change on them while being returned or while processing the information, so they must be written accordingly. Modified: stable/10/sys/cam/cam_xpt.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/cam_xpt.c ============================================================================== --- stable/10/sys/cam/cam_xpt.c Mon Oct 5 07:07:37 2015 (r288694) +++ stable/10/sys/cam/cam_xpt.c Mon Oct 5 07:10:09 2015 (r288695) @@ -93,6 +93,8 @@ struct xpt_task { }; struct xpt_softc { + uint32_t xpt_generation; + /* number of high powered commands that can go through right now */ struct mtx xpt_highpower_lock; STAILQ_HEAD(highpowerlist, cam_ed) highpowerq; @@ -154,6 +156,8 @@ MTX_SYSINIT(xpt_topo_init, &xsoftc.xpt_t TUNABLE_INT("kern.cam.boot_delay", &xsoftc.boot_delay); SYSCTL_INT(_kern_cam, OID_AUTO, boot_delay, CTLFLAG_RDTUN, &xsoftc.boot_delay, 0, "Bus registration wait time"); +SYSCTL_UINT(_kern_cam, OID_AUTO, xpt_generation, CTLFLAG_RD, + &xsoftc.xpt_generation, 0, "CAM peripheral generation count"); struct cam_doneq { struct mtx_padalign cam_doneq_mtx; @@ -981,6 +985,7 @@ xpt_add_periph(struct cam_periph *periph device->generation++; SLIST_INSERT_HEAD(&device->periphs, periph, periph_links); mtx_unlock(&device->target->bus->eb_mtx); + atomic_add_32(&xsoftc.xpt_generation, 1); } return (status); @@ -997,6 +1002,7 @@ xpt_remove_periph(struct cam_periph *per device->generation++; SLIST_REMOVE(&device->periphs, periph, cam_periph, periph_links); mtx_unlock(&device->target->bus->eb_mtx); + atomic_add_32(&xsoftc.xpt_generation, 1); } }