All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] dma-buf/fence: make timeout handling in fence_default_wait consistent (v2)
@ 2016-11-07 21:16 Alex Deucher
       [not found] ` <1478553376-18575-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Alex Deucher @ 2016-11-07 21:16 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Alex Deucher, sumit.semwal-QSEj5FYQhm4dnm+yROfE0A

Kernel functions taking a timeout usually return 1 on success even
when they get a zero timeout.

v2: agd: rebase on drm-next

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signen-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---

These are the same patches Christian sent out previously, just
rebased on the fence naming changes in drm-next.

drivers/dma-buf/dma-fence.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
index 0c3141e7..6c3f6b4 100644
--- a/drivers/dma-buf/dma-fence.c
+++ b/drivers/dma-buf/dma-fence.c
@@ -339,18 +339,20 @@ dma_fence_default_wait_cb(struct dma_fence *fence, struct dma_fence_cb *cb)
  * @timeout:	[in]	timeout value in jiffies, or MAX_SCHEDULE_TIMEOUT
  *
  * Returns -ERESTARTSYS if interrupted, 0 if the wait timed out, or the
- * remaining timeout in jiffies on success.
+ * remaining timeout in jiffies on success. If timeout is zero the value one is
+ * returned if the fence is already signaled for consistency with other
+ * functions taking a jiffies timeout.
  */
 signed long
 dma_fence_default_wait(struct dma_fence *fence, bool intr, signed long timeout)
 {
 	struct default_wait_cb cb;
 	unsigned long flags;
-	signed long ret = timeout;
+	signed long ret = timeout ? timeout : 1;
 	bool was_set;
 
 	if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags))
-		return timeout;
+		return ret;
 
 	spin_lock_irqsave(fence->lock, flags);
 
-- 
2.5.5

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

^ permalink raw reply related	[flat|nested] 7+ messages in thread
* Fixing zero timeout handling for fence functions
@ 2016-10-25 12:25 Christian König
  2016-10-25 12:25 ` [PATCH 4/4] reservation: revert "wait only with non-zero timeout specified (v3)" v2 Christian König
  0 siblings, 1 reply; 7+ messages in thread
From: Christian König @ 2016-10-25 12:25 UTC (permalink / raw)
  To: sumit.semwal; +Cc: dri-devel

Hi Sumit,

sending this once more with all the patches in once set, cause the last one
turned out to be a bit chaotic because I send from the wrong branch.

The following patch set fixes the handling in the fence and reservation object
wait function when the timeout is zero.

An AMD developer introduced this a while ago to work around some issues in TTM
and our amdgpu driver, but essentially this effort was a bit flawed because
even with a zero timeout enable_signalling() should be called.

Otherwise someone busy waiting for the fence might never be signaled when you
have hardware with faulty interrupts for example.

Please review and/or comment,
Christian.

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2016-11-08 19:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-07 21:16 [PATCH 1/4] dma-buf/fence: make timeout handling in fence_default_wait consistent (v2) Alex Deucher
     [not found] ` <1478553376-18575-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
2016-11-07 21:16   ` [PATCH 2/4] dma-buf/fence: revert "don't wait when specified timeout is zero" (v2) Alex Deucher
2016-11-07 21:16 ` [PATCH 3/4] drm/ttm: fix ttm_bo_wait Alex Deucher
2016-11-07 21:16 ` [PATCH 4/4] reservation: revert "wait only with non-zero timeout specified (v3)" v2 Alex Deucher
2016-11-08  0:50   ` Gustavo Padovan
2016-11-08 19:35 ` [PATCH 1/4] dma-buf/fence: make timeout handling in fence_default_wait consistent (v2) Sumit Semwal
  -- strict thread matches above, loose matches on Subject: below --
2016-10-25 12:25 Fixing zero timeout handling for fence functions Christian König
2016-10-25 12:25 ` [PATCH 4/4] reservation: revert "wait only with non-zero timeout specified (v3)" v2 Christian König

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.