diff mbox

[i-g-t,v2,1/2] tests/gem_exec_schedule: Add reset on failed preemption test.

Message ID 20171204234541.23649-1-antonio.argenziano@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Antonio Argenziano Dec. 4, 2017, 11:45 p.m. UTC
This patch adds a test where a low priority batch is going to be
declared hung while a preemption is pending. The test wants to verify
that a 'hanging' low priority batch will not disrupt the execution of a high
priority context and that the driver does due diligence in managing a
reset while a preemption is pending.

-v2:
	- Use igt_hang_ctx to hang the engine (Chris)
	- Enable/Process engine reset using IGT libs (Chris)
	- Create new subtest_group for the test (Chris)

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Michal Winiarski <michal.winiarski@intel.com>
Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com>
---
 tests/gem_exec_schedule.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

Comments

Michał Winiarski Dec. 8, 2017, 9:57 p.m. UTC | #1
On Mon, Dec 04, 2017 at 03:45:40PM -0800, Antonio Argenziano wrote:
> This patch adds a test where a low priority batch is going to be
> declared hung while a preemption is pending. The test wants to verify
> that a 'hanging' low priority batch will not disrupt the execution of a high
> priority context and that the driver does due diligence in managing a
> reset while a preemption is pending.
> 
> -v2:
> 	- Use igt_hang_ctx to hang the engine (Chris)
> 	- Enable/Process engine reset using IGT libs (Chris)
> 	- Create new subtest_group for the test (Chris)
> 
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Michal Winiarski <michal.winiarski@intel.com>
> Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com>

Reviewed-by: Michał Winiarski <michal.winiarski@intel.com>

-Michał

> ---
>  tests/gem_exec_schedule.c | 28 +++++++++++++++++++++++++++-
>  1 file changed, 27 insertions(+), 1 deletion(-)
Chris Wilson Dec. 10, 2017, 2:32 p.m. UTC | #2
Quoting Patchwork (2017-12-09 00:50:11)
> == Series Details ==
> 
> Series: series starting with [v2,1/2] tests/gem_exec_schedule: Add reset on failed preemption test. (rev2)
> URL   : https://patchwork.freedesktop.org/series/34874/
> State : success
> 
> == Summary ==
> 
> Test kms_flip:
>         Subgroup vblank-vs-suspend-interruptible:
>                 pass       -> INCOMPLETE (shard-hsw) fdo#100368
> Test kms_frontbuffer_tracking:
>         Subgroup fbc-1p-offscren-pri-shrfb-draw-blt:
>                 pass       -> FAIL       (shard-snb) fdo#101623 +1
> Test gem_tiled_swapping:
>         Subgroup non-threaded:
>                 incomplete -> PASS       (shard-snb) fdo#104009
> Test drv_selftest:
>         Subgroup live_hangcheck:
>                 incomplete -> PASS       (shard-snb) fdo#103880

And pushed.
-Chris
diff mbox

Patch

diff --git a/tests/gem_exec_schedule.c b/tests/gem_exec_schedule.c
index a2f4419a..d0f85b3e 100644
--- a/tests/gem_exec_schedule.c
+++ b/tests/gem_exec_schedule.c
@@ -356,13 +356,15 @@  static void promotion(int fd, unsigned ring)
 	munmap(ptr, 4096);
 }
 
-#define NEW_CTX 0x1
+#define NEW_CTX (0x1 << 0)
+#define HANG_LP (0x1 << 1)
 static void preempt(int fd, unsigned ring, unsigned flags)
 {
 	uint32_t result = gem_create(fd, 4096);
 	uint32_t *ptr = gem_mmap__gtt(fd, result, 4096, PROT_READ);
 	igt_spin_t *spin[16];
 	uint32_t ctx[2];
+	igt_hang_t hang;
 
 	ctx[LO] = gem_context_create(fd);
 	gem_context_set_priority(fd, ctx[LO], MIN_PRIO);
@@ -370,6 +372,9 @@  static void preempt(int fd, unsigned ring, unsigned flags)
 	ctx[HI] = gem_context_create(fd);
 	gem_context_set_priority(fd, ctx[HI], MAX_PRIO);
 
+	if (flags & HANG_LP)
+		hang = igt_hang_ctx(fd, ctx[LO], ring, 0, NULL);
+
 	for (int n = 0; n < 16; n++) {
 		if (flags & NEW_CTX) {
 			gem_context_destroy(fd, ctx[LO]);
@@ -389,6 +394,9 @@  static void preempt(int fd, unsigned ring, unsigned flags)
 	for (int n = 0; n < 16; n++)
 		igt_spin_batch_free(fd, spin[n]);
 
+	if (flags & HANG_LP)
+		igt_post_hang_ring(fd, hang);
+
 	gem_context_destroy(fd, ctx[LO]);
 	gem_context_destroy(fd, ctx[HI]);
 
@@ -1023,6 +1031,24 @@  igt_main
 
 					igt_subtest_f("preempt-self-%s", e->name)
 						preempt_self(fd, e->exec_id | e->flags);
+
+					igt_subtest_group {
+						igt_hang_t hang;
+
+						igt_fixture {
+							igt_stop_hang_detector();
+							hang = igt_allow_hang(fd, 0, 0);
+						}
+
+						igt_subtest_f("preempt-hang-%s", e->name) {
+							preempt(fd, e->exec_id | e->flags, NEW_CTX | HANG_LP);
+						}
+
+						igt_fixture {
+							igt_disallow_hang(fd, hang);
+							igt_fork_hang_detector(fd);
+						}
+					}
 				}
 
 				igt_subtest_f("deep-%s", e->name)