All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Cc: igt-dev@lists.freedesktop.org, Chris Wilson <chris@chris-wilson.co.uk>
Subject: [Intel-gfx] [PATCH i-g-t] i915/gem_ctx_persistence: Check for accidental banning
Date: Thu, 21 Jan 2021 10:50:05 +0000	[thread overview]
Message-ID: <20210121105005.963616-1-chris@chris-wilson.co.uk> (raw)

Check that closing many contexts does not cause a ban.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/i915/gem_ctx_persistence.c | 48 ++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/tests/i915/gem_ctx_persistence.c b/tests/i915/gem_ctx_persistence.c
index 1b7d18525..b51a9fcc7 100644
--- a/tests/i915/gem_ctx_persistence.c
+++ b/tests/i915/gem_ctx_persistence.c
@@ -1065,6 +1065,51 @@ static void smoketest(int i915)
 	gem_quiescent_gpu(i915);
 }
 
+static void many_contexts(int i915)
+{
+	const struct intel_execution_engine2 *e;
+	igt_spin_t *spin;
+
+	cleanup(i915);
+
+	/*
+	 * Perform many peristent kills from the same client. These should not
+	 * cause the client to be banned, which in turn prevents us from
+	 * creating new contexts, and submitting new execbuf.
+	 */
+
+	spin = igt_spin_new(i915, .flags = IGT_SPIN_NO_PREEMPTION);
+	igt_spin_end(spin);
+
+	igt_until_timeout(30) {
+		__for_each_physical_engine(i915, e) {
+			int64_t timeout = NSEC_PER_SEC;
+			uint32_t ctx;
+
+			ctx = gem_context_clone_with_engines(i915, 0);
+			gem_context_set_persistence(i915, ctx, false);
+
+			igt_spin_reset(spin);
+			spin->execbuf.rsvd1 = ctx;
+			spin->execbuf.flags &= ~63;
+			spin->execbuf.flags |= e->flags;
+			gem_execbuf(i915, &spin->execbuf);
+			gem_context_destroy(i915, ctx);
+
+			igt_assert_eq(gem_wait(i915, spin->handle, &timeout), 0);
+		}
+	}
+
+	/* And check we can still submit to the default context -- no bans! */
+	igt_spin_reset(spin);
+	spin->execbuf.rsvd1 = 0;
+	spin->execbuf.flags &= ~63;
+	gem_execbuf(i915, &spin->execbuf);
+
+	igt_spin_free(i915, spin);
+	gem_quiescent_gpu(i915);
+}
+
 static void replace_engines(int i915, const struct intel_execution_engine2 *e)
 {
 	I915_DEFINE_CONTEXT_PARAM_ENGINES(engines, 1) = {
@@ -1398,6 +1443,9 @@ igt_main
 			}
 		}
 
+		igt_subtest("many-contexts")
+			many_contexts(i915);
+
 		igt_subtest("smoketest")
 			smoketest(i915);
 	}
-- 
2.30.0

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

WARNING: multiple messages have this Message-ID (diff)
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Cc: igt-dev@lists.freedesktop.org, Chris Wilson <chris@chris-wilson.co.uk>
Subject: [igt-dev] [PATCH i-g-t] i915/gem_ctx_persistence: Check for accidental banning
Date: Thu, 21 Jan 2021 10:50:05 +0000	[thread overview]
Message-ID: <20210121105005.963616-1-chris@chris-wilson.co.uk> (raw)

Check that closing many contexts does not cause a ban.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/i915/gem_ctx_persistence.c | 48 ++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/tests/i915/gem_ctx_persistence.c b/tests/i915/gem_ctx_persistence.c
index 1b7d18525..b51a9fcc7 100644
--- a/tests/i915/gem_ctx_persistence.c
+++ b/tests/i915/gem_ctx_persistence.c
@@ -1065,6 +1065,51 @@ static void smoketest(int i915)
 	gem_quiescent_gpu(i915);
 }
 
+static void many_contexts(int i915)
+{
+	const struct intel_execution_engine2 *e;
+	igt_spin_t *spin;
+
+	cleanup(i915);
+
+	/*
+	 * Perform many peristent kills from the same client. These should not
+	 * cause the client to be banned, which in turn prevents us from
+	 * creating new contexts, and submitting new execbuf.
+	 */
+
+	spin = igt_spin_new(i915, .flags = IGT_SPIN_NO_PREEMPTION);
+	igt_spin_end(spin);
+
+	igt_until_timeout(30) {
+		__for_each_physical_engine(i915, e) {
+			int64_t timeout = NSEC_PER_SEC;
+			uint32_t ctx;
+
+			ctx = gem_context_clone_with_engines(i915, 0);
+			gem_context_set_persistence(i915, ctx, false);
+
+			igt_spin_reset(spin);
+			spin->execbuf.rsvd1 = ctx;
+			spin->execbuf.flags &= ~63;
+			spin->execbuf.flags |= e->flags;
+			gem_execbuf(i915, &spin->execbuf);
+			gem_context_destroy(i915, ctx);
+
+			igt_assert_eq(gem_wait(i915, spin->handle, &timeout), 0);
+		}
+	}
+
+	/* And check we can still submit to the default context -- no bans! */
+	igt_spin_reset(spin);
+	spin->execbuf.rsvd1 = 0;
+	spin->execbuf.flags &= ~63;
+	gem_execbuf(i915, &spin->execbuf);
+
+	igt_spin_free(i915, spin);
+	gem_quiescent_gpu(i915);
+}
+
 static void replace_engines(int i915, const struct intel_execution_engine2 *e)
 {
 	I915_DEFINE_CONTEXT_PARAM_ENGINES(engines, 1) = {
@@ -1398,6 +1443,9 @@ igt_main
 			}
 		}
 
+		igt_subtest("many-contexts")
+			many_contexts(i915);
+
 		igt_subtest("smoketest")
 			smoketest(i915);
 	}
-- 
2.30.0

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

             reply	other threads:[~2021-01-21 10:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-21 10:50 Chris Wilson [this message]
2021-01-21 10:50 ` [igt-dev] [PATCH i-g-t] i915/gem_ctx_persistence: Check for accidental banning Chris Wilson
2021-01-21 11:29 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2021-01-21 12:37 ` [igt-dev] ✗ Fi.CI.IGT: failure " 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=20210121105005.963616-1-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=igt-dev@lists.freedesktop.org \
    --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.