All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Subject: [CI 15/47] drm/i915: Test request ordering between engines
Date: Mon, 13 Feb 2017 17:15:26 +0000	[thread overview]
Message-ID: <20170213171558.20942-15-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <20170213171558.20942-1-chris@chris-wilson.co.uk>

A request on one engine with a dependency on a request on another engine
must wait for completion of the first request before starting.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 drivers/gpu/drm/i915/selftests/i915_gem_request.c | 132 ++++++++++++++++++++++
 1 file changed, 132 insertions(+)

diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_request.c b/drivers/gpu/drm/i915/selftests/i915_gem_request.c
index 880a1e82393a..e946488d6af2 100644
--- a/drivers/gpu/drm/i915/selftests/i915_gem_request.c
+++ b/drivers/gpu/drm/i915/selftests/i915_gem_request.c
@@ -521,11 +521,143 @@ static int live_all_engines(void *arg)
 	return err;
 }
 
+static int live_sequential_engines(void *arg)
+{
+	struct drm_i915_private *i915 = arg;
+	struct drm_i915_gem_request *request[I915_NUM_ENGINES] = {};
+	struct drm_i915_gem_request *prev = NULL;
+	struct intel_engine_cs *engine;
+	struct live_test t;
+	unsigned int id;
+	int err;
+
+	/* Check we can submit requests to all engines sequentially, such
+	 * that each successive request waits for the earlier ones. This
+	 * tests that we don't execute requests out of order, even though
+	 * they are running on independent engines.
+	 */
+
+	mutex_lock(&i915->drm.struct_mutex);
+
+	err = begin_live_test(&t, i915, __func__, "");
+	if (err)
+		goto out_unlock;
+
+	for_each_engine(engine, i915, id) {
+		struct i915_vma *batch;
+
+		batch = recursive_batch(i915);
+		if (IS_ERR(batch)) {
+			err = PTR_ERR(batch);
+			pr_err("%s: Unable to create batch for %s, err=%d\n",
+			       __func__, engine->name, err);
+			goto out_unlock;
+		}
+
+		request[id] = i915_gem_request_alloc(engine,
+						     i915->kernel_context);
+		if (IS_ERR(request[id])) {
+			err = PTR_ERR(request[id]);
+			pr_err("%s: Request allocation failed for %s with err=%d\n",
+			       __func__, engine->name, err);
+			goto out_request;
+		}
+
+		if (prev) {
+			err = i915_gem_request_await_dma_fence(request[id],
+							       &prev->fence);
+			if (err) {
+				i915_add_request(request[id]);
+				pr_err("%s: Request await failed for %s with err=%d\n",
+				       __func__, engine->name, err);
+				goto out_request;
+			}
+		}
+
+		err = engine->emit_flush(request[id], EMIT_INVALIDATE);
+		GEM_BUG_ON(err);
+
+		err = i915_switch_context(request[id]);
+		GEM_BUG_ON(err);
+
+		err = engine->emit_bb_start(request[id],
+					    batch->node.start,
+					    batch->node.size,
+					    0);
+		GEM_BUG_ON(err);
+		request[id]->batch = batch;
+
+		i915_vma_move_to_active(batch, request[id], 0);
+		i915_gem_object_set_active_reference(batch->obj);
+		i915_vma_get(batch);
+
+		i915_gem_request_get(request[id]);
+		i915_add_request(request[id]);
+
+		prev = request[id];
+	}
+
+	for_each_engine(engine, i915, id) {
+		long timeout;
+
+		if (i915_gem_request_completed(request[id])) {
+			pr_err("%s(%s): request completed too early!\n",
+			       __func__, engine->name);
+			err = -EINVAL;
+			goto out_request;
+		}
+
+		err = recursive_batch_resolve(request[id]->batch);
+		if (err) {
+			pr_err("%s: failed to resolve batch, err=%d\n",
+			       __func__, err);
+			goto out_request;
+		}
+
+		timeout = i915_wait_request(request[id],
+					    I915_WAIT_LOCKED,
+					    MAX_SCHEDULE_TIMEOUT);
+		if (timeout < 0) {
+			err = timeout;
+			pr_err("%s: error waiting for request on %s, err=%d\n",
+			       __func__, engine->name, err);
+			goto out_request;
+		}
+
+		GEM_BUG_ON(!i915_gem_request_completed(request[id]));
+	}
+
+	err = end_live_test(&t);
+
+out_request:
+	for_each_engine(engine, i915, id) {
+		u32 *cmd;
+
+		if (!request[id])
+			break;
+
+		cmd = i915_gem_object_pin_map(request[id]->batch->obj,
+					      I915_MAP_WC);
+		if (!IS_ERR(cmd)) {
+			*cmd = MI_BATCH_BUFFER_END;
+			wmb();
+			i915_gem_object_unpin_map(request[id]->batch->obj);
+		}
+
+		i915_vma_put(request[id]->batch);
+		i915_gem_request_put(request[id]);
+	}
+out_unlock:
+	mutex_unlock(&i915->drm.struct_mutex);
+	return err;
+}
+
 int i915_gem_request_live_selftests(struct drm_i915_private *i915)
 {
 	static const struct i915_subtest tests[] = {
 		SUBTEST(live_nop_request),
 		SUBTEST(live_all_engines),
+		SUBTEST(live_sequential_engines),
 	};
 	return i915_subtests(tests, i915);
 }
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2017-02-13 17:16 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-13 17:15 [CI 01/47] drm/i915: Provide a hook for selftests Chris Wilson
2017-02-13 17:15 ` [CI 02/47] drm/i915: Add some selftests for sg_table manipulation Chris Wilson
2017-02-13 17:15 ` [CI 03/47] drm/i915: Add unit tests for the breadcrumb rbtree, insert/remove Chris Wilson
2017-02-13 17:15 ` [CI 04/47] drm/i915: Add unit tests for the breadcrumb rbtree, completion Chris Wilson
2017-02-13 17:15 ` [CI 05/47] drm/i915: Add unit tests for the breadcrumb rbtree, wakeups Chris Wilson
2017-02-13 17:15 ` [CI 06/47] drm/i915: Mock the GEM device for self-testing Chris Wilson
2017-02-13 17:15 ` [CI 07/47] drm/i915: Mock a GGTT " Chris Wilson
2017-02-13 17:15 ` [CI 08/47] drm/i915: Mock infrastructure for request emission Chris Wilson
2017-02-13 17:15 ` [CI 09/47] drm/i915: Create a fake object for testing huge allocations Chris Wilson
2017-02-13 17:15 ` [CI 10/47] drm/i915: Add selftests for i915_gem_request Chris Wilson
2017-02-13 17:15 ` [CI 11/47] drm/i915: Add a simple request selftest for waiting Chris Wilson
2017-02-13 17:15 ` [CI 12/47] drm/i915: Add a simple fence selftest to i915_gem_request Chris Wilson
2017-02-13 17:15 ` [CI 13/47] drm/i915: Simple selftest to exercise live requests Chris Wilson
2017-02-13 17:15 ` [CI 14/47] drm/i915: Test simultaneously submitting requests to all engines Chris Wilson
2017-02-13 17:15 ` Chris Wilson [this message]
2017-02-13 17:15 ` [CI 16/47] drm/i915: Live testing of empty requests Chris Wilson
2017-02-13 17:15 ` [CI 17/47] drm/i915: Add selftests for object allocation, phys Chris Wilson
2017-02-13 17:15 ` [CI 18/47] drm/i915: Add a live seftest for GEM objects Chris Wilson
2017-02-13 17:15 ` [CI 19/47] drm/i915: Test partial mappings Chris Wilson
2017-02-13 17:15 ` [CI 20/47] drm/i915: Test exhaustion of the mmap space Chris Wilson
2017-02-13 17:15 ` [CI 21/47] drm/i915: Test coherency of and barriers between cache domains Chris Wilson
2017-02-13 17:15 ` [CI 22/47] drm/i915: Move uncore selfchecks to live selftest infrastructure Chris Wilson
2017-02-13 17:15 ` [CI 23/47] drm/i915: Test all fw tables during mock selftests Chris Wilson
2017-02-13 17:15 ` [CI 24/47] drm/i915: Sanity check all registers for matching fw domains Chris Wilson
2017-02-13 17:15 ` [CI 25/47] drm/i915: Add some mock tests for dmabuf interop Chris Wilson
2017-02-13 17:15 ` [CI 26/47] drm/i915: Add a live dmabuf selftest Chris Wilson
2017-02-13 17:15 ` [CI 27/47] drm/i915: Add initial selftests for i915_gem_gtt Chris Wilson
2017-02-13 17:15 ` [CI 28/47] drm/i915: Exercise filling the top/bottom portions of the ppgtt Chris Wilson
2017-02-13 17:15 ` [CI 29/47] drm/i915: Exercise filling the top/bottom portions of the global GTT Chris Wilson
2017-02-13 17:15 ` [CI 30/47] drm/i915: Fill different pages of the GTT Chris Wilson
2017-02-13 17:15 ` [CI 31/47] drm/i915: Exercise filling and removing random ranges from the live GTT Chris Wilson
2017-02-13 17:15 ` [CI 32/47] drm/i915: Live testing of lowlevel GTT operations Chris Wilson
2017-02-13 17:15 ` [CI 33/47] drm/i915: Use fault-injection to force the shrinker to run in live GTT tests Chris Wilson
2017-02-13 17:15 ` [CI 34/47] drm/i915: Test creation of VMA Chris Wilson
2017-02-13 17:15 ` [CI 35/47] drm/i915: Exercise i915_vma_pin/i915_vma_insert Chris Wilson
2017-02-13 17:15 ` [CI 36/47] drm/i915: Verify page layout for rotated VMA Chris Wilson
2017-02-13 17:15 ` [CI 37/47] drm/i915: Test creation of partial VMA Chris Wilson
2017-02-13 17:15 ` [CI 38/47] drm/i915: Live testing for context execution Chris Wilson
2017-02-13 17:15 ` [CI 39/47] drm/i915: Extract aliasing ppgtt setup Chris Wilson
2017-02-13 17:15 ` [CI 40/47] drm/i915: Force an aliasing_ppgtt test for context execution Chris Wilson
2017-02-13 17:15 ` [CI 41/47] drm/i915: Initial selftests for exercising eviction Chris Wilson
2017-02-13 17:15 ` [CI 42/47] drm/i915: Add mock exercise for i915_gem_gtt_reserve Chris Wilson
2017-02-13 17:15 ` [CI 43/47] drm/i915: Add mock exercise for i915_gem_gtt_insert Chris Wilson
2017-02-13 17:15 ` [CI 44/47] drm/i915: Add mock tests for GTT/VMA handling Chris Wilson
2017-02-13 17:15 ` [CI 45/47] drm/i915: Exercise manipulate of single pages in the GGTT Chris Wilson
2017-02-13 17:15 ` [CI 46/47] drm/i915: Exercise crossing pot boundaries in the GTT Chris Wilson
2017-02-13 17:15 ` [CI 47/47] drm/i915: Add initial selftests for hang detection and resets Chris Wilson
2017-02-13 17:52 ` ✓ Fi.CI.BAT: success for series starting with [CI,01/47] drm/i915: Provide a hook for selftests Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170213171558.20942-15-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.