diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2014-09-04 13:57:17 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2015-01-07 17:35:14 +0000 |
commit | ce79b7aa8010d848d4e9c417bcba375eac958f60 (patch) | |
tree | e218009c39fd4ae2176fe1c998cde2d4b2701fc4 /tests | |
parent | 5ae9ecaf55ee3263f17ac3837b0dfdd6626cca51 (diff) |
igt/gem_reloc_vs_hang: Inject hangs!
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gem_reloc_vs_gpu.c | 54 |
1 files changed, 44 insertions, 10 deletions
diff --git a/tests/gem_reloc_vs_gpu.c b/tests/gem_reloc_vs_gpu.c index cc1b954b..bb8615b6 100644 --- a/tests/gem_reloc_vs_gpu.c +++ b/tests/gem_reloc_vs_gpu.c @@ -45,6 +45,7 @@ #include "intel_io.h" #include "igt_debugfs.h" #include "igt_aux.h" +#include "igt_gt.h" IGT_TEST_DESCRIPTION("Test kernel relocations vs. gpu races."); @@ -190,7 +191,18 @@ static void reloc_and_emit(int fd, drm_intel_bo *target_bo, bool faulting_reloc) gem_close(fd, handle_relocs); } -static void do_test(int fd, bool faulting_reloc) +static struct igt_hang_ring no_hang(int fd) +{ + return (struct igt_hang_ring){0}; +} + +static struct igt_hang_ring bcs_hang(int fd) +{ + return igt_hang_ring(fd, batch->gen, I915_EXEC_BLT); +} + +static void do_test(int fd, bool faulting_reloc, + struct igt_hang_ring (*do_hang)(int fd)) { uint32_t tiling_mode = I915_TILING_X; unsigned long pitch, act_size; @@ -209,11 +221,16 @@ static void do_test(int fd, bool faulting_reloc) create_special_bo(); for (i = 0; i < NUM_TARGET_BOS; i++) { + struct igt_hang_ring hang; + pc_target_bo[i] = drm_intel_bo_alloc(bufmgr, "special batch", 4096, 4096); emit_dummy_load(pitch); igt_assert(pc_target_bo[i]->offset == 0); + hang = do_hang(fd); reloc_and_emit(fd, pc_target_bo[i], faulting_reloc); + + igt_post_hang_ring(fd, hang); } /* Only check at the end to avoid unnecessary synchronous behaviour. */ @@ -238,12 +255,18 @@ static void do_test(int fd, bool faulting_reloc) #define FAULTING (1 << 1) #define THRASH (1 << 2) #define THRASH_INACTIVE (1 << 3) -#define ALL_FLAGS (INTERRUPT | FAULTING | THRASH | THRASH_INACTIVE) +#define HANG (1 << 4) +#define ALL_FLAGS (HANG | INTERRUPT | FAULTING | THRASH | THRASH_INACTIVE) static void do_forked_test(int fd, unsigned flags) { int num_threads = sysconf(_SC_NPROCESSORS_ONLN); struct igt_helper_process thrasher = {}; + if (flags & HANG) + igt_require(igt_can_hang_ring(fd, + intel_gen(devid), + I915_EXEC_BLT)); + if (flags & (THRASH | THRASH_INACTIVE)) { uint64_t val = (flags & THRASH_INACTIVE) ? (DROP_RETIRE | DROP_BOUND | DROP_UNBOUND) : DROP_ALL; @@ -258,13 +281,14 @@ static void do_forked_test(int fd, unsigned flags) igt_fork(i, num_threads * 4) { /* re-create process local data */ + fd = drm_open_any(); bufmgr = drm_intel_bufmgr_gem_init(fd, 4096); batch = intel_batchbuffer_alloc(bufmgr, devid); if (flags & INTERRUPT) igt_fork_signal_helper(); - do_test(fd, flags & FAULTING); + do_test(fd, flags & FAULTING, flags & HANG ? bcs_hang : no_hang); if (flags & INTERRUPT) igt_stop_signal_helper(); @@ -286,7 +310,6 @@ igt_main igt_fixture { fd = drm_open_any(); - bufmgr = drm_intel_bufmgr_gem_init(fd, 4096); /* disable reuse, otherwise the test fails */ //drm_intel_bufmgr_gem_enable_reuse(bufmgr); @@ -295,28 +318,39 @@ igt_main } igt_subtest("normal") - do_test(fd, false); + do_test(fd, false, no_hang); igt_subtest("faulting-reloc") - do_test(fd, true); + do_test(fd, true, no_hang); igt_fork_signal_helper(); igt_subtest("interruptible") - do_test(fd, false); + do_test(fd, false, no_hang); + + igt_subtest("interruptible-hang") { + igt_require(igt_can_hang_ring(fd, intel_gen(devid), I915_EXEC_BLT)); + do_test(fd, false, bcs_hang); + } igt_subtest("faulting-reloc-interruptible") - do_test(fd, true); + do_test(fd, true, no_hang); + + igt_subtest("faulting-reloc-interruptible-hang") { + igt_require(igt_can_hang_ring(fd, intel_gen(devid), I915_EXEC_BLT)); + do_test(fd, true, bcs_hang); + } igt_stop_signal_helper(); for (unsigned flags = 0; flags <= ALL_FLAGS; flags++) { if ((flags & THRASH) && (flags & THRASH_INACTIVE)) continue; - igt_subtest_f("forked%s%s%s%s", + igt_subtest_f("forked%s%s%s%s%s", flags & INTERRUPT ? "-interruptible" : "", flags & FAULTING ? "-faulting-reloc" : "", flags & THRASH ? "-thrashing" : "", - flags & THRASH_INACTIVE ? "-thrash-inactive" : "") + flags & THRASH_INACTIVE ? "-thrash-inactive" : "", + flags & HANG ? "-hang": "") do_forked_test(fd, flags); } |