Skip to content

Commit

Permalink
drm/ttm: use RCU in ttm_bo_flush_all_fences
Browse files Browse the repository at this point in the history
This allows it to call the function without the lock held.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: xinhui pan <xinhui.pan@amd.com>
Link: https://patchwork.freedesktop.org/patch/352742/
  • Loading branch information
Christian König committed Feb 11, 2020
1 parent 832c90d commit e81a255
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions drivers/gpu/drm/ttm/ttm_bo.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,22 +429,24 @@ static int ttm_bo_individualize_resv(struct ttm_buffer_object *bo)

static void ttm_bo_flush_all_fences(struct ttm_buffer_object *bo)
{
struct dma_resv *resv = &bo->base._resv;
struct dma_resv_list *fobj;
struct dma_fence *fence;
int i;

fobj = dma_resv_get_list(&bo->base._resv);
fence = dma_resv_get_excl(&bo->base._resv);
rcu_read_lock();
fobj = rcu_dereference(resv->fence);
fence = rcu_dereference(resv->fence_excl);
if (fence && !fence->ops->signaled)
dma_fence_enable_sw_signaling(fence);

for (i = 0; fobj && i < fobj->shared_count; ++i) {
fence = rcu_dereference_protected(fobj->shared[i],
dma_resv_held(bo->base.resv));
fence = rcu_dereference(fobj->shared[i]);

if (!fence->ops->signaled)
dma_fence_enable_sw_signaling(fence);
}
rcu_read_unlock();
}

static void ttm_bo_cleanup_refs_or_queue(struct ttm_buffer_object *bo)
Expand Down

0 comments on commit e81a255

Please sign in to comment.