From owner-svn-src-all@freebsd.org Tue Jul 12 21:56:56 2016 Return-Path: Delivered-To: svn-src-all@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 6AC57B93510; Tue, 12 Jul 2016 21:56:56 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 34F5B119F; Tue, 12 Jul 2016 21:56:56 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6CLutin028878; Tue, 12 Jul 2016 21:56:55 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6CLutcF028877; Tue, 12 Jul 2016 21:56:55 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201607122156.u6CLutcF028877@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Tue, 12 Jul 2016 21:56:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302682 - head/sys/dev/ioat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 21:56:56 -0000 Author: cem Date: Tue Jul 12 21:56:55 2016 New Revision: 302682 URL: https://svnweb.freebsd.org/changeset/base/302682 Log: ioat_reserve_space: Recheck quiescing flag after dropping submit lock Fix a minor bound check error while here (ring can only hold 1 << MAX_ORDER - 1 entries). Modified: head/sys/dev/ioat/ioat.c Modified: head/sys/dev/ioat/ioat.c ============================================================================== --- head/sys/dev/ioat/ioat.c Tue Jul 12 21:56:52 2016 (r302681) +++ head/sys/dev/ioat/ioat.c Tue Jul 12 21:56:55 2016 (r302682) @@ -1382,16 +1382,17 @@ ioat_reserve_space(struct ioat_softc *io error = 0; dug = FALSE; - if (num_descs < 1 || num_descs > (1 << IOAT_MAX_ORDER)) { + if (num_descs < 1 || num_descs >= (1 << IOAT_MAX_ORDER)) { error = EINVAL; goto out; } - if (ioat->quiescing) { - error = ENXIO; - goto out; - } for (;;) { + if (ioat->quiescing) { + error = ENXIO; + goto out; + } + if (ioat_get_ring_space(ioat) >= num_descs) goto out; @@ -1453,6 +1454,8 @@ ioat_reserve_space(struct ioat_softc *io out: mtx_assert(&ioat->submit_lock, MA_OWNED); + KASSERT(!ioat->quiescing || error == ENXIO, + ("reserved during quiesce")); return (error); }