All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tursulin@ursulin.net>
To: igt-dev@lists.freedesktop.org
Cc: Intel-gfx@lists.freedesktop.org
Subject: [PATCH i-g-t v3] tests/perf_pmu: Test busyness reporting in face of GPU hangs
Date: Thu,  1 Mar 2018 09:38:46 +0000	[thread overview]
Message-ID: <20180301093846.23154-1-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <151989642449.32001.12793046046680965046@mail.alporthouse.com>

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Verify that the reported busyness is in line with what would we expect
from a batch which causes a hang and gets kicked out from the engine.

v2: Change to explicit igt_force_gpu_reset instead of guessing when a spin
    batch will hang. (Chris Wilson)

v3: Assert and comment test expectations. (Chris Wilson)

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/perf_pmu.c | 32 ++++++++++++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)

diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c
index 3bbb18d2f216..4713c98c5d22 100644
--- a/tests/perf_pmu.c
+++ b/tests/perf_pmu.c
@@ -168,6 +168,7 @@ static unsigned int e2ring(int gem_fd, const struct intel_execution_engine2 *e)
 #define TEST_TRAILING_IDLE (4)
 #define TEST_RUNTIME_PM (8)
 #define FLAG_LONG (16)
+#define FLAG_HANG (32)
 
 static void end_spin(int fd, igt_spin_t *spin, unsigned int flags)
 {
@@ -204,11 +205,35 @@ single(int gem_fd, const struct intel_execution_engine2 *e, unsigned int flags)
 		end_spin(gem_fd, spin, flags);
 	val = pmu_read_single(fd) - val;
 
-	end_spin(gem_fd, spin, FLAG_SYNC);
+	if (flags & FLAG_HANG)
+		igt_force_gpu_reset(gem_fd);
+	else
+		end_spin(gem_fd, spin, FLAG_SYNC);
+
+	assert_within_epsilon(val, flags & TEST_BUSY ? slept : 0.f, tolerance);
+
+	/* Check for idle after hang. */
+	if (flags & FLAG_HANG) {
+		/* Sleep for a bit for reset unwind to settle. */
+		usleep(500e3);
+		/*
+		 * Ensure batch was executing before reset, meaning it must be
+		 * idle by now. Unless it did not even manage to start before we
+		 * triggered the reset, in which case the idleness check below
+		 * might fail. The latter is very unlikely since there are two
+		 * sleeps during which it had an opportunity to start.
+		 */
+		igt_assert(!gem_bo_busy(gem_fd, spin->handle));
+		val = pmu_read_single(fd);
+		slept = measured_usleep(batch_duration_ns / 1000);
+		val = pmu_read_single(fd) - val;
+
+		assert_within_epsilon(val, 0, tolerance);
+	}
+
 	igt_spin_batch_free(gem_fd, spin);
 	close(fd);
 
-	assert_within_epsilon(val, flags & TEST_BUSY ? slept : 0.f, tolerance);
 	gem_quiescent_gpu(gem_fd);
 }
 
@@ -1690,6 +1715,9 @@ igt_main
 					      pct[i], e->name)
 					accuracy(fd, e, pct[i]);
 			}
