[Nouveau] [PATCH] drm/nouveau: Fix a race condition in nouveau_fence_emit.

Francisco Jerez currojerez at riseup.net
Wed Sep 16 05:36:49 PDT 2009


On early cards relying on synthetic methods for fence signalling
(nv0x) the IRQ was sometimes raised before the fence had been appended
to the pending list. In that case it remained unsignalled and it
caused trouble (bug 23593).

Signed-off-by: Francisco Jerez <currojerez at riseup.net>
---
 drivers/gpu/drm/nouveau/nouveau_fence.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c
index 32b4bb9..ad98e9b 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fence.c
+++ b/drivers/gpu/drm/nouveau/nouveau_fence.c
@@ -137,14 +137,15 @@ nouveau_fence_emit(struct nouveau_fence *fence)
 
 	fence->sequence = ++chan->fence.sequence;
 
-	BEGIN_RING(chan, NvSubM2MF, USE_REFCNT ? 0x0050 : 0x0150, 1);
-	OUT_RING  (chan, fence->sequence);
-	FIRE_RING (chan);
-
 	kref_get(&fence->refcount);
 	spin_lock_irqsave(&chan->fence.lock, flags);
 	list_add_tail(&fence->entry, &chan->fence.pending);
 	spin_unlock_irqrestore(&chan->fence.lock, flags);
+
+	BEGIN_RING(chan, NvSubM2MF, USE_REFCNT ? 0x0050 : 0x0150, 1);
+	OUT_RING  (chan, fence->sequence);
+	FIRE_RING (chan);
+
 	return 0;
 }
 
-- 
1.6.3.3



More information about the Nouveau mailing list