From owner-svn-src-head@freebsd.org Tue Jul 12 21:56:48 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 3153AB934B3; Tue, 12 Jul 2016 21:56:48 +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 0F3631EC2; Tue, 12 Jul 2016 21:56:47 +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 u6CLulWp028741; Tue, 12 Jul 2016 21:56:47 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6CLul1B028739; Tue, 12 Jul 2016 21:56:47 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201607122156.u6CLul1B028739@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:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302679 - 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, 12 Jul 2016 21:56:48 -0000 Author: cem Date: Tue Jul 12 21:56:46 2016 New Revision: 302679 URL: https://svnweb.freebsd.org/changeset/base/302679 Log: ioat(4): Submitters pick up a shovel if queue is too full Before attempting to grow the ring. 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 12 21:56:34 2016 (r302678) +++ head/sys/dev/ioat/ioat.c Tue Jul 12 21:56:46 2016 (r302679) @@ -462,6 +462,7 @@ ioat3_attach(device_t device) mtx_unlock(&ioat->submit_lock); ioat->is_resize_pending = FALSE; + ioat->is_submitter_processing = FALSE; ioat->is_completion_pending = FALSE; ioat->is_reset_pending = FALSE; ioat->is_channel_running = FALSE; @@ -1365,10 +1366,12 @@ ioat_reserve_space(struct ioat_softc *io { struct ioat_descriptor **new_ring; uint32_t order; + boolean_t dug; int error; mtx_assert(&ioat->submit_lock, MA_OWNED); error = 0; + dug = FALSE; if (num_descs < 1 || num_descs > (1 << IOAT_MAX_ORDER)) { error = EINVAL; @@ -1383,6 +1386,22 @@ ioat_reserve_space(struct ioat_softc *io if (ioat_get_ring_space(ioat) >= num_descs) goto out; + if (!dug && !ioat->is_submitter_processing && + (1 << ioat->ring_size_order) > num_descs) { + ioat->is_submitter_processing = TRUE; + mtx_unlock(&ioat->submit_lock); + + ioat_process_events(ioat); + + mtx_lock(&ioat->submit_lock); + dug = TRUE; + KASSERT(ioat->is_submitter_processing == TRUE, + ("is_submitter_processing")); + ioat->is_submitter_processing = FALSE; + wakeup(&ioat->tail); + continue; + } + order = ioat->ring_size_order; if (ioat->is_resize_pending || order == IOAT_MAX_ORDER) { if ((mflags & M_WAITOK) != 0) { @@ -2054,6 +2073,9 @@ ioat_setup_sysctl(device_t device) SYSCTL_ADD_INT(ctx, state, OID_AUTO, "is_resize_pending", CTLFLAG_RD, &ioat->is_resize_pending, 0, "resize pending"); + SYSCTL_ADD_INT(ctx, state, OID_AUTO, "is_submitter_processing", + CTLFLAG_RD, &ioat->is_submitter_processing, 0, + "submitter processing"); SYSCTL_ADD_INT(ctx, state, OID_AUTO, "is_completion_pending", CTLFLAG_RD, &ioat->is_completion_pending, 0, "completion pending"); SYSCTL_ADD_INT(ctx, state, OID_AUTO, "is_reset_pending", CTLFLAG_RD, @@ -2241,6 +2263,8 @@ DB_SHOW_COMMAND(ioat, db_show_ioat) db_printf(" quiescing: %d\n", (int)sc->quiescing); db_printf(" destroying: %d\n", (int)sc->destroying); db_printf(" is_resize_pending: %d\n", (int)sc->is_resize_pending); + db_printf(" is_submitter_processing: %d\n", + (int)sc->is_submitter_processing); db_printf(" is_completion_pending: %d\n", (int)sc->is_completion_pending); db_printf(" is_reset_pending: %d\n", (int)sc->is_reset_pending); db_printf(" is_channel_running: %d\n", (int)sc->is_channel_running); Modified: head/sys/dev/ioat/ioat_internal.h ============================================================================== --- head/sys/dev/ioat/ioat_internal.h Tue Jul 12 21:56:34 2016 (r302678) +++ head/sys/dev/ioat/ioat_internal.h Tue Jul 12 21:56:46 2016 (r302679) @@ -486,6 +486,7 @@ struct ioat_softc { boolean_t quiescing; boolean_t destroying; + boolean_t is_submitter_processing; boolean_t is_resize_pending; boolean_t is_completion_pending; /* submit_lock */ boolean_t is_reset_pending;