All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH igt 1/2] lib: force a reset on an uncooperative i915 device
@ 2018-02-09 11:46 ` Chris Wilson
  0 siblings, 0 replies; 7+ messages in thread
From: Chris Wilson @ 2018-02-09 11:46 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev

Try to reset the GPU from within igt_require_gem() if we notice we are
starting with a wedged device. If it remains wedged, the test definitely
cannot run. We leave a warning in place to highlight the potentially
suspect result, which will keep the flip-flops alive in CI!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 lib/ioctl_wrappers.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index 10d958726..5d2c82099 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -1428,14 +1428,20 @@ void igt_require_gem(int fd)
 	 * sequences of batches.
 	 */
 	err = igt_debugfs_dir(fd);
-	if (err != -1) {
-		igt_sysfs_printf(err, "i915_next_seqno", "1");
-		close(err);
+	igt_require(err >= 0);
+
+	if (ioctl(fd, DRM_IOCTL_I915_GEM_THROTTLE)) {
+		igt_warn("Found wedged device, trying to reset and continue\n");
+		igt_sysfs_set(err, "i915_wedged", "-1");
 	}
+	igt_sysfs_set(err, "i915_next_seqno", "1");
+
+	close(err);
 
 	err = 0;
 	if (ioctl(fd, DRM_IOCTL_I915_GEM_THROTTLE))
 		err = -errno;
+
 	close(fd);
 
 	igt_require_f(err == 0, "Unresponsive i915/GEM device\n");
-- 
2.16.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Intel-gfx] [PATCH igt 1/2] lib: force a reset on an uncooperative i915 device
@ 2018-02-09 11:46 ` Chris Wilson
  0 siblings, 0 replies; 7+ messages in thread
From: Chris Wilson @ 2018-02-09 11:46 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev

Try to reset the GPU from within igt_require_gem() if we notice we are
starting with a wedged device. If it remains wedged, the test definitely
cannot run. We leave a warning in place to highlight the potentially
suspect result, which will keep the flip-flops alive in CI!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 lib/ioctl_wrappers.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index 10d958726..5d2c82099 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -1428,14 +1428,20 @@ void igt_require_gem(int fd)
 	 * sequences of batches.
 	 */
 	err = igt_debugfs_dir(fd);
-	if (err != -1) {
-		igt_sysfs_printf(err, "i915_next_seqno", "1");
-		close(err);
+	igt_require(err >= 0);
+
+	if (ioctl(fd, DRM_IOCTL_I915_GEM_THROTTLE)) {
+		igt_warn("Found wedged device, trying to reset and continue\n");
+		igt_sysfs_set(err, "i915_wedged", "-1");
 	}
+	igt_sysfs_set(err, "i915_next_seqno", "1");
+
+	close(err);
 
 	err = 0;
 	if (ioctl(fd, DRM_IOCTL_I915_GEM_THROTTLE))
 		err = -errno;
+
 	close(fd);
 
 	igt_require_f(err == 0, "Unresponsive i915/GEM device\n");
-- 
2.16.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH igt 2/2] igt/gem_eio: Use slow spinners to inject hangs
  2018-02-09 11:46 ` [Intel-gfx] " Chris Wilson
@ 2018-02-09 11:46   ` Chris Wilson
  -1 siblings, 0 replies; 7+ messages in thread
From: Chris Wilson @ 2018-02-09 11:46 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev

One weird issue we see in bug 104676 is that the hangs are too fast on
HSW! So force the use of the slow spinners that do not try to trigger
a hang by injecting random bytes into the batch.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104676
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 lib/igt_gt.c    |  1 +
 tests/gem_eio.c | 84 +++++++++++++++++++++++++++++++++------------------------
 2 files changed, 50 insertions(+), 35 deletions(-)

diff --git a/lib/igt_gt.c b/lib/igt_gt.c
index ad6e62053..f70fcb925 100644
--- a/lib/igt_gt.c
+++ b/lib/igt_gt.c
@@ -402,6 +402,7 @@ void igt_force_gpu_reset(int drm_fd)
 	igt_sysfs_scanf(dir, "i915_wedged", "%d", &wedged);
 
 	close(dir);
+	errno = 0;
 
 	igt_assert(!wedged);
 }
diff --git a/tests/gem_eio.c b/tests/gem_eio.c
index 16a89ecda..11776306f 100644
--- a/tests/gem_eio.c
+++ b/tests/gem_eio.c
@@ -67,6 +67,8 @@ static void trigger_reset(int fd)
 	/* And just check the gpu is indeed running again */
 	igt_debug("Checking that the GPU recovered\n");
 	gem_test_engine(fd, -1);
