Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Jul 2016 21:56:47 +0000 (UTC)
From:      "Conrad E. Meyer" <cem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r302679 - head/sys/dev/ioat
Message-ID:  <201607122156.u6CLul1B028739@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607122156.u6CLul1B028739>