All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/15] drm/radeon: add error handling to fence_wait_empty_locked
@ 2012-07-10 12:51 Christian König
  2012-07-10 12:51 ` [PATCH 02/15] drm/radeon: add error handling to radeon_vm_unbind_locked Christian König
                   ` (13 more replies)
  0 siblings, 14 replies; 19+ messages in thread
From: Christian König @ 2012-07-10 12:51 UTC (permalink / raw)
  To: dri-devel

Instead of returning the error handle it directly
and while at it fix the comments about the ring lock.

Signed-off-by: Christian König <deathsimple@vodafone.de>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
---
 drivers/gpu/drm/radeon/radeon.h       |    2 +-
 drivers/gpu/drm/radeon/radeon_fence.c |   33 +++++++++++++++++++++------------
 2 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 77b4519b..5861ec8 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -239,7 +239,7 @@ void radeon_fence_process(struct radeon_device *rdev, int ring);
 bool radeon_fence_signaled(struct radeon_fence *fence);
 int radeon_fence_wait(struct radeon_fence *fence, bool interruptible);
 int radeon_fence_wait_next_locked(struct radeon_device *rdev, int ring);
-int radeon_fence_wait_empty_locked(struct radeon_device *rdev, int ring);
+void radeon_fence_wait_empty_locked(struct radeon_device *rdev, int ring);
 int radeon_fence_wait_any(struct radeon_device *rdev,
 			  struct radeon_fence **fences,
 			  bool intr);
diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c
index 7b55625..be4e4f3 100644
--- a/drivers/gpu/drm/radeon/radeon_fence.c
+++ b/drivers/gpu/drm/radeon/radeon_fence.c
@@ -440,14 +440,11 @@ int radeon_fence_wait_any(struct radeon_device *rdev,
 	return 0;
 }
 
+/* caller must hold ring lock */
 int radeon_fence_wait_next_locked(struct radeon_device *rdev, int ring)
 {
 	uint64_t seq;
 
-	/* We are not protected by ring lock when reading current seq but
-	 * it's ok as worst case is we return to early while we could have
-	 * wait.
-	 */
 	seq = atomic64_read(&rdev->fence_drv[ring].last_seq) + 1ULL;
 	if (seq >= rdev->fence_drv[ring].sync_seq[ring]) {
 		/* nothing to wait for, last_seq is
@@ -457,15 +454,27 @@ int radeon_fence_wait_next_locked(struct radeon_device *rdev, int ring)
 	return radeon_fence_wait_seq(rdev, seq, ring, false, false);
 }
 
-int radeon_fence_wait_empty_locked(struct radeon_device *rdev, int ring)
+/* caller must hold ring lock */
+void radeon_fence_wait_empty_locked(struct radeon_device *rdev, int ring)
 {
-	/* We are not protected by ring lock when reading current seq
-	 * but it's ok as wait empty is call from place where no more
-	 * activity can be scheduled so there won't be concurrent access
-	 * to seq value.
-	 */
-	return radeon_fence_wait_seq(rdev, rdev->fence_drv[ring].sync_seq[ring],
-				     ring, false, false);
+	uint64_t seq = rdev->fence_drv[ring].sync_seq[ring];
+
+	while(1) {
+		int r;
+		r = radeon_fence_wait_seq(rdev, seq, ring, false, false);
+		if (r == -EDEADLK) {
+			mutex_unlock(&rdev->ring_lock);
+			r = radeon_gpu_reset(rdev);
+			mutex_lock(&rdev->ring_lock);
+			if (!r)
+				continue;
+		}
+		if (r) {
+			dev_err(rdev->dev, "error waiting for ring to become"
+				" idle (%d)\n", r);
+		}
+		return;
+	}
 }
 
 struct radeon_fence *radeon_fence_ref(struct radeon_fence *fence)
-- 
1.7.9.5

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

^ permalink raw reply related	[flat|nested] 19+ messages in thread
* Ring saving patches round 3
@ 2012-07-12 16:12 Christian König
  2012-07-12 16:12 ` [PATCH 07/15] drm/radeon: fix fence init after resume Christian König
  0 siblings, 1 reply; 19+ messages in thread
From: Christian König @ 2012-07-12 16:12 UTC (permalink / raw)
  To: dri-devel

I hope that this is the last round necessary, beside including
all the comments from Michel and Jerome there is a small change
to patch 15 to not save anything if the all fences on a ring
are already signaled.

The branch is also available as:
    git://people.freedesktop.org/~deathsimple/linux next

Cheers,
Christian.

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

end of thread, other threads:[~2012-07-12 16:13 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-10 12:51 [PATCH 01/15] drm/radeon: add error handling to fence_wait_empty_locked Christian König
2012-07-10 12:51 ` [PATCH 02/15] drm/radeon: add error handling to radeon_vm_unbind_locked Christian König
2012-07-10 12:51 ` [PATCH 03/15] drm/radeon: fix fence related segfault in CS Christian König
2012-07-10 12:51 ` [PATCH 04/15] drm/radeon: add an exclusive lock for GPU reset v2 Christian König
2012-07-10 12:51 ` [PATCH 05/15] drm/radeon: fix ring commit padding Christian König
2012-07-10 12:51 ` [PATCH 06/15] drm/radeon: fix fence value access Christian König
2012-07-10 12:51 ` [PATCH 07/15] drm/radeon: fix fence init after resume Christian König
2012-07-10 12:51 ` [PATCH 08/15] drm/radeon: remove FIXME comment from chipset suspend Christian König
2012-07-10 12:51 ` [PATCH 09/15] drm/radeon: make cp init on cayman more robust Christian König
2012-07-10 12:51 ` [PATCH 10/15] drm/radeon: remove ip_pool start/suspend Christian König
2012-07-10 12:51 ` [PATCH 11/15] drm/radeon: remove r600_blit_suspend Christian König
2012-07-10 12:51 ` [PATCH 12/15] drm/radeon: remove vm_manager start/suspend Christian König
2012-07-10 12:51 ` [PATCH 13/15] drm/radeon: move radeon_ib_ring_tests out of chipset code Christian König
2012-07-10 12:51 ` [PATCH 14/15] drm/radeon: record what is next valid wptr for each ring v2 Christian König
2012-07-10 16:56   ` Jerome Glisse
2012-07-11  8:08     ` Christian König
2012-07-10 12:51 ` [PATCH 15/15] drm/radeon: implement ring saving on reset v2 Christian König
2012-07-10 14:50   ` Michel Dänzer
2012-07-12 16:12 Ring saving patches round 3 Christian König
2012-07-12 16:12 ` [PATCH 07/15] drm/radeon: fix fence init after resume 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.