+
+	gem_quiescent_gpu(fd);
 }
 
 static void wedge_gpu(int fd)
@@ -133,15 +135,17 @@ static void test_execbuf(int fd)
 
 static int __gem_wait(int fd, uint32_t handle, int64_t timeout)
 {
-	struct drm_i915_gem_wait wait;
-	int err = 0;
+	struct drm_i915_gem_wait wait = {
+		.bo_handle = handle,
+		.timeout_ns = timeout,
+	};
+	int err;
 
-	memset(&wait, 0, sizeof(wait));
-	wait.bo_handle = handle;
-	wait.timeout_ns = timeout;
+	err = 0;
 	if (drmIoctl(fd, DRM_IOCTL_I915_GEM_WAIT, &wait))
 		err = -errno;
 
+	errno = 0;
 	return err;
 }
 
@@ -149,6 +153,8 @@ static void test_wait(int fd)
 {
 	igt_hang_t hang;
 
+	igt_require_gem(fd);
+
 	/* If the request we wait on completes due to a hang (even for
 	 * that request), the user expects the return value to 0 (success).
 	 */
@@ -182,12 +188,11 @@ static void test_suspend(int fd, int state)
 
 static void test_inflight(int fd)
 {
-	struct drm_i915_gem_execbuffer2 execbuf;
+	const uint32_t bbe = MI_BATCH_BUFFER_END;
 	struct drm_i915_gem_exec_object2 obj[2];
-	uint32_t bbe = MI_BATCH_BUFFER_END;
 	unsigned int engine;
-	int fence[64]; /* conservative estimate of ring size */
 
+	igt_require_gem(fd);
 	igt_require(gem_has_exec_fence(fd));
 
 	memset(obj, 0, sizeof(obj));
@@ -196,13 +201,17 @@ static void test_inflight(int fd)
 	gem_write(fd, obj[1].handle, 0, &bbe, sizeof(bbe));
 
 	for_each_engine(fd, engine) {
-		igt_hang_t hang;
+		struct drm_i915_gem_execbuffer2 execbuf;
+		igt_spin_t *hang;
+		int fence[64]; /* conservative estimate of ring size */
+
+		gem_quiescent_gpu(fd);
 
 		igt_debug("Starting %s on engine '%s'\n", __func__, e__->name);
 		igt_require(i915_reset_control(false));
 
-		hang = igt_hang_ring(fd, engine);
-		obj[0].handle = hang.handle;
+		hang = __igt_spin_batch_new(fd, 0, engine, 0);
+		obj[0].handle = hang->handle;
 
 		memset(&execbuf, 0, sizeof(execbuf));
 		execbuf.buffers_ptr = to_user_pointer(obj);
@@ -215,14 +224,13 @@ static void test_inflight(int fd)
 			igt_assert(fence[n] != -1);
 		}
 
-		igt_post_hang_ring(fd, hang);
-
 		igt_assert_eq(__gem_wait(fd, obj[1].handle, -1), 0);
 		for (unsigned int n = 0; n < ARRAY_SIZE(fence); n++) {
 			igt_assert_eq(sync_fence_status(fence[n]), -EIO);
 			close(fence[n]);
 		}
 
+		igt_spin_batch_free(fd, hang);
 		igt_assert(i915_reset_control(true));
 		trigger_reset(fd);
 	}
@@ -234,8 +242,9 @@ static void test_inflight_suspend(int fd)
 	struct drm_i915_gem_exec_object2 obj[2];
 	uint32_t bbe = MI_BATCH_BUFFER_END;
 	int fence[64]; /* conservative estimate of ring size */
-	igt_hang_t hang;
+	igt_spin_t *hang;
 
+	igt_require_gem(fd);
 	igt_require(gem_has_exec_fence(fd));
 	igt_require(i915_reset_control(false));
 
@@ -244,8 +253,8 @@ static void test_inflight_suspend(int fd)
 	obj[1].handle = gem_create(fd, 4096);
 	gem_write(fd, obj[1].handle, 0, &bbe, sizeof(bbe));
 
-	hang = igt_hang_ring(fd, 0);
-	obj[0].handle = hang.handle;
+	hang = __igt_spin_batch_new(fd, 0, 0, 0);
+	obj[0].handle = hang->handle;
 
 	memset(&execbuf, 0, sizeof(execbuf));
 	execbuf.buffers_ptr = to_user_pointer(obj);
@@ -261,27 +270,25 @@ static void test_inflight_suspend(int fd)
 	igt_set_autoresume_delay(30);
 	igt_system_suspend_autoresume(SUSPEND_STATE_MEM, SUSPEND_TEST_NONE);
 
-	igt_post_hang_ring(fd, hang);
-
 	igt_assert_eq(__gem_wait(fd, obj[1].handle, -1), 0);
 	for (unsigned int n = 0; n < ARRAY_SIZE(fence); n++) {
 		igt_assert_eq(sync_fence_status(fence[n]), -EIO);
 		close(fence[n]);
 	}
 
+	igt_spin_batch_free(fd, hang);
 	igt_assert(i915_reset_control(true));
 	trigger_reset(fd);
 }
 
 static void test_inflight_contexts(int fd)
 {
-	struct drm_i915_gem_execbuffer2 execbuf;
 	struct drm_i915_gem_exec_object2 obj[2];
-	uint32_t bbe = MI_BATCH_BUFFER_END;
+	const uint32_t bbe = MI_BATCH_BUFFER_END;
 	unsigned int engine;
 	uint32_t ctx[64];
-	int fence[64];
 
+	igt_require_gem(fd);
 	igt_require(gem_has_exec_fence(fd));
 	gem_require_contexts(fd);
 
@@ -296,13 +303,17 @@ static void test_inflight_contexts(int fd)
 	gem_write(fd, obj[1].handle, 0, &bbe, sizeof(bbe));
 
 	for_each_engine(fd, engine) {
-		igt_hang_t hang;
+		struct drm_i915_gem_execbuffer2 execbuf;
+		igt_spin_t *hang;
+		int fence[64];
+
+		gem_quiescent_gpu(fd);
 
 		igt_debug("Starting %s on engine '%s'\n", __func__, e__->name);
 		igt_require(i915_reset_control(false));
 
-		hang = igt_hang_ring(fd, engine);
-		obj[0].handle = hang.handle;
+		hang = __igt_spin_batch_new(fd, 0, engine, 0);
+		obj[0].handle = hang->handle;
 
 		memset(&execbuf, 0, sizeof(execbuf));
 		execbuf.buffers_ptr = to_user_pointer(obj);
@@ -316,14 +327,13 @@ static void test_inflight_contexts(int fd)
 			igt_assert(fence[n] != -1);
 		}
 
-		igt_post_hang_ring(fd, hang);
-
 		igt_assert_eq(__gem_wait(fd, obj[1].handle, -1), 0);
 		for (unsigned int n = 0; n < ARRAY_SIZE(fence); n++) {
 			igt_assert_eq(sync_fence_status(fence[n]), -EIO);
 			close(fence[n]);
 		}
 
+		igt_spin_batch_free(fd, hang);
 		igt_assert(i915_reset_control(true));
 		trigger_reset(fd);
 	}
