• Emily Deng's avatar
    drm/sched: add rcu_barrier after entity fini · 52bf20f4
    Emily Deng authored
    To free the fence from the amdgpu_fence_slab, need twice call_rcu, to avoid
    the amdgpu_fence_slab_fini call kmem_cache_destroy(amdgpu_fence_slab) before
    kmem_cache_free(amdgpu_fence_slab, fence), add rcu_barrier after drm_sched_entity_fini.
    
    The kmem_cache_free(amdgpu_fence_slab, fence)'s call trace as below:
    1.drm_sched_entity_fini ->
    drm_sched_entity_cleanup ->
    dma_fence_put(entity->last_scheduled) ->
    drm_sched_fence_release_finished ->
    drm_sched_fence_release_scheduled ->
    call_rcu(&fence->finished.rcu, drm_sched_fence_free)
    
    2.drm_sched_fence_free ->
    dma_fence_put(fence->parent) ->
    amdgpu_fence_release ->
    call_rcu(&f->rcu, amdgpu_fence_free) ->
    kmem_cache_free(amdgpu_fence_slab, fence);
    
    v2:put the barrier before the kmem_cache_destroy
    v3:put the dma_fence_put(fence->parent) before call_rcu in
    drm_sched_fence_release_scheduled
    Signed-off-by: default avatarEmily Deng <Emily.Deng@amd.com>
    Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
    Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
    52bf20f4
sched_fence.c 5.37 KB