From owner-svn-src-head@FreeBSD.ORG Wed Jan 21 20:05:11 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C217EB1B; Wed, 21 Jan 2015 20:05:11 +0000 (UTC) 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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AE7177BC; Wed, 21 Jan 2015 20:05:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t0LK5BDj000426; Wed, 21 Jan 2015 20:05:11 GMT (envelope-from will@FreeBSD.org) Received: (from will@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t0LK5BQI000423; Wed, 21 Jan 2015 20:05:11 GMT (envelope-from will@FreeBSD.org) Message-Id: <201501212005.t0LK5BQI000423@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: will set sender to will@FreeBSD.org using -f From: Will Andrews Date: Wed, 21 Jan 2015 20:05:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r277509 - head/sys/dev/firewire X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Jan 2015 20:05:12 -0000 Author: will Date: Wed Jan 21 20:05:10 2015 New Revision: 277509 URL: https://svnweb.freebsd.org/changeset/base/277509 Log: Properly lock accesss to the firewire_comm->devices list. sys/dev/firewire/firewire.c: Add missing FW_GLOCK/UNLOCK() usage to fw_noderesolve_nodeid(). sys/dev/firewire/firewire.c: sys/dev/firewire/fwmem.c: Remove no-op splfw() calls from functions that have been audited for proper lock usage. Submitted by: gibbs MFC after: 1 week Sponsored by: Spectra Logic MFSpectraBSD: 1110992 on 2015/01/06 Modified: head/sys/dev/firewire/firewire.c head/sys/dev/firewire/fwmem.c Modified: head/sys/dev/firewire/firewire.c ============================================================================== --- head/sys/dev/firewire/firewire.c Wed Jan 21 20:03:46 2015 (r277508) +++ head/sys/dev/firewire/firewire.c Wed Jan 21 20:05:10 2015 (r277509) @@ -146,13 +146,12 @@ struct fw_device * fw_noderesolve_nodeid(struct firewire_comm *fc, int dst) { struct fw_device *fwdev; - int s; - s = splfw(); + FW_GLOCK(fc); STAILQ_FOREACH(fwdev, &fc->devices, link) if (fwdev->dst == dst && fwdev->status != FWDEVINVAL) break; - splx(s); + FW_GUNLOCK(fc); return fwdev; } @@ -164,15 +163,12 @@ struct fw_device * fw_noderesolve_eui64(struct firewire_comm *fc, struct fw_eui64 *eui) { struct fw_device *fwdev; - int s; - s = splfw(); FW_GLOCK(fc); STAILQ_FOREACH(fwdev, &fc->devices, link) if (FW_EUI64_EQUAL(fwdev->eui, *eui)) break; FW_GUNLOCK(fc); - splx(s); if (fwdev == NULL) return NULL; @@ -301,9 +297,7 @@ static void fw_asystart(struct fw_xfer *xfer) { struct firewire_comm *fc = xfer->fc; - int s; - s = splfw(); /* Protect from interrupt/timeout */ FW_GLOCK(fc); xfer->flag = FWXF_INQ; @@ -312,7 +306,6 @@ fw_asystart(struct fw_xfer *xfer) xfer->q->queued++; #endif FW_GUNLOCK(fc); - splx(s); /* XXX just queue for mbuf */ if (xfer->mbuf == NULL) xfer->q->start(fc); @@ -332,6 +325,7 @@ firewire_probe(device_t dev) return (0); } +/* Just use a per-packet callout? */ static void firewire_xfer_timeout(void *arg, int pending) { @@ -340,7 +334,7 @@ firewire_xfer_timeout(void *arg, int pen struct timeval tv; struct timeval split_timeout; STAILQ_HEAD(, fw_xfer) xfer_timeout; - int i, s; + int i; split_timeout.tv_sec = 0; split_timeout.tv_usec = 200 * 1000; /* 200 msec */ @@ -349,9 +343,8 @@ firewire_xfer_timeout(void *arg, int pen timevalsub(&tv, &split_timeout); STAILQ_INIT(&xfer_timeout); - s = splfw(); mtx_lock(&fc->tlabel_lock); - for (i = 0; i < 0x40; i++) { + for (i = 0; i < nitems(fc->tlabels); i++) { while ((xfer = STAILQ_FIRST(&fc->tlabels[i])) != NULL) { if ((xfer->flag & FWXF_SENT) == 0) /* not sent yet */ @@ -370,7 +363,6 @@ firewire_xfer_timeout(void *arg, int pen } } mtx_unlock(&fc->tlabel_lock); - splx(s); fc->timeout(fc); STAILQ_FOREACH_SAFE(xfer, &xfer_timeout, tlabel, txfer) Modified: head/sys/dev/firewire/fwmem.c ============================================================================== --- head/sys/dev/firewire/fwmem.c Wed Jan 21 20:03:46 2015 (r277508) +++ head/sys/dev/firewire/fwmem.c Wed Jan 21 20:05:10 2015 (r277509) @@ -348,12 +348,11 @@ fwmem_strategy(struct bio *bp) struct fw_device *fwdev; struct fw_xfer *xfer; struct cdev *dev; - int err = 0, s, iolen; + int err = 0, iolen; dev = bp->bio_dev; /* XXX check request length */ - s = splfw(); fms = dev->si_drv1; fwdev = fw_noderesolve_eui64(fms->sc->fc, &fms->eui); if (fwdev == NULL) { @@ -395,7 +394,6 @@ fwmem_strategy(struct bio *bp) /* XXX */ bp->bio_resid = bp->bio_bcount - iolen; error: - splx(s); if (err != 0) { if (fwmem_debug) printf("%s: err=%d\n", __func__, err);