diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2020-01-29 08:37:34 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2020-01-29 08:40:11 +0000 |
commit | 62b5c847c9ac9738e523ec0e2583e2f766032b1b (patch) | |
tree | 34dc7f733dd7acfbb8d673056ad3ee07ded25aab /tests/i915/gem_ctx_persistence.c | |
parent | b85f96d6aa71795684b14d3b3d4c752dd61ff62e (diff) |
i915/gem_ctx_persistence: Check we detect a genuine hang
Just in case the user submits an invalid batch, check we can clean up
afterwards.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Diffstat (limited to 'tests/i915/gem_ctx_persistence.c')
-rw-r--r-- | tests/i915/gem_ctx_persistence.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/i915/gem_ctx_persistence.c b/tests/i915/gem_ctx_persistence.c index d4823445..43333aaf 100644 --- a/tests/i915/gem_ctx_persistence.c +++ b/tests/i915/gem_ctx_persistence.c @@ -310,6 +310,31 @@ static void test_nonpersistent_hostile_preempt(int i915, unsigned int engine) gem_quiescent_gpu(i915); } +static void test_nonpersistent_hang(int i915, unsigned int engine) +{ + int64_t timeout = reset_timeout_ms * NSEC_PER_MSEC; + igt_spin_t *spin; + uint32_t ctx; + + /* + * The user made a simple mistake and submitted an invalid batch, + * but fortunately under a nonpersistent context. Do we detect it? + */ + + ctx = gem_context_create(i915); + gem_context_set_persistence(i915, ctx, false); + + spin = igt_spin_new(i915, ctx, + .engine = engine, + .flags = IGT_SPIN_INVALID_CS); + gem_context_destroy(i915, ctx); + + igt_assert_eq(gem_wait(i915, spin->handle, &timeout), 0); + + igt_spin_free(i915, spin); + gem_quiescent_gpu(i915); +} + static void test_nohangcheck_hostile(int i915) { int64_t timeout = reset_timeout_ms * NSEC_PER_MSEC; @@ -792,6 +817,9 @@ igt_main igt_subtest_f("%s-hostile-preempt", e->name) test_nonpersistent_hostile_preempt(i915, e->flags); + + igt_subtest_f("%s-hang", e->name) + test_nonpersistent_hang(i915, e->flags); } } |