diff options
author | Francisco Jerez <currojerez@riseup.net> | 2010-12-08 02:35:45 +0100 |
---|---|---|
committer | Francisco Jerez <currojerez@riseup.net> | 2010-12-08 03:01:02 +0100 |
commit | 937c3471cc8b7ef8f9e382d9e4ec232db151ea7b (patch) | |
tree | c23158acf5103cab3306206fdb7839712e6201d9 /drivers/gpu | |
parent | a8b214f007e299225d3fcf10c46f7fc603c275fa (diff) | |
download | linux-3.10-937c3471cc8b7ef8f9e382d9e4ec232db151ea7b.tar.gz linux-3.10-937c3471cc8b7ef8f9e382d9e4ec232db151ea7b.tar.bz2 linux-3.10-937c3471cc8b7ef8f9e382d9e4ec232db151ea7b.zip |
drm/nouveau: Avoid potential race between nouveau_fence_update() and context takedown.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_fence.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c index 01290d2952a..374a9793b85 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fence.c +++ b/drivers/gpu/drm/nouveau/nouveau_fence.c @@ -77,14 +77,17 @@ nouveau_fence_update(struct nouveau_channel *chan) spin_lock(&chan->fence.lock); - if (USE_REFCNT(dev)) - sequence = nvchan_rd32(chan, 0x48); - else - sequence = atomic_read(&chan->fence.last_sequence_irq); - - if (chan->fence.sequence_ack == sequence) - goto out; - chan->fence.sequence_ack = sequence; + /* Fetch the last sequence if the channel is still up and running */ + if (likely(!list_empty(&chan->fence.pending))) { + if (USE_REFCNT(dev)) + sequence = nvchan_rd32(chan, 0x48); + else + sequence = atomic_read(&chan->fence.last_sequence_irq); + + if (chan->fence.sequence_ack == sequence) + goto out; + chan->fence.sequence_ack = sequence; + } list_for_each_entry_safe(fence, tmp, &chan->fence.pending, entry) { sequence = fence->sequence; |