@@ -334,12 +344,13 @@ static void test_inflight_contexts(int fd)
 
 static void test_inflight_external(int fd)
 {
+	const uint32_t bbe = MI_BATCH_BUFFER_END;
 	struct drm_i915_gem_execbuffer2 execbuf;
 	struct drm_i915_gem_exec_object2 obj;
-	uint32_t bbe = MI_BATCH_BUFFER_END;
-	igt_hang_t hang;
 	int timeline, fence;
+	igt_spin_t *hang;
 
+	igt_require_gem(fd);
 	igt_require_sw_sync();
 	igt_require(gem_has_exec_fence(fd));
 
@@ -347,7 +358,7 @@ static void test_inflight_external(int fd)
 	fence = sw_sync_timeline_create_fence(timeline, 1);
 
 	igt_require(i915_reset_control(false));
-	hang = igt_hang_ring(fd, I915_EXEC_DEFAULT);
+	hang = __igt_spin_batch_new(fd, 0, 0, 0);
 
 	memset(&obj, 0, sizeof(obj));
 	obj.handle = gem_create(fd, 4096);
@@ -365,13 +376,16 @@ static void test_inflight_external(int fd)
 	fence = execbuf.rsvd2 >> 32;
 	igt_assert(fence != -1);
 
-	igt_post_hang_ring(fd, hang); /* wedged, with an unready batch */
+	gem_sync(fd, hang->handle); /* wedged, with an unready batch */
+	igt_assert(!gem_bo_busy(fd, hang->handle));
+	igt_assert(gem_bo_busy(fd, obj.handle));
 	sw_sync_timeline_inc(timeline, 1); /* only now submit our batches */
 
 	igt_assert_eq(__gem_wait(fd, obj.handle, -1), 0);
 	igt_assert_eq(sync_fence_status(fence), -EIO);
 	close(fence);
 
+	igt_spin_batch_free(fd, hang);
 	igt_assert(i915_reset_control(true));
 	trigger_reset(fd);
 	close(timeline);
@@ -384,15 +398,16 @@ static void test_inflight_internal(int fd)
 	uint32_t bbe = MI_BATCH_BUFFER_END;
 	unsigned engine, nfence = 0;
 	int fences[16];
-	igt_hang_t hang;
+	igt_spin_t *hang;
 
+	igt_require_gem(fd);
 	igt_require(gem_has_exec_fence(fd));
 
 	igt_require(i915_reset_control(false));
-	hang = igt_hang_ring(fd, I915_EXEC_DEFAULT);
+	hang = __igt_spin_batch_new(fd, 0, 0, 0);
 
 	memset(obj, 0, sizeof(obj));
-	obj[0].handle = hang.handle;
+	obj[0].handle = hang->handle;
 	obj[0].flags = EXEC_OBJECT_WRITE;
 	obj[1].handle = gem_create(fd, 4096);
 	gem_write(fd, obj[1].handle, 0, &bbe, sizeof(bbe));
@@ -410,14 +425,13 @@ static void test_inflight_internal(int fd)
 		nfence++;
 	}
 
