All of lore.kernel.org
 help / color / mirror / Atom feed
From: Antonio Argenziano <antonio.argenziano@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH i-g-t v2 2/2] tests/gem_reset_stats: Add client ban test
Date: Fri, 13 Oct 2017 13:49:29 -0700	[thread overview]
Message-ID: <20171013204929.1748-2-antonio.argenziano@intel.com> (raw)
In-Reply-To: <20171013204929.1748-1-antonio.argenziano@intel.com>

A client that submits 'bad' contexts will be banned eventually while
other clients are not affected. Add a test for this.

v2
	- Do not use a fixed number of contexts to ban client (Chris)

Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com>

Cc: Michel Thierry <michel.thierry@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/gem_reset_stats.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/tests/gem_reset_stats.c b/tests/gem_reset_stats.c
index edc40767..da309237 100644
--- a/tests/gem_reset_stats.c
+++ b/tests/gem_reset_stats.c
@@ -438,6 +438,61 @@ static void test_ban_ctx(const struct intel_execution_engine *e)
 	close(fd);
 }
 
+static void test_client_ban(const struct intel_execution_engine *e)
+{
+	int fd_bad,fd_good;
+	struct local_drm_i915_reset_stats rs_bad, rs_good;
+	int ban, ctx_bans_retry = 10;
+	int client_ban, client_bans_retry = 10;
+	uint32_t ctx_bad;
+	uint32_t test_ctx;
+	int active_count = 0;
+
+	fd_bad = drm_open_driver(DRIVER_INTEL);
+	fd_good = drm_open_driver(DRIVER_INTEL);
+
+	assert_reset_status(fd_bad, fd_bad, 0, RS_NO_ERROR);
+	assert_reset_status(fd_good, fd_good, 0, RS_NO_ERROR);
+
+	while (client_bans_retry--) {
+		client_ban = __gem_context_create(fd_bad, &ctx_bad);
+		if (client_ban == -EIO)
+			break;
+
+		noop(fd_bad, ctx_bad, e);
+		assert_reset_status(fd_bad, fd_bad, ctx_bad, RS_NO_ERROR);
+
+		ctx_bans_retry = 10;
+		active_count = 0;
+		while (ctx_bans_retry--) {
+			inject_hang(fd_bad, ctx_bad, e, BAN);
+			active_count++;
+
+			ban = noop(fd_bad, ctx_bad, e);
+			if (ban == -EIO)
+				break;
+		}
+
+		igt_assert_eq(ban, -EIO);
+
+		assert_reset_status(fd_bad, fd_bad, ctx_bad, RS_BATCH_ACTIVE);
+		igt_assert_eq(gem_reset_stats(fd_bad, ctx_bad, &rs_bad), 0);
+		igt_assert_eq(rs_bad.batch_active, active_count);
+
+		igt_debug("retrying for client ban (%d)\n", client_bans_retry);
+	}
+
+	igt_assert_eq(__gem_context_create(fd_bad, &test_ctx), -EIO);
+
+	igt_assert_lt(0, noop(fd_good, 0, e));
+	assert_reset_status(fd_good, fd_good, 0, RS_NO_ERROR);
+	igt_assert_eq(gem_reset_stats(fd_good, 0, &rs_good), 0);
+	igt_assert_eq(rs_good.batch_active, 0);
+
+	close(fd_bad);
+	close(fd_good);
+}
+
 static void test_unrelated_ctx(const struct intel_execution_engine *e)
 {
 	int fd1,fd2;
@@ -817,6 +872,9 @@ igt_main
 		igt_subtest_f("ban-ctx-%s", e->name)
 			RUN_CTX_TEST(test_ban_ctx(e));
 
+		igt_subtest_f("ban-client-%s", e->name)
+			RUN_CTX_TEST(test_client_ban(e));
+
 		igt_subtest_f("reset-count-%s", e->name)
 			RUN_TEST(test_reset_count(e, false));
 
-- 
2.14.1

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

  reply	other threads:[~2017-10-13 20:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-13 20:49 [PATCH i-g-t v2 1/2] lib: Move __gem_context_create to common ioctl wrapper library Antonio Argenziano
2017-10-13 20:49 ` Antonio Argenziano [this message]
2017-10-13 21:23   ` [PATCH i-g-t v2 2/2] tests/gem_reset_stats: Add client ban test Chris Wilson
2017-10-13 20:56 ` [PATCH i-g-t v2 1/2] lib: Move __gem_context_create to common ioctl wrapper library Chris Wilson
2017-10-13 21:49 ` ✗ Fi.CI.BAT: failure for series starting with [v2,1/2] " 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=20171013204929.1748-2-antonio.argenziano@intel.com \
    --to=antonio.argenziano@intel.com \
    --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.