@@ -294,7 +294,7 @@ igt_hang_t igt_hang_ctx(int fd, igt_hang_opt_t opts)
context_set_ban(fd, opts.ctx, 0);
emit_recursive_batch(&spin, fd,
- (igt_spin_opt_t){opts.ctx, opts.ring, 0, false});
+ (igt_spin_opt_t){opts.ctx, opts.ring, 0, opts.preemptible});
if (opts.offset)
*opts.offset = spin.spinning_offset;
@@ -316,7 +316,7 @@ igt_hang_t igt_hang_ctx(int fd, igt_hang_opt_t opts)
*/
igt_hang_t igt_hang_ring(int fd, int ring)
{
- return igt_hang_ctx(fd, (igt_hang_opt_t){0, ring, 0, NULL});
+ return igt_hang_ctx(fd, (igt_hang_opt_t){0, ring, 0, NULL, false});
}
/**
@@ -42,6 +42,7 @@ typedef struct igt_hang_opt {
int ring;
unsigned flags;
uint64_t *offset;
+ bool preemptible;
} igt_hang_opt_t;
igt_hang_t igt_allow_hang(int fd, unsigned ctx, unsigned flags);
@@ -187,7 +187,7 @@ static void test_error_state_capture(unsigned ring_id,
clear_error_state();
- hang = igt_hang_ctx(device, (igt_hang_opt_t){0, ring_id, HANG_ALLOW_CAPTURE, &offset});
+ hang = igt_hang_ctx(device, (igt_hang_opt_t){0, ring_id, HANG_ALLOW_CAPTURE, &offset, false});
batch = gem_mmap__cpu(device, hang.handle, 0, 4096, PROT_READ);
gem_set_domain(device, hang.handle, I915_GEM_DOMAIN_CPU, 0);
igt_post_hang_ring(device, hang);
@@ -161,7 +161,7 @@ static void inject_hang(int fd, uint32_t ctx,
clock_gettime(CLOCK_MONOTONIC, &ts_injected);
- hang = igt_hang_ctx(fd, (igt_hang_opt_t){ctx, e->exec_id | e->flags, flags & BAN, NULL});
+ hang = igt_hang_ctx(fd, (igt_hang_opt_t){ctx, e->exec_id | e->flags, flags & BAN, NULL, false});
if ((flags & ASYNC) == 0)
igt_post_hang_ring(fd, hang);
}
@@ -359,7 +359,7 @@ static void test_evict_hang(int fd)
execbuf.buffers_ptr = to_user_pointer(&object);
execbuf.buffer_count = 1;
- hang = igt_hang_ctx(fd, (igt_hang_opt_t){0, 0, 0, (uint64_t *)&expected});
+ hang = igt_hang_ctx(fd, (igt_hang_opt_t){0, 0, 0, (uint64_t *)&expected, false});
object.offset = expected;
object.flags = EXEC_OBJECT_PINNED;
This patch adds a parameter to make the hanging context pre-emptible. Cc: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com> --- lib/igt_gt.c | 4 ++-- lib/igt_gt.h | 1 + tests/drv_hangman.c | 2 +- tests/gem_reset_stats.c | 2 +- tests/gem_softpin.c | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-)