-	igt_post_hang_ring(fd, hang); /* wedged, with an unready batch */
-
 	igt_assert_eq(__gem_wait(fd, obj[1].handle, -1), 0);
 	while (nfence--) {
 		igt_assert_eq(sync_fence_status(fences[nfence]), -EIO);
 		close(fences[nfence]);
 	}
 
+	igt_spin_batch_free(fd, hang);
 	igt_assert(i915_reset_control(true));
 	trigger_reset(fd);
 }
-- 
2.16.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [igt-dev] [PATCH igt 2/2] igt/gem_eio: Use slow spinners to inject hangs
@ 2018-02-09 11:46   ` Chris Wilson
  0 siblings, 0 replies; 7+ messages in thread
From: Chris Wilson @ 2018-02-09 11:46 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev

One weird issue we see in bug 104676 is that the hangs are too fast on
HSW! So force the use of the slow spinners that do not try to trigger
a hang by injecting random bytes into the batch.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104676
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 lib/igt_gt.c    |  1 +
 tests/gem_eio.c | 84 +++++++++++++++++++++++++++++++++------------------------
 2 files changed, 50 insertions(+), 35 deletions(-)

diff --git a/lib/igt_gt.c b/lib/igt_gt.c
index ad6e62053..f70fcb925 100644
--- a/lib/igt_gt.c
+++ b/lib/igt_gt.c
@@ -402,6 +402,7 @@ void igt_force_gpu_reset(int drm_fd)
 	igt_sysfs_scanf(dir, "i915_wedged", "%d", &wedged);
 
 	close(dir);
+	errno = 0;
 
 	igt_assert(!wedged);
 }
diff --git a/tests/gem_eio.c b/tests/gem_eio.c
index 16a89ecda..11776306f 100644
--- a/tests/gem_eio.c
+++ b/tests/gem_eio.c
@@ -67,6 +67,8 @@ static void trigger_reset(int fd)
 	/* And just check the gpu is indeed running again */
 	igt_debug("Checking that the GPU recovered\n");
 	gem_test_engine(fd, -1);
+
+	gem_quiescent_gpu(fd);
 }
 
 static void wedge_gpu(int fd)
@@ -133,15 +135,17 @@ static void test_execbuf(int fd)
 
 static int __gem_wait(int fd, uint32_t handle, int64_t timeout)
 {
-	struct drm_i915_gem_wait wait;
-	int err = 0;
+	struct drm_i915_gem_wait wait = {
+		.bo_handle = handle,
+		.timeout_ns = timeout,
+	};
+	int err;
 
-	memset(&wait, 0, sizeof(wait));
-	wait.bo_handle = handle;
-	wait.timeout_ns = timeout;
+	err = 0;
 	if (drmIoctl(fd, DRM_IOCTL_I915_GEM_WAIT, &wait))
 		err = -errno;
 
+	errno = 0;
 	return err;
 }
 
@@ -149,6 +153,8 @@ static void test_wait(int fd)
 {
 	igt_hang_t hang;
 
+	igt_require_gem(fd);
+
 	/* If the request we wait on completes due to a hang (even for
 	 * that request), the user expects the return value to 0 (success).
 	 */
@@ -182,12 +188,11 @@ static void test_suspend(int fd, int state)
 
 static void test_inflight(int fd)
 {
-	struct drm_i915_gem_execbuffer2 execbuf;
+	const uint32_t bbe = MI_BATCH_BUFFER_END;
 	struct drm_i915_gem_exec_object2 obj[2];
-	uint32_t bbe = MI_BATCH_BUFFER_END;
 	unsigned int engine;
-	int fence[64]; /* conservative estimate of ring size */
 
+	igt_require_gem(fd);
 	igt_require(gem_has_exec_fence(fd));
 
 	memset(obj, 0, sizeof(obj));
@@ -196,13 +201,17 @@ static void test_inflight(int fd)
 	gem_write(fd, obj[1].handle, 0, &bbe, sizeof(bbe));
 
 	for_each_engine(fd, engine) {
-		igt_hang_t hang;
+		struct drm_i915_gem_execbuffer2 execbuf;
+		igt_spin_t *hang;
+		int fence[64]; /* conservative estimate of ring size */
+
+		gem_quiescent_gpu(fd);
 
 		igt_debug("Starting %s on engine '%s'\n", __func__, e__->name);
 		igt_require(i915_reset_control(false));
 
-		hang = igt_hang_ring(fd, engine);
-		obj[0].handle = hang.handle;
+		hang = __igt_spin_batch_new(fd, 0, engine, 0);
+		obj[0].handle = hang->handle;
 
 		memset(&execbuf, 0, sizeof(execbuf));
 		execbuf.buffers_ptr = to_user_pointer(obj);
@@ -215,14 +224,13 @@ static void test_inflight(int fd)
 			igt_assert(fence[n] != -1);
 		}
 
-		igt_post_hang_ring(fd, hang);
-
 		igt_assert_eq(__gem_wait(fd, obj[1].handle, -1), 0);
 		for (unsigned int n = 0; n < ARRAY_SIZE(fence); n++) {
 			igt_assert_eq(sync_fence_status(fence[n]), -EIO);
 			close(fence[n]);
 		}
 
+		igt_spin_batch_free(fd, hang);
 		igt_assert(i915_reset_control(true));
 		trigger_reset(fd);
 	}
@@ -234,8 +242,9 @@ static void test_inflight_suspend(int fd)
 	struct drm_i915_gem_exec_object2 obj[2];
 	uint32_t bbe = MI_BATCH_BUFFER_END;
 	int fence[64]; /* conservative estimate of ring size */
-	igt_hang_t hang;
+	igt_spin_t *hang;
 
+	igt_require_gem(fd);
 	igt_require(gem_has_exec_fence(fd));
 	igt_require(i915_reset_control(false));
 
@@ -244,8 +253,8 @@ static void test_inflight_suspend(int fd)
 	obj[1].handle = gem_create(fd, 4096);
 	gem_write(fd, obj[1].handle, 0, &bbe, sizeof(bbe));
 
-	hang = igt_hang_ring(fd, 0);
-	obj[0].handle = hang.handle;
+	hang = __igt_spin_batch_new(fd, 0, 0, 0);
+	obj[0].handle = hang->handle;
 
 	memset(&execbuf, 0, sizeof(execbuf));
 	execbuf.buffers_ptr = to_user_pointer(obj);
@@ -261,27 +270,25 @@ static void test_inflight_suspend(int fd)
 	igt_set_autoresume_delay(30);
 	igt_system_suspend_autoresume(SUSPEND_STATE_MEM, SUSPEND_TEST_NONE);
 
-	igt_post_hang_ring(fd, hang);
-
 	igt_assert_eq(__gem_wait(fd, obj[1].handle, -1), 0);
 	for (unsigned int n = 0; n < ARRAY_SIZE(fence); n++) {
 		igt_assert_eq(sync_fence_status(fence[n]), -EIO);
 		close(fence[n]);
 	}
 
+	igt_spin_batch_free(fd, hang);
 	igt_assert(i915_reset_control(true));
 	trigger_reset(fd);
 }
 
 static void test_inflight_contexts(int fd)
 {
-	struct drm_i915_gem_execbuffer2 execbuf;
 	struct drm_i915_gem_exec_object2 obj[2];
-	uint32_t bbe = MI_BATCH_BUFFER_END;
+	const uint32_t bbe = MI_BATCH_BUFFER_END;
 	unsigned int engine;
 	uint32_t ctx[64];
-	int fence[64];
 
+	igt_require_gem(fd);
 	igt_require(gem_has_exec_fence(fd));
 	gem_require_contexts(fd);
 
@@ -296,13 +303,17 @@ static void test_inflight_contexts(int fd)
 	gem_write(fd, obj[1].handle, 0, &bbe, sizeof(bbe));
 
 	for_each_engine(fd, engine) {
-		igt_hang_t hang;
+		struct drm_i915_gem_execbuffer2 execbuf;
+		igt_spin_t *hang;
+		int fence[64];
+
+		gem_quiescent_gpu(fd);
 
 		igt_debug("Starting %s on engine '%s'\n", __func__, e__->name);
 		igt_require(i915_reset_control(false));
 
-		hang = igt_hang_ring(fd, engine);
-		obj[0].handle = hang.handle;
+		hang = __igt_spin_batch_new(fd, 0, engine, 0);
+		obj[0].handle = hang->handle;
 
 		memset(&execbuf, 0, sizeof(execbuf));
 		execbuf.buffers_ptr = to_user_pointer(obj);
@@ -316,14 +327,13 @@ static void test_inflight_contexts(int fd)
 			igt_assert(fence[n] != -1);
 		}
 
-		igt_post_hang_ring(fd, hang);
-
 		igt_assert_eq(__gem_wait(fd, obj[1].handle, -1), 0);
 		for (unsigned int n = 0; n < ARRAY_SIZE(fence); n++) {
 			igt_assert_eq(sync_fence_status(fence[n]), -EIO);
 			close(fence[n]);
 		}
 
+		igt_spin_batch_free(fd, hang);
 		igt_assert(i915_reset_control(true));
 		trigger_reset(fd);
 	}
@@ -334,12 +344,13 @@ static void test_inflight_contexts(int fd)
 
 static void test_inflight_external(int fd)
 {
+	const uint32_t bbe = MI_BATCH_BUFFER_END;
 	struct drm_i915_gem_execbuffer2 execbuf;
 	struct drm_i915_gem_exec_object2 obj;
-	uint32_t bbe = MI_BATCH_BUFFER_END;
-	igt_hang_t hang;
 	int timeline, fence;
+	igt_spin_t *hang;
 
+	igt_require_gem(fd);
 	igt_require_sw_sync();
 	igt_require(gem_has_exec_fence(fd));
 
@@ -347,7 +358,7 @@ static void test_inflight_external(int fd)
 	fence = sw_sync_timeline_create_fence(timeline, 1);
 
 	igt_require(i915_reset_control(false));
-	hang = igt_hang_ring(fd, I915_EXEC_DEFAULT);
+	hang = __igt_spin_batch_new(fd, 0, 0, 0);
 
 	memset(&obj, 0, sizeof(obj));
 	obj.handle = gem_create(fd, 4096);
@@ -365,13 +376,16 @@ static void test_inflight_external(int fd)
 	fence = execbuf.rsvd2 >> 32;
 	igt_assert(fence != -1);
 
-	igt_post_hang_ring(fd, hang); /* wedged, with an unready batch */
+	gem_sync(fd, hang->handle); /* wedged, with an unready batch */
+	igt_assert(!gem_bo_busy(fd, hang->handle));
+	igt_assert(gem_bo_busy(fd, obj.handle));
 	sw_sync_timeline_inc(timeline, 1); /* only now submit our batches */
 
 	igt_assert_eq(__gem_wait(fd, obj.handle, -1), 0);
 	igt_assert_eq(sync_fence_status(fence), -EIO);
 	close(fence);
 
+	igt_spin_batch_free(fd, hang);
 	igt_assert(i915_reset_control(true));
 	trigger_reset(fd);
 	close(timeline);
@@ -384,15 +398,16 @@ static void test_inflight_internal(int fd)
 	uint32_t bbe = MI_BATCH_BUFFER_END;
 	unsigned engine, nfence = 0;
 	int fences[16];
-	igt_hang_t hang;
+	igt_spin_t *hang;
 
+	igt_require_gem(fd);
 	igt_require(gem_has_exec_fence(fd));
 
 	igt_require(i915_reset_control(false));
-	hang = igt_hang_ring(fd, I915_EXEC_DEFAULT);
+	hang = __igt_spin_batch_new(fd, 0, 0, 0);
 
 	memset(obj, 0, sizeof(obj));
-	obj[0].handle = hang.handle;
+	obj[0].handle = hang->handle;
 	obj[0].flags = EXEC_OBJECT_WRITE;
 	obj[1].handle = gem_create(fd, 4096);
 	gem_write(fd, obj[1].handle, 0, &bbe, sizeof(bbe));
@@ -410,14 +425,13 @@ static void test_inflight_internal(int fd)
 		nfence++;
 	}
 
-	igt_post_hang_ring(fd, hang); /* wedged, with an unready batch */
-
 	igt_assert_eq(__gem_wait(fd, obj[1].handle, -1), 0);
 	while (nfence--) {
 		igt_assert_eq(sync_fence_status(fences[nfence]), -EIO);
 		close(fences[nfence]);
 	}
 
+	igt_spin_batch_free(fd, hang);
 	igt_assert(i915_reset_control(true));
 	trigger_reset(fd);
 }
-- 
2.16.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [1/2] lib: force a reset on an uncooperative i915 device
  2018-02-09 11:46 ` [Intel-gfx] " Chris Wilson
  (?)
  (?)
