From owner-svn-src-head@freebsd.org Tue Jul 5 20:52:37 2016 Return-Path: Delivered-To: svn-src-head@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 3FE09B72086; Tue, 5 Jul 2016 20:52:37 +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 EB5131179; Tue, 5 Jul 2016 20:52:36 +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 u65KqaK6054262; Tue, 5 Jul 2016 20:52:36 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u65KqagW054260; Tue, 5 Jul 2016 20:52:36 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201607052052.u65KqagW054260@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Tue, 5 Jul 2016 20:52:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302353 - 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-head@freebsd.org X-Mailman-Version: 2.1.22 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: Tue, 05 Jul 2016 20:52:37 -0000 Author: cem Date: Tue Jul 5 20:52:35 2016 New Revision: 302353 URL: https://svnweb.freebsd.org/changeset/base/302353 Log: ioat(4): Serialize ioat_reset_hw invocations Reviewed by: markj Approved by: re Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D7097 Modified: head/sys/dev/ioat/ioat.c head/sys/dev/ioat/ioat_internal.h Modified: head/sys/dev/ioat/ioat.c ============================================================================== --- head/sys/dev/ioat/ioat.c Tue Jul 5 20:51:52 2016 (r302352) +++ head/sys/dev/ioat/ioat.c Tue Jul 5 20:52:35 2016 (r302353) @@ -326,6 +326,7 @@ ioat_detach(device_t device) ioat->quiescing = TRUE; ioat->destroying = TRUE; wakeup(&ioat->quiescing); + wakeup(&ioat->resetting); ioat_channel[ioat->chan_idx] = NULL; @@ -1699,6 +1700,14 @@ ioat_reset_hw(struct ioat_softc *ioat) int error; mtx_lock(IOAT_REFLK); + while (ioat->resetting && !ioat->destroying) + msleep(&ioat->resetting, IOAT_REFLK, 0, "IRH_drain", 0); + if (ioat->destroying) { + mtx_unlock(IOAT_REFLK); + return (ENXIO); + } + ioat->resetting = TRUE; + ioat->quiescing = TRUE; ioat_drain_locked(ioat); mtx_unlock(IOAT_REFLK); @@ -1792,6 +1801,9 @@ ioat_reset_hw(struct ioat_softc *ioat) out: mtx_lock(IOAT_REFLK); + ioat->resetting = FALSE; + wakeup(&ioat->resetting); + ioat->quiescing = FALSE; wakeup(&ioat->quiescing); mtx_unlock(IOAT_REFLK); @@ -2172,6 +2184,7 @@ DB_SHOW_COMMAND(ioat, db_show_ioat) db_printf(" is_reset_pending: %d\n", (int)sc->is_reset_pending); db_printf(" is_channel_running: %d\n", (int)sc->is_channel_running); db_printf(" intrdelay_supported: %d\n", (int)sc->intrdelay_supported); + db_printf(" resetting: %d\n", (int)sc->resetting); db_printf(" head: %u\n", sc->head); db_printf(" tail: %u\n", sc->tail); Modified: head/sys/dev/ioat/ioat_internal.h ============================================================================== --- head/sys/dev/ioat/ioat_internal.h Tue Jul 5 20:51:52 2016 (r302352) +++ head/sys/dev/ioat/ioat_internal.h Tue Jul 5 20:52:35 2016 (r302353) @@ -491,6 +491,7 @@ struct ioat_softc { boolean_t is_reset_pending; boolean_t is_channel_running; boolean_t intrdelay_supported; + boolean_t resetting; uint32_t head; uint32_t tail;