winsys/amdgpu: destroy bo_fence_lock late in do_winsys_deinit()

In case of userq when destroying bo, fences are gathered and passed to kernel.
Fences are gathered using bo_fence_lock, In do_winsys_deinit() currently
bo_cache is destroyed after destroying bo_fence_lock. This leads to crash.
Fix this by moving destroying bo_fence_lock late in do_winsys_deinit().

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29010>
This commit is contained in:
Yogesh Mohan Marimuthu
2024-10-22 06:50:48 +05:30
committed by Marge Bot
parent 30e95cfd87
commit 37b217b0fb
@@ -91,7 +91,6 @@ static void do_winsys_deinit(struct amdgpu_winsys *aws)
if (util_queue_is_initialized(&aws->cs_queue))
util_queue_destroy(&aws->cs_queue);
simple_mtx_destroy(&aws->bo_fence_lock);
if (aws->bo_slabs.groups)
pb_slabs_deinit(&aws->bo_slabs);
pb_cache_deinit(&aws->bo_cache);
@@ -105,6 +104,7 @@ static void do_winsys_deinit(struct amdgpu_winsys *aws)
ac_addrlib_destroy(aws->addrlib);
amdgpu_device_deinitialize(aws->dev);
drmSyncobjDestroy(aws->fd, aws->vm_timeline_syncobj);
simple_mtx_destroy(&aws->bo_fence_lock);
FREE(aws);
}