@ 2018-02-09 17:14 ` Patchwork
  -1 siblings, 0 replies; 7+ messages in thread
From: Patchwork @ 2018-02-09 17:14 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev

== Series Details ==

Series: series starting with [1/2] lib: force a reset on an uncooperative i915 device
URL   : https://patchwork.freedesktop.org/series/37999/
State : failure

== Summary ==

IGT patchset tested on top of latest successful build
3af87d45da24015b7a6124b59b2c4b854381cab6 tools/intel_aubdump: Simulate "enhanced execlist" submission for gen11+

with latest DRM-Tip kernel build CI_DRM_3750
897018779f8b drm-tip: 2018y-02m-09d-16h-18m-21s UTC integration manifest

No testlist changes.

Test debugfs_test:
        Subgroup read_all_entries:
                incomplete -> PASS       (fi-snb-2520m) fdo#103713
Test gem_exec_suspend:
        Subgroup basic-s3:
                pass       -> FAIL       (fi-glk-1)
        Subgroup basic-s4-devices:
                pass       -> FAIL       (fi-glk-1)
Test kms_flip:
        Subgroup basic-flip-vs-wf_vblank:
                pass       -> DMESG-WARN (fi-elk-e7500) fdo#103989 +1
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-a:
                pass       -> FAIL       (fi-glk-1)
        Subgroup suspend-read-crc-pipe-b:
                pass       -> FAIL       (fi-glk-1)
                dmesg-warn -> PASS       (fi-cnl-y3) fdo#104951
        Subgroup suspend-read-crc-pipe-c:
                pass       -> FAIL       (fi-glk-1)
Test pm_rpm:
        Subgroup basic-pci-d3-state:
                pass       -> FAIL       (fi-glk-1)
        Subgroup basic-rte:
                pass       -> FAIL       (fi-glk-1)
Test drv_module_reload:
        Subgroup basic-reload:
                pass       -> INCOMPLETE (fi-glk-1)

fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fdo#103989 https://bugs.freedesktop.org/show_bug.cgi?id=103989
fdo#104951 https://bugs.freedesktop.org/show_bug.cgi?id=104951

fi-bdw-5557u     total:288  pass:267  dwarn:0   dfail:0   fail:0   skip:21  time:423s
fi-bdw-gvtdvm    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:428s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:376s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:498s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:288s
fi-bxt-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:484s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:487s
fi-byt-j1900     total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  time:477s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:475s
fi-cfl-s2        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:570s
fi-cnl-y3        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:587s
fi-elk-e7500     total:288  pass:227  dwarn:2   dfail:0   fail:0   skip:59  time:465s
fi-gdg-551       total:288  pass:179  dwarn:0   dfail:0   fail:1   skip:108 time:287s
fi-glk-1         total:285  pass:250  dwarn:0   dfail:0   fail:7   skip:27 
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:389s
fi-ilk-650       total:288  pass:228  dwarn:0   dfail:0   fail:0   skip:60  time:415s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:461s
fi-ivb-3770      total:288  pass:255  dwarn:0   dfail:0   fail:0   skip:33  time:420s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:460s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:495s
fi-kbl-r         total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:500s
fi-pnv-d510      total:288  pass:222  dwarn:1   dfail:0   fail:0   skip:65  time:605s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:432s
fi-skl-6600u     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:512s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:527s
fi-skl-6700k2    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:488s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:478s
fi-skl-guc       total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:417s
fi-skl-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:430s
fi-snb-2520m     total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:527s
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:395s
Blacklisted hosts:
fi-glk-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:468s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_892/issues.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [igt-dev] [PATCH igt 1/2] lib: force a reset on an uncooperative i915 device
  2018-02-09 11:46 ` [Intel-gfx] " Chris Wilson
