diff options
author | Antonio Argenziano <antonio.argenziano@intel.com> | 2018-07-10 16:45:26 -0700 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2018-07-13 19:29:38 +0100 |
commit | 140a67c13aad2595ee6c72e41d14d35a793158b5 (patch) | |
tree | 1b33508f86195317e338c91b7aa45f4cf51ad223 /tests | |
parent | caea9c5b3aa1191c0152d7c0f22a94efca4fd048 (diff) |
lib/gt: Make use of dummyload library to create recursive batch
An hanging batch is nothing more than a spinning batch that never gets
stopped, so re-use the routines implemented in dummyload.c.
v2: Let caller decide spin loop size
v3: Only use loose loops for hangs (Chris)
v4: No requires
v5: Free the spinner
v6: Chamelium exists.
Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com> #v3
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Antonio Argenziano <antonio.argenziano@intel.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/drv_hangman.c | 9 | ||||
-rw-r--r-- | tests/gem_concurrent_all.c | 23 | ||||
-rw-r--r-- | tests/gem_exec_schedule.c | 4 | ||||
-rw-r--r-- | tests/gem_mmap_gtt.c | 2 | ||||
-rw-r--r-- | tests/gem_reset_stats.c | 4 | ||||
-rw-r--r-- | tests/gem_shrink.c | 2 | ||||
-rw-r--r-- | tests/gem_softpin.c | 7 |
7 files changed, 22 insertions, 29 deletions
diff --git a/tests/drv_hangman.c b/tests/drv_hangman.c index 1736d2a6..6ddae491 100644 --- a/tests/drv_hangman.c +++ b/tests/drv_hangman.c @@ -199,9 +199,12 @@ static void test_error_state_capture(unsigned ring_id, clear_error_state(); - hang = igt_hang_ctx(device, 0, ring_id, HANG_ALLOW_CAPTURE, &offset); - batch = gem_mmap__cpu(device, hang.handle, 0, 4096, PROT_READ); - gem_set_domain(device, hang.handle, I915_GEM_DOMAIN_CPU, 0); + hang = igt_hang_ctx(device, 0, ring_id, HANG_ALLOW_CAPTURE); + offset = hang.spin->obj[1].offset; + + batch = gem_mmap__cpu(device, hang.spin->handle, 0, 4096, PROT_READ); + gem_set_domain(device, hang.spin->handle, I915_GEM_DOMAIN_CPU, 0); + igt_post_hang_ring(device, hang); check_error_state(ring_name, offset, batch); diff --git a/tests/gem_concurrent_all.c b/tests/gem_concurrent_all.c index 3a1097ba..4ac08c1b 100644 --- a/tests/gem_concurrent_all.c +++ b/tests/gem_concurrent_all.c @@ -946,30 +946,19 @@ static igt_hang_t rcs_hang(void) static igt_hang_t all_hang(void) { - uint32_t bbe = MI_BATCH_BUFFER_END; - struct drm_i915_gem_execbuffer2 execbuf; - struct drm_i915_gem_exec_object2 obj; - igt_hang_t hang; + igt_hang_t hang = igt_hang_ring(fd, I915_EXEC_RENDER); unsigned engine; - memset(&obj, 0, sizeof(obj)); - obj.handle = gem_create(fd, 4096); - gem_write(fd, obj.handle, 0, &bbe, sizeof(&bbe)); - - memset(&execbuf, 0, sizeof(execbuf)); - execbuf.buffers_ptr = to_user_pointer(&obj); - execbuf.buffer_count = 1; - for_each_physical_engine(fd, engine) { - hang = igt_hang_ring(fd, engine); + struct drm_i915_gem_execbuffer2 eb = hang.spin->execbuf; - execbuf.flags = engine; - __gem_execbuf(fd, &execbuf); + if (engine == I915_EXEC_RENDER) + continue; - gem_close(fd, hang.handle); + eb.flags = engine; + __gem_execbuf(fd, &eb); } - hang.handle = obj.handle; return hang; } diff --git a/tests/gem_exec_schedule.c b/tests/gem_exec_schedule.c index 35a44ab1..43ea97e6 100644 --- a/tests/gem_exec_schedule.c +++ b/tests/gem_exec_schedule.c @@ -423,7 +423,7 @@ static void preempt(int fd, unsigned ring, unsigned flags) gem_context_set_priority(fd, ctx[HI], MAX_PRIO); if (flags & HANG_LP) - hang = igt_hang_ctx(fd, ctx[LO], ring, 0, NULL); + hang = igt_hang_ctx(fd, ctx[LO], ring, 0); for (int n = 0; n < ARRAY_SIZE(spin); n++) { if (flags & NEW_CTX) { @@ -730,7 +730,7 @@ static void preemptive_hang(int fd, unsigned ring) gem_context_destroy(fd, ctx[LO]); } - hang = igt_hang_ctx(fd, ctx[HI], ring, 0, NULL); + hang = igt_hang_ctx(fd, ctx[HI], ring, 0); igt_post_hang_ring(fd, hang); for (int n = 0; n < ARRAY_SIZE(spin); n++) { diff --git a/tests/gem_mmap_gtt.c b/tests/gem_mmap_gtt.c index fd60b8ff..c8a0bede 100644 --- a/tests/gem_mmap_gtt.c +++ b/tests/gem_mmap_gtt.c @@ -399,7 +399,7 @@ test_hang(int fd) last_pattern = next_pattern; next_pattern = (next_pattern + 1) % ARRAY_SIZE(patterns); - } while (gem_bo_busy(fd, hang.handle)); + } while (gem_bo_busy(fd, hang.spin->handle)); igt_post_hang_ring(fd, hang); diff --git a/tests/gem_reset_stats.c b/tests/gem_reset_stats.c index 74ba2656..ac9af23f 100644 --- a/tests/gem_reset_stats.c +++ b/tests/gem_reset_stats.c @@ -164,7 +164,7 @@ static void inject_hang(int fd, uint32_t ctx, clock_gettime(CLOCK_MONOTONIC, &ts_injected); - hang = igt_hang_ctx(fd, ctx, e->exec_id | e->flags, flags & BAN, NULL); + hang = igt_hang_ctx(fd, ctx, e->exec_id | e->flags, flags & BAN); if ((flags & ASYNC) == 0) igt_post_hang_ring(fd, hang); } @@ -546,7 +546,7 @@ static void test_close_pending_fork(const struct intel_execution_engine *e, assert_reset_status(fd, fd, 0, RS_NO_ERROR); - hang = igt_hang_ctx(fd, 0, e->exec_id | e->flags, 0, NULL); + hang = igt_hang_ctx(fd, 0, e->exec_id | e->flags, 0); sleep(1); /* Avoid helpers as we need to kill the child diff --git a/tests/gem_shrink.c b/tests/gem_shrink.c index 929e0426..c8e05814 100644 --- a/tests/gem_shrink.c +++ b/tests/gem_shrink.c @@ -208,7 +208,7 @@ static void hang(int fd, uint64_t alloc) gem_execbuf(fd, &execbuf); } - gem_close(fd, igt_hang_ring(fd, 0).handle); + gem_close(fd, igt_hang_ring(fd, 0).spin->handle); for (int i = 0; i <= count; i++) gem_madvise(fd, obj[i].handle, I915_MADV_DONTNEED); munmap(obj, obj_size); diff --git a/tests/gem_softpin.c b/tests/gem_softpin.c index 23f93623..336008b8 100644 --- a/tests/gem_softpin.c +++ b/tests/gem_softpin.c @@ -359,11 +359,12 @@ static void test_evict_hang(int fd) execbuf.buffers_ptr = to_user_pointer(&object); execbuf.buffer_count = 1; - hang = igt_hang_ctx(fd, 0, 0, 0, (uint64_t *)&expected); - object.offset = expected; - object.flags = EXEC_OBJECT_PINNED; + hang = igt_hang_ctx(fd, 0, 0, 0); + expected = hang.spin->obj[1].offset; /* Replace the hung batch with ourselves, forcing an eviction */ + object.offset = expected; + object.flags = EXEC_OBJECT_PINNED; gem_execbuf(fd, &execbuf); igt_assert_eq_u64(object.offset, expected); |