[Intel-gfx] [PATCH i-g-t] lib/dummyload: Control whether or not the batch is preemptible

Chris Wilson chris at chris-wilson.co.uk
Wed Jul 11 07:42:49 UTC 2018


Sometimes, we do not want to allow control to escape from the spinner,
e.g. for when we want to hang the GPU inside the batch.

(Split out from the preempt-timeout test case.)

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Reviewed-by: Antonio Argenziano <antonio.argenziano at intel.com>
---
 lib/igt_dummyload.c | 5 ++---
 lib/igt_dummyload.h | 7 ++++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c
index 7beb66244..2027a4b7f 100644
--- a/lib/igt_dummyload.c
+++ b/lib/igt_dummyload.c
@@ -186,7 +186,8 @@ emit_recursive_batch(igt_spin_t *spin,
 	spin->handle = obj[BATCH].handle;
 
 	/* Allow ourselves to be preempted */
-	*batch++ = MI_ARB_CHK;
+	if (!(opts->flags & IGT_SPIN_NO_PREEMPTION))
+		*batch++ = MI_ARB_CHK;
 
 	/* Pad with a few nops so that we do not completely hog the system.
 	 *
@@ -379,8 +380,6 @@ void igt_spin_batch_end(igt_spin_t *spin)
 	if (!spin)
 		return;
 
-	igt_assert(*spin->batch == MI_ARB_CHK ||
-		   *spin->batch == MI_BATCH_BUFFER_END);
 	*spin->batch = MI_BATCH_BUFFER_END;
 	__sync_synchronize();
 }
diff --git a/lib/igt_dummyload.h b/lib/igt_dummyload.h
index e80a12451..38bc7682e 100644
--- a/lib/igt_dummyload.h
+++ b/lib/igt_dummyload.h
@@ -50,9 +50,10 @@ struct igt_spin_factory {
 	unsigned int flags;
 };
 
-#define IGT_SPIN_FENCE_OUT (1 << 0)
-#define IGT_SPIN_POLL_RUN  (1 << 1)
-#define IGT_SPIN_FAST      (1 << 2)
+#define IGT_SPIN_FENCE_OUT     (1 << 0)
+#define IGT_SPIN_POLL_RUN      (1 << 1)
+#define IGT_SPIN_FAST          (1 << 2)
+#define IGT_SPIN_NO_PREEMPTION (1 << 3)
 
 igt_spin_t *
 __igt_spin_batch_factory(int fd, const struct igt_spin_factory *opts);
-- 
2.18.0



More information about the Intel-gfx mailing list