@ 2018-02-12 21:28   ` Antonio Argenziano
  -1 siblings, 0 replies; 7+ messages in thread
From: Antonio Argenziano @ 2018-02-12 21:28 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx; +Cc: igt-dev



On 09/02/18 03:46, Chris Wilson wrote:
> Try to reset the GPU from within igt_require_gem() if we notice we are
> starting with a wedged device. If it remains wedged, the test definitely
> cannot run. We leave a warning in place to highlight the potentially
> suspect result, which will keep the flip-flops alive in CI!
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>   lib/ioctl_wrappers.c | 12 +++++++++---
>   1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
> index 10d958726..5d2c82099 100644
> --- a/lib/ioctl_wrappers.c
> +++ b/lib/ioctl_wrappers.c
> @@ -1428,14 +1428,20 @@ void igt_require_gem(int fd)
>   	 * sequences of batches.
>   	 */
>   	err = igt_debugfs_dir(fd);

I would prefer to use two variables, one for the debugfs fd and one for 
-errno for the IOCTL below.

With or without the new variable,
Reviewed-by: Antonio Argenziano <antonio.argenziano@intel.com>

> -	if (err != -1) {
> -		igt_sysfs_printf(err, "i915_next_seqno", "1");
> -		close(err);
> +	igt_require(err >= 0);
> +
> +	if (ioctl(fd, DRM_IOCTL_I915_GEM_THROTTLE)) {
> +		igt_warn("Found wedged device, trying to reset and continue\n");
> +		igt_sysfs_set(err, "i915_wedged", "-1");
>   	}
> +	igt_sysfs_set(err, "i915_next_seqno", "1");
> +
> +	close(err);
>   
>   	err = 0;
>   	if (ioctl(fd, DRM_IOCTL_I915_GEM_THROTTLE))
>   		err = -errno;
> +
>   	close(fd);
>   
>   	igt_require_f(err == 0, "Unresponsive i915/GEM device\n");
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [igt-dev] [PATCH igt 1/2] lib: force a reset on an uncooperative i915 device
@ 2018-02-12 21:28   ` Antonio Argenziano
  0 siblings, 0 replies; 7+ messages in thread