+
+			igt_subtest_f("busy-hang-%s", e->name)
+				single(fd, e, TEST_BUSY | FLAG_HANG);
 		}
 
 		/**
-- 
2.14.1

_______________________________________________
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: Tvrtko Ursulin <tursulin@ursulin.net>
To: igt-dev@lists.freedesktop.org
Cc: Intel-gfx@lists.freedesktop.org,
	Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Subject: [igt-dev] [PATCH i-g-t v3] tests/perf_pmu: Test busyness reporting in face of GPU hangs
Date: Thu,  1 Mar 2018 09:38:46 +0000	[thread overview]
Message-ID: <20180301093846.23154-1-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <151989642449.32001.12793046046680965046@mail.alporthouse.com>

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Verify that the reported busyness is in line with what would we expect
from a batch which causes a hang and gets kicked out from the engine.

v2: Change to explicit igt_force_gpu_reset instead of guessing when a spin
    batch will hang. (Chris Wilson)

v3: Assert and comment test expectations. (Chris Wilson)

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/perf_pmu.c | 32 ++++++++++++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)

diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c
index 3bbb18d2f216..4713c98c5d22 100644
--- a/tests/perf_pmu.c
+++ b/tests/perf_pmu.c
@@ -168,6 +168,7 @@ static unsigned int e2ring(int gem_fd, const struct intel_execution_engine2 *e)
 #define TEST_TRAILING_IDLE (4)
 #define TEST_RUNTIME_PM (8)
 #define FLAG_LONG (16)
+#define FLAG_HANG (32)
 
 static void end_spin(int fd, igt_spin_t *spin, unsigned int flags)
 {
@@ -204,11 +205,35 @@ single(int gem_fd, const struct intel_execution_engine2 *e, unsigned int flags)
 		end_spin(gem_fd, spin, flags);
 	val = pmu_read_single(fd) - val;
 
-	end_spin(gem_fd, spin, FLAG_SYNC);
+	if (flags & FLAG_HANG)
+		igt_force_gpu_reset(gem_fd);
+	else
+		end_spin(gem_fd, spin, FLAG_SYNC);
+
+	assert_within_epsilon(val, flags & TEST_BUSY ? slept : 0.f, tolerance);
+
+	/* Check for idle after hang. */
+	if (flags & FLAG_HANG) {
+		/* Sleep for a bit for reset unwind to settle. */
+		usleep(500e3);
+		/*
+		 * Ensure batch was executing before reset, meaning it must be
+		 * idle by now. Unless it did not even manage to start before we
+		 * triggered the reset, in which case the idleness check below
+		 * might fail. The latter is very unlikely since there are two
+		 * sleeps during which it had an opportunity to start.
+		 */
+		igt_assert(!gem_bo_busy(gem_fd, spin->handle));
+		val = pmu_read_single(fd);
+		slept = measured_usleep(batch_duration_ns / 1000);
+		val = pmu_read_single(fd) - val;
+
+		assert_within_epsilon(val, 0, tolerance);
+	}
+
 	igt_spin_batch_free(gem_fd, spin);
 	close(fd);
 
-	assert_within_epsilon(val, flags & TEST_BUSY ? slept : 0.f, tolerance);
 	gem_quiescent_gpu(gem_fd);
 }
 
@@ -1690,6 +1715,9 @@ igt_main
 					      pct[i], e->name)
 					accuracy(fd, e, pct[i]);
 			}
+
+			igt_subtest_f("busy-hang-%s", e->name)
+				single(fd, e, TEST_BUSY | FLAG_HANG);
 		}
 
 		/**
-- 
2.14.1

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

  reply	other threads:[~2018-03-01  9:38 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-19 19:12 [PATCH i-g-t] tests/perf_pmu: Test busyness reporting in face of GPU hangs Tvrtko Ursulin
2018-02-19 19:12 ` [Intel-gfx] " Tvrtko Ursulin
2018-02-19 19:21 ` [igt-dev] " Chris Wilson
2018-02-19 19:21   ` Chris Wilson
2018-02-19 19:26   ` Tvrtko Ursulin
2018-02-19 19:26     ` [igt-dev] [Intel-gfx] " Tvrtko Ursulin
2018-02-28 17:15   ` [PATCH i-g-t v2] " Tvrtko Ursulin
2018-02-28 17:15     ` [Intel-gfx] " Tvrtko Ursulin
2018-03-01  8:08     ` Chris Wilson
2018-03-01  8:08       ` [Intel-gfx] " Chris Wilson
2018-03-01  9:21       ` Tvrtko Ursulin
2018-03-01  9:21         ` [igt-dev] [Intel-gfx] " Tvrtko Ursulin
2018-03-01  9:27         ` Chris Wilson
2018-03-01  9:27           ` [Intel-gfx] " Chris Wilson
2018-03-01  9:38           ` Tvrtko Ursulin [this message]
2018-03-01  9:38             ` [igt-dev] [PATCH i-g-t v3] " Tvrtko Ursulin
2018-02-19 19:34 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2018-02-19 22:47 ` [igt-dev] ✗ Fi.CI.IGT: warning " Patchwork
2018-02-28 18:11 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/perf_pmu: Test busyness reporting in face of GPU hangs (rev2) Patchwork
2018-02-28 22:47 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2018-03-01  9:59 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/perf_pmu: Test busyness reporting in face of GPU hangs (rev3) Patchwork
2018-03-01 13:21 ` [igt-dev] ✗ Fi.CI.IGT: warning " 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=20180301093846.23154-1-tvrtko.ursulin@linux.intel.com \
    --to=tursulin@ursulin.net \
    --cc=Intel-gfx@lists.freedesktop.org \
    --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 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.