diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-12-15 09:30:28 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-12-15 09:31:42 +0000 |
commit | e3153a779ed220ad71958ce56be179d458794964 (patch) | |
tree | 7a7bd08da2c41989d81225e720a1764078c01896 | |
parent | 1cc43dc97bd6438d7fc808cb5ee449889a966bdf (diff) |
sna: cap the number of times we attempt to resubmit the batch upon EBUSY
Just in case the kernel gets stuck in a loop and we fail to make any
progress at all.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/kgem.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c index fbff0514..a6610414 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -1072,7 +1072,7 @@ void _kgem_submit(struct kgem *kgem) assert(rq->bo->gpu == 0); if (kgem_batch_write(kgem, handle) == 0) { struct drm_i915_gem_execbuffer2 execbuf; - int ret; + int ret, retry = 3; VG_CLEAR(execbuf); execbuf.buffers_ptr = (uintptr_t)kgem->exec; @@ -1100,13 +1100,13 @@ void _kgem_submit(struct kgem *kgem) ret = drmIoctl(kgem->fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf); - while (ret == -1 && errno == EBUSY) { + while (ret == -1 && errno == EBUSY && retry--) { drmCommandNone(kgem->fd, DRM_I915_GEM_THROTTLE); ret = drmIoctl(kgem->fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf); } - if (ret == -1 && errno == EIO) { + if (ret == -1 && (errno == EIO || errno == EBUSY)) { DBG(("%s: GPU hang detected\n", __FUNCTION__)); kgem->wedged = 1; ret = 0; |