Commit 937c3471 authored by Francisco Jerez's avatar Francisco Jerez

drm/nouveau: Avoid potential race between nouveau_fence_update() and context takedown.

Signed-off-by: default avatarFrancisco Jerez <currojerez@riseup.net>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent a8b214f0
...@@ -77,6 +77,8 @@ nouveau_fence_update(struct nouveau_channel *chan) ...@@ -77,6 +77,8 @@ nouveau_fence_update(struct nouveau_channel *chan)
spin_lock(&chan->fence.lock); spin_lock(&chan->fence.lock);
/* Fetch the last sequence if the channel is still up and running */
if (likely(!list_empty(&chan->fence.pending))) {
if (USE_REFCNT(dev)) if (USE_REFCNT(dev))
sequence = nvchan_rd32(chan, 0x48); sequence = nvchan_rd32(chan, 0x48);
else else
...@@ -85,6 +87,7 @@ nouveau_fence_update(struct nouveau_channel *chan) ...@@ -85,6 +87,7 @@ nouveau_fence_update(struct nouveau_channel *chan)
if (chan->fence.sequence_ack == sequence) if (chan->fence.sequence_ack == sequence)
goto out; goto out;
chan->fence.sequence_ack = sequence; chan->fence.sequence_ack = sequence;
}
list_for_each_entry_safe(fence, tmp, &chan->fence.pending, entry) { list_for_each_entry_safe(fence, tmp, &chan->fence.pending, entry) {
sequence = fence->sequence; sequence = fence->sequence;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment