[PATCH igt] igt/gem_exec_fence: Check sync_file->status after the fence is signaled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



After the fence is signaled, the status feed reports whether or not the
request completed successfully. We set this to -EIO if a hang was
detected.

Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
---
 tests/gem_exec_fence.c | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/tests/gem_exec_fence.c b/tests/gem_exec_fence.c
index ea007468..4fe1bcee 100644
--- a/tests/gem_exec_fence.c
+++ b/tests/gem_exec_fence.c
@@ -91,6 +91,46 @@ static void store(int fd, unsigned ring, int fence, uint32_t target, unsigned of
 	gem_close(fd, obj[BATCH].handle);
 }
 
+struct local_sync_fence_info {
+	char obj_name[32];
+	char driver_name[32];
+
+	__s32 status;
+	__u32 flags;
+
+	__u64 timestamp_ns;
+};
+
+struct local_sync_file_info {
+	char  name[32];
+
+	__s32 status;
+	__u32 flags;
+	__u32 num_fences;
+	__u32 pad;
+
+	__u64 sync_fence_info;
+};
+
+#define UABI_SYNC_IOC_MAGIC '>'
+#define LOCAL_SYNC_IOC_FILE_INFO        _IOWR(UABI_SYNC_IOC_MAGIC, 4, struct local_sync_file_info)
+
+#define FENCE_OK 1
+
+static int fence_status(int fence)
+{
+	struct local_sync_fence_info fence_info;
+	struct local_sync_file_info info = {
+		.num_fences = 1,
+		.sync_fence_info = to_user_pointer(&fence_info),
+	};
+
+	(void)ioctl(fence, LOCAL_SYNC_IOC_FILE_INFO, &info);
+	igt_assert(info.num_fences == 1);
+
+	return fence_info.status;
+}
+
 static int __gem_execbuf_wr(int fd, struct drm_i915_gem_execbuffer2 *execbuf)
 {
 	int err = 0;
@@ -194,6 +234,7 @@ static void test_fence_busy(int fd, unsigned ring, unsigned flags)
 	}
 
 	igt_assert(!gem_bo_busy(fd, obj.handle));
+	igt_assert_eq(fence_status(fence), flags & HANG ? -EIO : FENCE_OK);
 
 	close(fence);
 	gem_close(fd, obj.handle);
-- 
2.11.0

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




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux