[igt-dev] [PATCH i-g-t 5/9] tests/gem_exec_schedule: Use store_dword_plug again (v2)

Jason Ekstrand jason at jlekstrand.net
Wed Jul 14 17:31:37 UTC 2021


From: Daniel Vetter <daniel.vetter at ffwll.ch>

In

commit 2884f91dd6d7682ea738ef6f0943cc591643dda2
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Jul 20 12:29:30 2018 +0100

    igt/gem_exec_schedule: Trim deep runtime

this was open-coded, I guess to avoid having to allocate a ton of
batchbuffers. Unfortunately this relies on being able to rewrite
batchbuffer relocations while the batch is in-flight (otherwise
everything stalls and our setup is for nothing), and we're removing
gpu relocations from upstream.

This problem was realized for the testcase in general in

commit f1e62e330a6e2de7b3cbf7cf02d71ae00cc6adcc
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue May 26 15:22:38 2020 +0100

    i915/gem_exec_schedule: Reduce relocation risk for store-dword

but the fix in there is only stochastic, there's still a chance of
failure and hence unsightly noise in CI. The proper fix is to use
softpin for this testcase unconditionally (not just when relocations
aren't available), so that we clearly disentangle the concerns here
and really only test the scheduler. And not some legacy features that
are on the way out to their deserved retirement like relocations.

Zbyscek and Ashotush cc'ed so they're aware that this testcase must be
switched over to softping uncondtionally, for correctness reasons.

But that's a pile more work, so as an interim solution go back to
__store_dword helper.

v2 (Jason Ekstrand):
 - Rebase on intel_ctx_t changes

Cc: Jason Ekstrand <jason at jlekstrand.net>
Cc: Dixit Ashutosh <ashutosh.dixit at intel.com>
Cc: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
Cc: Dave Airlie <airlied at redhat.com>
Cc: Lakshminarayana Vudum <lakshminarayana.vudum at intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
---
 tests/i915/gem_exec_schedule.c | 52 +++-------------------------------
 1 file changed, 4 insertions(+), 48 deletions(-)

diff --git a/tests/i915/gem_exec_schedule.c b/tests/i915/gem_exec_schedule.c
index a75faeb68..e5fb45982 100644
--- a/tests/i915/gem_exec_schedule.c
+++ b/tests/i915/gem_exec_schedule.c
@@ -1870,55 +1870,11 @@ static void deep(int fd, const intel_ctx_cfg_t *cfg,
 
 	/* Create a deep dependency chain, with a few branches */
 	for (n = 0; n < nreq && igt_seconds_elapsed(&tv) < 2; n++) {
-		const unsigned int gen = intel_gen(intel_get_drm_devid(fd));
-		struct drm_i915_gem_exec_object2 obj[3];
-		struct drm_i915_gem_relocation_entry reloc;
-		struct drm_i915_gem_execbuffer2 eb = {
-			.buffers_ptr = to_user_pointer(obj),
-			.buffer_count = 3,
-			.flags = ring | (gen < 6 ? I915_EXEC_SECURE : 0),
-			.rsvd1 = ctx[n % MAX_CONTEXTS]->id,
-		};
-		uint32_t batch[16];
-		int i;
-
-		memset(obj, 0, sizeof(obj));
-		obj[0].handle = plug;
-
-		memset(&reloc, 0, sizeof(reloc));
-		reloc.presumed_offset = 0;
-		reloc.offset = sizeof(uint32_t);
-		reloc.delta = sizeof(uint32_t) * n;
-		reloc.read_domains = I915_GEM_DOMAIN_RENDER;
-		reloc.write_domain = I915_GEM_DOMAIN_RENDER;
-		obj[2].handle = gem_create(fd, 4096);
-		obj[2].relocs_ptr = to_user_pointer(&reloc);
-		obj[2].relocation_count = 1;
-
-		i = 0;
-		batch[i] = MI_STORE_DWORD_IMM | (gen < 6 ? 1 << 22 : 0);
-		if (gen >= 8) {
-			batch[++i] = reloc.delta;
-			batch[++i] = 0;
-		} else if (gen >= 4) {
-			batch[++i] = 0;
-			batch[++i] = reloc.delta;
-			reloc.offset += sizeof(uint32_t);
-		} else {
-			batch[i]--;
-			batch[++i] = reloc.delta;
-		}
-		batch[++i] = eb.rsvd1;
-		batch[++i] = MI_BATCH_BUFFER_END;
-		gem_write(fd, obj[2].handle, 0, batch, sizeof(batch));
+		const intel_ctx_t *context = ctx[n % MAX_CONTEXTS];
+		gem_context_set_priority(fd, context->id, MAX_PRIO - nreq + n);
 
-		gem_context_set_priority(fd, eb.rsvd1, MAX_PRIO - nreq + n);
-		for (int m = 0; m < XS; m++) {
-			obj[1].handle = dep[m];
-			reloc.target_handle = obj[1].handle;
-			gem_execbuf(fd, &eb);
-		}
-		gem_close(fd, obj[2].handle);
+		for (int m = 0; m < XS; m++)
+			store_dword_plug(fd, context, ring, dep[m], 4*n, context->id, plug, I915_GEM_DOMAIN_INSTRUCTION);
 	}
 	igt_info("First deptree: %d requests [%.3fs]\n",
 		 n * XS, 1e-9*igt_nsec_elapsed(&tv));
-- 
2.31.1



More information about the igt-dev mailing list