Patchwork [RFC,i-g-t,5/5] igt_hang_ctx: Add preemptible parameter

login
register
mail settings
Submitter Antonio Argenziano
Date Dec. 6, 2017, 11:03 p.m.
Message ID <20171206230346.30767-5-antonio.argenziano@intel.com>
Download mbox | patch
Permalink /patch/10097379/
State New
Headers show

Comments

Antonio Argenziano - Dec. 6, 2017, 11:03 p.m.
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(-)

Patch

diff --git a/lib/igt_gt.c b/lib/igt_gt.c
index 48d40e61..bc33e087 100644
--- a/lib/igt_gt.c
+++ b/lib/igt_gt.c
@@ -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});
 }
 
 /**
diff --git a/lib/igt_gt.h b/lib/igt_gt.h
index 3f3e2d96..17fcee33 100644
--- a/lib/igt_gt.h
+++ b/lib/igt_gt.h
@@ -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);
diff --git a/tests/drv_hangman.c b/tests/drv_hangman.c
index 75fb2364..e9227a84 100644
--- a/tests/drv_hangman.c
+++ b/tests/drv_hangman.c
@@ -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);
diff --git a/tests/gem_reset_stats.c b/tests/gem_reset_stats.c
index 19174307..c5024157 100644
--- a/tests/gem_reset_stats.c
+++ b/tests/gem_reset_stats.c
@@ -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);
 }
diff --git a/tests/gem_softpin.c b/tests/gem_softpin.c
index 9256138a..07b5712d 100644
--- a/tests/gem_softpin.c
+++ b/tests/gem_softpin.c
@@ -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;