summaryrefslogtreecommitdiff
path: root/lib/igt_dummyload.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2018-02-20 23:37:16 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2018-03-01 07:53:58 +0000
commit5aed726a723d0abd42e36a26dd6349739fefd568 (patch)
treea3c7c895f547f8c7fd574345c1641aac192e9b80 /lib/igt_dummyload.c
parent0d47ec161b4eca1b41c5348604aa05b105e5d1cf (diff)
lib/dummyload: Avoid assertions in lowlevel spin constructor
__igt_spin_batch_new() may be used inside a background helper which is competing against the GPU being reset. As such, we cannot even assert that the spin->handle is busy immediately after submission as it may have already been reset by another client writing to i915_wedged. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
Diffstat (limited to 'lib/igt_dummyload.c')
-rw-r--r--lib/igt_dummyload.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c
index ddd43451..4b20f23d 100644
--- a/lib/igt_dummyload.c
+++ b/lib/igt_dummyload.c
@@ -25,6 +25,7 @@
#include <time.h>
#include <signal.h>
#include <pthread.h>
+#include <sys/poll.h>
#include <i915_drm.h>
@@ -207,7 +208,6 @@ ___igt_spin_batch_new(int fd, uint32_t ctx, unsigned engine, uint32_t dep,
spin->out_fence = emit_recursive_batch(spin, fd, ctx, engine, dep,
out_fence);
- igt_assert(gem_bo_busy(fd, spin->handle));
pthread_mutex_lock(&list_lock);
igt_list_add(&spin->link, &spin_list);
@@ -240,9 +240,14 @@ __igt_spin_batch_new(int fd, uint32_t ctx, unsigned engine, uint32_t dep)
igt_spin_t *
igt_spin_batch_new(int fd, uint32_t ctx, unsigned engine, uint32_t dep)
{
+ igt_spin_t *spin;
+
igt_require_gem(fd);
- return __igt_spin_batch_new(fd, ctx, engine, dep);
+ spin = __igt_spin_batch_new(fd, ctx, engine, dep);
+ igt_assert(gem_bo_busy(fd, spin->handle));
+
+ return spin;
}
igt_spin_t *
@@ -269,10 +274,16 @@ __igt_spin_batch_new_fence(int fd, uint32_t ctx, unsigned engine)
igt_spin_t *
igt_spin_batch_new_fence(int fd, uint32_t ctx, unsigned engine)
{
+ igt_spin_t *spin;
+
igt_require_gem(fd);
igt_require(gem_has_exec_fence(fd));
- return __igt_spin_batch_new_fence(fd, ctx, engine);
+ spin = __igt_spin_batch_new_fence(fd, ctx, engine);
+ igt_assert(gem_bo_busy(fd, spin->handle));
+ igt_assert(poll(&(struct pollfd){spin->out_fence, POLLIN}, 1, 0) == 0);
+
+ return spin;
}
static void notify(union sigval arg)