From: Antonio Argenziano @ 2018-02-12 21:28 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx; +Cc: igt-dev



On 09/02/18 03:46, Chris Wilson wrote:
> Try to reset the GPU from within igt_require_gem() if we notice we are
> starting with a wedged device. If it remains wedged, the test definitely
> cannot run. We leave a warning in place to highlight the potentially
> suspect result, which will keep the flip-flops alive in CI!
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>   lib/ioctl_wrappers.c | 12 +++++++++---
>   1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
> index 10d958726..5d2c82099 100644
> --- a/lib/ioctl_wrappers.c
> +++ b/lib/ioctl_wrappers.c
> @@ -1428,14 +1428,20 @@ void igt_require_gem(int fd)
>   	 * sequences of batches.
>   	 */
>   	err = igt_debugfs_dir(fd);

I would prefer to use two variables, one for the debugfs fd and one for 
-errno for the IOCTL below.

With or without the new variable,
Reviewed-by: Antonio Argenziano <antonio.argenziano@intel.com>

> -	if (err != -1) {
> -		igt_sysfs_printf(err, "i915_next_seqno", "1");
> -		close(err);
> +	igt_require(err >= 0);
> +
> +	if (ioctl(fd, DRM_IOCTL_I915_GEM_THROTTLE)) {
> +		igt_warn("Found wedged device, trying to reset and continue\n");
> +		igt_sysfs_set(err, "i915_wedged", "-1");
>   	}
> +	igt_sysfs_set(err, "i915_next_seqno", "1");
> +
> +	close(err);
>   
>   	err = 0;
>   	if (ioctl(fd, DRM_IOCTL_I915_GEM_THROTTLE))
>   		err = -errno;
> +
>   	close(fd);
>   
>   	igt_require_f(err == 0, "Unresponsive i915/GEM device\n");
> 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-02-12 21:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-09 11:46 [PATCH igt 1/2] lib: force a reset on an uncooperative i915 device Chris Wilson
2018-02-09 11:46 ` [Intel-gfx] " Chris Wilson
2018-02-09 11:46 ` [PATCH igt 2/2] igt/gem_eio: Use slow spinners to inject hangs Chris Wilson
2018-02-09 11:46   ` [igt-dev] " Chris Wilson
2018-02-09 17:14 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [1/2] lib: force a reset on an uncooperative i915 device Patchwork
2018-02-12 21:28 ` [igt-dev] [PATCH igt 1/2] " Antonio Argenziano
2018-02-12 21:28   ` Antonio Argenziano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.