All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Petri Latvala <petri.latvala@intel.com>
Subject: [igt-dev] [PATCH i-g-t 16/50] tests/gem_exec_async: Adopt to use allocator
Date: Thu, 22 Jul 2021 10:32:06 +0200	[thread overview]
Message-ID: <20210722083240.33453-17-zbigniew.kempczynski@intel.com> (raw)
In-Reply-To: <20210722083240.33453-1-zbigniew.kempczynski@intel.com>

For newer gens we're not able to rely on relocations. Adopt to use
offsets acquired from the allocator.

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Petri Latvala <petri.latvala@intel.com>
Cc: Ashutosh Dixit <ashutosh.dixit@intel.com>
---
 tests/i915/gem_exec_async.c | 57 ++++++++++++++++++++++++++++++-------
 1 file changed, 46 insertions(+), 11 deletions(-)

diff --git a/tests/i915/gem_exec_async.c b/tests/i915/gem_exec_async.c
index a3be6b3ee..41f3b752b 100644
--- a/tests/i915/gem_exec_async.c
+++ b/tests/i915/gem_exec_async.c
@@ -27,8 +27,11 @@
 
 IGT_TEST_DESCRIPTION("Check that we can issue concurrent writes across the engines.");
 
-static void store_dword(int fd, const intel_ctx_t *ctx, unsigned ring,
-			uint32_t target, uint32_t offset, uint32_t value)
+#define SZ_1M (1024 * 1024)
+
+static void store_dword(int fd, int id, const intel_ctx_t *ctx,
+			 unsigned ring, uint32_t target, uint64_t target_offset,
+			 uint32_t offset, uint32_t value)
 {
 	const unsigned int gen = intel_gen(intel_get_drm_devid(fd));
 	struct drm_i915_gem_exec_object2 obj[2];
@@ -50,6 +53,15 @@ static void store_dword(int fd, const intel_ctx_t *ctx, unsigned ring,
 	obj[0].flags = EXEC_OBJECT_ASYNC;
 	obj[1].handle = gem_create(fd, 4096);
 
+	if (id) {
+		obj[0].offset = target_offset;
+		obj[0].flags |= EXEC_OBJECT_PINNED | EXEC_OBJECT_WRITE |
+				EXEC_OBJECT_SUPPORTS_48B_ADDRESS;
+		obj[1].offset = (id + 1) * SZ_1M;
+		obj[1].flags |= EXEC_OBJECT_PINNED |
+				EXEC_OBJECT_SUPPORTS_48B_ADDRESS;
+	}
+
 	memset(&reloc, 0, sizeof(reloc));
 	reloc.target_handle = obj[0].handle;
 	reloc.presumed_offset = 0;
@@ -58,13 +70,13 @@ static void store_dword(int fd, const intel_ctx_t *ctx, unsigned ring,
 	reloc.read_domains = I915_GEM_DOMAIN_INSTRUCTION;
 	reloc.write_domain = I915_GEM_DOMAIN_INSTRUCTION;
 	obj[1].relocs_ptr = to_user_pointer(&reloc);
-	obj[1].relocation_count = 1;
+	obj[1].relocation_count = !id ? 1 : 0;
 
 	i = 0;
 	batch[i] = MI_STORE_DWORD_IMM | (gen < 6 ? 1 << 22 : 0);
 	if (gen >= 8) {
-		batch[++i] = offset;
-		batch[++i] = 0;
+		batch[++i] = target_offset + offset;
+		batch[++i] = (target_offset + offset) >> 32;
 	} else if (gen >= 4) {
 		batch[++i] = 0;
 		batch[++i] = offset;
@@ -89,6 +101,8 @@ static void one(int fd, const intel_ctx_t *ctx,
 	uint32_t scratch = gem_create(fd, 4096);
 	igt_spin_t *spin;
 	uint32_t *result;
+	uint64_t ahnd = get_simple_l2h_ahnd(fd, ctx->id);
+	uint64_t scratch_offset = get_offset(ahnd, scratch, 4096, 0);
 	int i;
 
 	/*
@@ -96,11 +110,16 @@ static void one(int fd, const intel_ctx_t *ctx,
 	 * the scratch for write. Then on the other rings try and
 	 * write into that target. If it blocks we hang the GPU...
 	 */
-	spin = igt_spin_new(fd, .ctx = ctx, .engine = engine,
+	spin = igt_spin_new(fd,
+			    .ahnd = ahnd,
+			    .ctx = ctx,
+			    .engine = engine,
 			    .dependency = scratch);
 
 	i = 0;
 	for_each_ctx_engine(fd, ctx, e) {
+		int id = ahnd ? (i + 1) : 0;
+
 		if (e->flags == engine)
 			continue;
 
@@ -108,10 +127,15 @@ static void one(int fd, const intel_ctx_t *ctx,
 			continue;
 
 		if (flags & FORKED) {
-			igt_fork(child, 1)
-				store_dword(fd, ctx, e->flags, scratch, 4*i, ~i);
+			igt_fork(child, 1) {
+				store_dword(fd, id, ctx, e->flags,
+					    scratch, scratch_offset,
+					    4*i, ~i);
+			}
 		} else {
-			store_dword(fd, ctx, e->flags, scratch, 4*i, ~i);
+			store_dword(fd, id, ctx, e->flags,
+				    scratch, scratch_offset,
+				    4*i, ~i);
 		}
 		i++;
 	}
@@ -124,6 +148,7 @@ static void one(int fd, const intel_ctx_t *ctx,
 
 	igt_spin_free(fd, spin);
 	gem_close(fd, scratch);
+	put_ahnd(ahnd);
 }
 
 static bool has_async_execbuf(int fd)
@@ -162,8 +187,18 @@ igt_main
 	test_each_engine("concurrent-writes", fd, ctx, e)
 		one(fd, ctx, e->flags, 0);
 
-	test_each_engine("forked-writes", fd, ctx, e)
-		one(fd, ctx, e->flags, FORKED);
+	igt_subtest_group {
+		igt_fixture {
+			intel_allocator_multiprocess_start();
+		}
+
+		test_each_engine("forked-writes", fd, ctx, e)
+			one(fd, ctx, e->flags, FORKED);
+
+		igt_fixture {
+			intel_allocator_multiprocess_stop();
+		}
+	}
 
 	igt_fixture {
 		igt_stop_hang_detector();
-- 
2.26.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2021-07-22  8:33 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-22  8:31 [igt-dev] [PATCH i-g-t 00/50] Add allocator support in IGT Zbigniew Kempczyński
2021-07-22  8:31 ` [igt-dev] [PATCH i-g-t 01/50] lib/igt_dummyload: Add support of using allocator in igt spinner Zbigniew Kempczyński
2021-07-22  8:31 ` [igt-dev] [PATCH i-g-t 02/50] lib/intel_allocator: Add few helper functions for common use Zbigniew Kempczyński
2021-07-22  8:31 ` [igt-dev] [PATCH i-g-t 03/50] lib/igt_gt: Add passing ahnd as an argument to igt_hang Zbigniew Kempczyński
2021-07-22  8:31 ` [igt-dev] [PATCH i-g-t 04/50] lib/intel_batchbuffer: Add allocator support in blitter fast copy Zbigniew Kempczyński
2021-07-22  8:31 ` [igt-dev] [PATCH i-g-t 05/50] lib/intel_batchbuffer: Add allocator support in blitter src copy Zbigniew Kempczyński
2021-07-22  8:31 ` [igt-dev] [PATCH i-g-t 06/50] lib/huc_copy: Extend huc copy prototype to pass allocator handle Zbigniew Kempczyński
2021-07-22  8:31 ` [igt-dev] [PATCH i-g-t 07/50] tests/gem_bad_reloc: Skip on gens where relocations are not supported Zbigniew Kempczyński
2021-07-22  8:31 ` [igt-dev] [PATCH i-g-t 08/50] tests/gem_busy: Adopt to use allocator Zbigniew Kempczyński
2021-07-22  8:31 ` [igt-dev] [PATCH i-g-t 09/50] tests/gem_create: " Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 10/50] tests/gem_ctx_engines: " Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 11/50] tests/gem_ctx_exec: " Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 12/50] tests/gem_ctx_freq: " Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 13/50] tests/gem_ctx_isolation: " Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 14/50] tests/gem_ctx_param: " Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 15/50] tests/gem_eio: " Zbigniew Kempczyński
2021-07-22  8:32 ` Zbigniew Kempczyński [this message]
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 17/50] tests/gem_exec_big: Require relocation support Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 18/50] tests/gem_exec_capture: Support gens without relocations Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 19/50] tests/gem_exec_gttfill: Require relocation support Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 20/50] tests/gem_exec_store: Support gens without relocations Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 21/50] tests/gem_exec_suspend: Adopt to use allocator Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 22/50] tests/gem_exec_parallel: Adopt to use alloctor Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 23/50] tests/gem_exec_params: Support gens without relocations Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 24/50] tests/gem_mmap: Add allocator support Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 25/50] tests/gem_mmap_gtt: " Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 26/50] tests/gem_mmap_offset: " Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 27/50] tests/gem_mmap_wc: Adopt to use allocator Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 28/50] tests/gem_request_retire: Add allocator support Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 29/50] tests/gem_ringfill: Adopt to use allocator Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 30/50] tests/gem_softpin: Exercise eviction with softpinning Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 31/50] tests/gem_spin_batch: Adopt to use allocator Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 32/50] tests/gem_tiled_fence_blits: " Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 33/50] tests/gem_unfence_active_buffers: " Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 34/50] tests/gem_unref_active_buffers: " Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 35/50] tests/gem_wait: " Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 36/50] tests/gem_watchdog: Adopt to use no-reloc Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 37/50] tests/gem_workarounds: Adopt to use allocator Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 38/50] tests/i915_hangman: " Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 39/50] tests/i915_module_load: " Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 40/50] tests/i915_pm_rc6_residency: " Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 41/50] tests/i915_pm_rpm: Adopt to use no-reloc Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 42/50] tests/i915_pm_rps: Alter " Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 43/50] tests/kms_busy: Adopt to use allocator Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 44/50] tests/kms_cursor_legacy: " Zbigniew Kempczyński
2021-07-23 14:26   ` Rodrigo Siqueira
2021-07-30  4:04     ` Zbigniew Kempczyński
2021-08-03 15:05       ` Rodrigo Siqueira
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 45/50] tests/kms_flip: " Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 46/50] tests/kms_vblank: " Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 47/50] tests/perf_pmu: " Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 48/50] tests/sysfs_heartbeat_interval: " Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 49/50] tests/sysfs_preempt_timeout: " Zbigniew Kempczyński
2021-07-22  8:32 ` [igt-dev] [PATCH i-g-t 50/50] tests/sysfs_timeslice_duration: " Zbigniew Kempczyński
2021-07-22  9:50 ` [igt-dev] ✗ Fi.CI.BAT: failure for Add allocator support in IGT Patchwork
2021-07-26 17:37 ` [igt-dev] [PATCH i-g-t 00/50] " Rodrigo Siqueira
2021-07-30  4:07   ` Zbigniew Kempczyński
2021-08-03 15:09     ` Rodrigo Siqueira

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=20210722083240.33453-17-zbigniew.kempczynski@intel.com \
    --to=zbigniew.kempczynski@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=petri.latvala@intel.com \
    /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.