]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
drm/amdgpu: convert amdgpu_vm_lock_by_pasid() to drm_exec
authorMikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
Fri, 29 May 2026 06:47:38 +0000 (11:47 +0500)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 17 Jun 2026 22:23:43 +0000 (18:23 -0400)
commit9920249a5288e7cbec222cd52996bbd9aac7ec9e
treedfd22dbbdfea9b17135fca94a7525448697d37d0
parent75b3e4d0494f5f831939bec835deceebff0bded7
drm/amdgpu: convert amdgpu_vm_lock_by_pasid() to drm_exec

amdgpu_vm_lock_by_pasid() looks up a VM by PASID and reserves its root
PD with a bare amdgpu_bo_reserve(), returning the still-reserved root to
the caller. A caller that then needs to reserve further BOs (for example
the devcoredump IB dump) ends up nesting reservation_ww_class_mutex
acquires without a ww_acquire_ctx, which lockdep flags as recursive
locking.

Convert the helper to take a drm_exec context and lock the root PD with
drm_exec_lock_obj(). Callers now run it inside a
drm_exec_until_all_locked() loop and can lock additional BOs in the same
ww ticket, so there is no nested ww_mutex acquire.

The drm_exec context holds its own reference on the locked root BO, so
the helper no longer hands a root reference back to the caller: the
root output parameter is dropped, and the transient reference taken
across the PASID lookup is released before returning.

The only existing caller, amdgpu_vm_handle_fault(), is updated
accordingly. Its is_compute_context path, which previously dropped the
root reservation around svm_range_restore_pages() and re-took it, now
finalises the drm_exec context and re-initialises a fresh one; behaviour
is otherwise unchanged.

No functional change intended for the page-fault path.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 14682de8ad377bf13ea66e47c26dcfea0b19a21d)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h