Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amdgpu/userq: unmap is to be called before freeing doorbell/wptr bo

Unmap the queue after freeing doorbell and wptr memory is completely
wrong. Any operation on the queue needs the doorbell and wptr to be
valid and hence fixing the ordering.

Also since we are using amdgpu_bo_reserve in non interruptrable mode
so there is no need to check for its return values.

Signed-off-by: Sunil Khatri <sunil.khatri@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Sunil Khatri and committed by
Alex Deucher
810df8de 85653fe2

+13 -15
+13 -15
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
··· 639 639 queue->hang_detect_fence = NULL; 640 640 amdgpu_userq_wait_for_last_fence(queue); 641 641 642 - r = amdgpu_bo_reserve(queue->db_obj.obj, true); 643 - if (!r) { 644 - amdgpu_bo_unpin(queue->db_obj.obj); 645 - amdgpu_bo_unreserve(queue->db_obj.obj); 646 - } 647 - amdgpu_bo_unref(&queue->db_obj.obj); 648 - 649 - r = amdgpu_bo_reserve(queue->wptr_obj.obj, true); 650 - if (!r) { 651 - amdgpu_bo_unpin(queue->wptr_obj.obj); 652 - amdgpu_bo_unreserve(queue->wptr_obj.obj); 653 - } 654 - amdgpu_bo_unref(&queue->wptr_obj.obj); 655 - 656 - atomic_dec(&uq_mgr->userq_count[queue->queue_type]); 657 642 #if defined(CONFIG_DEBUG_FS) 658 643 debugfs_remove_recursive(queue->debugfs_queue); 659 644 #endif ··· 649 664 drm_warn(adev_to_drm(uq_mgr->adev), "trying to destroy a HW mapping userq\n"); 650 665 queue->state = AMDGPU_USERQ_STATE_HUNG; 651 666 } 667 + 668 + amdgpu_bo_reserve(queue->db_obj.obj, true); 669 + amdgpu_bo_unpin(queue->db_obj.obj); 670 + amdgpu_bo_unreserve(queue->db_obj.obj); 671 + amdgpu_bo_unref(&queue->db_obj.obj); 672 + 673 + amdgpu_bo_reserve(queue->wptr_obj.obj, true); 674 + amdgpu_bo_unpin(queue->wptr_obj.obj); 675 + amdgpu_bo_unreserve(queue->wptr_obj.obj); 676 + amdgpu_bo_unref(&queue->wptr_obj.obj); 677 + 678 + atomic_dec(&uq_mgr->userq_count[queue->queue_type]); 679 + 652 680 amdgpu_userq_cleanup(queue); 653 681 mutex_unlock(&uq_mgr->userq_mutex); 654 682 pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);