diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2020-01-26 13:41:17 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2020-01-28 10:06:10 +0000 |
commit | 004b7ccce8a6fc76f89344afc0a65e2dfe61e317 (patch) | |
tree | 427d34be827ca15b47668f921c4d193949de8e11 /tests/i915/gem_ctx_persistence.c | |
parent | 0ecbff50d72538b5e548fc6dd48a07173e9f8b42 (diff) |
i915: Inject invalid CS into hanging spinners
Some spinners are used with the intent of never ending and being
declared hung by the kernel. In some cases, these are being used to
simulate invalid payloads and so we can use an invalid command to
trigger a GPU hang. (Other cases, they are simulating infinite workloads
that truly never end, but we still need to be able to curtail to provide
multi-tasking). This patch adds IGT_SPIN_INVALID_CS to request the
injection of 0xdeadbeef into the command stream that should trigger a
GPU hang.
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 | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/tests/i915/gem_ctx_persistence.c b/tests/i915/gem_ctx_persistence.c index d68431ae..d4823445 100644 --- a/tests/i915/gem_ctx_persistence.c +++ b/tests/i915/gem_ctx_persistence.c @@ -345,6 +345,41 @@ static void test_nohangcheck_hostile(int i915) close(dir); } +static void test_nohangcheck_hang(int i915) +{ + int64_t timeout = reset_timeout_ms * NSEC_PER_MSEC; + int dir; + + /* + * Even if the user disables hangcheck during their context, + * we forcibly terminate that context. + */ + + dir = igt_sysfs_open_parameters(i915); + igt_require(dir != -1); + + igt_require(__enable_hangcheck(dir, false)); + + for_each_physical_engine(e, i915) { + uint32_t ctx = gem_context_create(i915); + igt_spin_t *spin; + + spin = igt_spin_new(i915, ctx, + .engine = eb_ring(e), + .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); + } + + igt_require(__enable_hangcheck(dir, true)); + + gem_quiescent_gpu(i915); + close(dir); +} + static void test_nonpersistent_file(int i915) { int debugfs = i915; @@ -724,8 +759,10 @@ igt_main igt_subtest("processes") test_processes(i915); - igt_subtest("hangcheck") + igt_subtest("hostile") test_nohangcheck_hostile(i915); + igt_subtest("hang") + test_nohangcheck_hang(i915); __for_each_static_engine(e) { igt_subtest_group { |