Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Chris Wilson <chris.p.wilson@intel.com>,
	Chris Wilson <chris@chris-wilson.co.uk>
Subject: [igt-dev] [PATCH i-g-t 1/3] i915/gem_exec_schedule: Fix context creation for shared-vm
Date: Thu, 21 Apr 2022 08:09:53 +0200	[thread overview]
Message-ID: <20220421060955.21016-2-zbigniew.kempczynski@intel.com> (raw)
In-Reply-To: <20220421060955.21016-1-zbigniew.kempczynski@intel.com>

From: Chris Wilson <chris.p.wilson@intel.com>

submit_slice() is using a single address space for a couple of contexts
to prevent rebinding while active, and so requires that address space to
be shared during context construction.

v2: Add separate context for background spinner (Zbigniew)

Fixes: a9987a8dcb8f ("tests/i915/gem_exec_schedule: Convert to intel_ctx_t (v3)kkk")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>
---
 tests/i915/gem_exec_schedule.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/tests/i915/gem_exec_schedule.c b/tests/i915/gem_exec_schedule.c
index cf7e4d4eb3..caeac255de 100644
--- a/tests/i915/gem_exec_schedule.c
+++ b/tests/i915/gem_exec_schedule.c
@@ -818,8 +818,8 @@ static void submit_slice(int i915, const intel_ctx_cfg_t *cfg,
 	intel_ctx_cfg_t engine_cfg = {
 		.num_engines = 1,
 	};
-	const intel_ctx_t *ctx;
-	uint64_t ahnd0 = get_reloc_ahnd(i915, 0);
+	const intel_ctx_t *ctx, *bg_ctx;
+	uint64_t ahnd, bg_ahnd;
 
 	/*
 	 * When using a submit fence, we do not want to block concurrent work,
@@ -828,19 +828,25 @@ static void submit_slice(int i915, const intel_ctx_cfg_t *cfg,
 
 	igt_require(gem_scheduler_has_timeslicing(i915));
 	igt_require(intel_gen(intel_get_drm_devid(i915)) >= 8);
+	igt_require(gem_has_vm(i915));
+
+	engine_cfg.vm = gem_vm_create(i915);
+	ahnd = intel_allocator_open_vm(i915, engine_cfg.vm, INTEL_ALLOCATOR_RELOC);
+	bg_ctx = intel_ctx_create(i915, cfg);
+	bg_ahnd = get_reloc_ahnd(i915, bg_ctx->id);
 
 	for_each_ctx_cfg_engine(i915, cfg, cancel) {
 		igt_spin_t *bg, *spin;
 		int timeline = -1;
 		int fence = -1;
-		uint64_t ahndN;
 
 		if (!gem_class_can_store_dword(i915, cancel->class))
 			continue;
 
 		igt_debug("Testing cancellation from %s\n", e->name);
 
-		bg = igt_spin_new(i915, .ahnd = ahnd0, .engine = e->flags);
+		bg = igt_spin_new(i915, .ahnd = bg_ahnd, .ctx = bg_ctx,
+				  .engine = e->flags);
 
 		if (flags & LATE_SUBMIT) {
 			timeline = sw_sync_timeline_create();
@@ -850,8 +856,7 @@ static void submit_slice(int i915, const intel_ctx_cfg_t *cfg,
 		engine_cfg.engines[0].engine_class = e->class;
 		engine_cfg.engines[0].engine_instance = e->instance;
 		ctx = intel_ctx_create(i915, &engine_cfg);
-		ahndN = get_reloc_ahnd(i915, ctx->id);
-		spin = igt_spin_new(i915, .ahnd = ahndN, .ctx = ctx,
+		spin = igt_spin_new(i915, .ahnd = ahnd, .ctx = ctx,
 				    .fence = fence,
 				    .flags =
 				    IGT_SPIN_POLL_RUN |
@@ -880,10 +885,12 @@ static void submit_slice(int i915, const intel_ctx_cfg_t *cfg,
 		igt_spin_free(i915, bg);
 
 		intel_ctx_destroy(i915, ctx);
-		put_ahnd(ahndN);
 	}
 
-	put_ahnd(ahnd0);
+	gem_vm_destroy(i915, engine_cfg.vm);
+	intel_ctx_destroy(i915, bg_ctx);
+	put_ahnd(bg_ahnd);
+	put_ahnd(ahnd);
 }
 
 static uint32_t __batch_create(int i915, uint32_t offset)
-- 
2.32.0

  reply	other threads:[~2022-04-21  6:10 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-21  6:09 [igt-dev] [PATCH i-g-t 0/3] Fix couple of gem_exec_schedule subtests Zbigniew Kempczyński
2022-04-21  6:09 ` Zbigniew Kempczyński [this message]
2022-04-21 19:46   ` [igt-dev] [PATCH i-g-t 1/3] i915/gem_exec_schedule: Fix context creation for shared-vm Kamil Konieczny
2022-04-21  6:09 ` [igt-dev] [PATCH i-g-t 2/3] tests/i915/gem_exec_schedule: Don't use default context Zbigniew Kempczyński
2022-04-21 19:51   ` Kamil Konieczny
2022-04-22  6:12     ` Zbigniew Kempczyński
2022-04-22 10:27       ` Kamil Konieczny
2022-04-21  6:09 ` [igt-dev] [PATCH i-g-t 3/3] tests/i915/gem_exec_schedule: Use separate context for spinner Zbigniew Kempczyński
2022-04-21 20:00   ` Kamil Konieczny
2022-04-21  6:33 ` [igt-dev] ✗ GitLab.Pipeline: warning for Fix couple of gem_exec_schedule subtests Patchwork
2022-04-21  7:01 ` [igt-dev] ✗ Fi.CI.BAT: failure " Patchwork
2022-04-21  9:03 ` [igt-dev] ✓ Fi.CI.BAT: success for Fix couple of gem_exec_schedule subtests (rev2) Patchwork
2022-04-21 11:10 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2022-04-21 11:13   ` Zbigniew Kempczyński
2022-04-22 10:29   ` Zbigniew Kempczyński
2022-04-25 15:15     ` Vudum, Lakshminarayana
2022-04-25 15:37 ` [igt-dev] ✓ Fi.CI.IGT: success " 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=20220421060955.21016-2-zbigniew.kempczynski@intel.com \
    --to=zbigniew.kempczynski@intel.com \
    --cc=chris.p.wilson@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=igt-dev@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox