From 5817efe432217826dc2175148ac13226a1f42afd Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Mon, 18 Jun 2018 15:00:22 +0200 Subject: vmwgfx: Don't time out on fence waits Never time out on fence waits, but instead print an error message and restart the wait. Signed-off-by: Thomas Hellstrom Reviewed-by: Sinclair Yeh Reviewed-by: Brian Paul Reviewed-by: Deepak Rawat --- vmwgfx_fence.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/vmwgfx_fence.c b/vmwgfx_fence.c index 8f1b0d4..7b5314a 100644 --- a/vmwgfx_fence.c +++ b/vmwgfx_fence.c @@ -150,6 +150,24 @@ static bool vmw_fence_enable_signaling(struct dma_fence *f) return true; } +static signed long vmw_fence_timeout_error(struct dma_fence *f, + signed long timeout) +{ + struct vmw_fence_obj *fence = + container_of(f, struct vmw_fence_obj, base); + struct vmw_fence_manager *fman = fman_from_fence(fence); + struct vmw_private *dev_priv = fman->dev_priv; + u32 *fifo_mem = dev_priv->mmio_virt; + + DRM_ERROR("Fence timeout after %ld ticks. " + "Ignoring and restarting wait.\n", timeout); + DRM_ERROR("Fence seqno: %lu, Last signaled: %lu\n", + (unsigned long) f->seqno, + (unsigned long) vmw_mmio_read(fifo_mem + SVGA_FIFO_FENCE)); + + return timeout; +}; + struct vmwgfx_wait_cb { struct dma_fence_cb base; struct task_struct *task; @@ -217,8 +235,11 @@ static long vmw_fence_wait(struct dma_fence *f, bool intr, signed long timeout) break; } - if (ret == 0) - break; + if (ret == 0) { + ret = vmw_fence_timeout_error(f, timeout); + if (ret == 0) + break; + } spin_unlock(f->lock); -- cgit v1.2.3