amdgpu_vm_lock_by_pasid(9)
π amdgpu_vm_lock_by_pasid(9) π
okay so bestie, we're looking at amdgpu_vm_lock_by_pasid from the Kernel API Manual β and no cap, this one's a little baddie that does exactly what it says on the tin: it finds a VM by its PASID and locks that root PD. let's get into it β¨
πΈ SYNOPSIS πΈ
struct amdgpu_vm * amdgpu_vm_lock_by_pasid (struct amdgpu_device *adev ,
u32 pasid , struct drm_exec *exec );
like, she takes three things and gives you back a VM pointer (or doesn't, we'll get there π)
π ARGUMENTS π
adevβ the amdgpu device pointer, aka the whole vibe of your GPU right herepasidβ the PASID of the VM, her little ID badge so you know which one you're lockingexecβ thedrm_execcontext where we're locking the root PD in, this is the container she does her work in, periodt
π¦ DESCRIPTION π¦
so here's the tea β β this function must be called from inside a drm_exec_until_all_locked loop. and then the caller runs drm_exec_retry_on_contention afterwards. like, that's the rules, okay?
the drm_exec context holds a reference on the root BO until it gets finalised. so she's holding onto it, keeping it safe, main character energy fr fr π
β RETURN β
you get the VM on success, slay π β OR you get NULL if:
- the PASID has no VM (sad, empty, no vibes)
- the VM is being torn down (rip to her)
- or locking the root PD failed π
so like, check your return value bestie, don't assume β¨
π SEE ALSO π
okay this list is long so buckle up buttercup, she references a LOT of her friends:
- Kernel file
./drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c GPUVM(9)struct amdgpu_prt_cb(9)struct amdgpu_vm_tlb_seq_struct(9)amdgpu_vm_assert_locked(9)amdgpu_vm_is_bo_always_valid(9)amdgpu_vm_bo_evicted(9)amdgpu_vm_bo_needs_update(9)amdgpu_vm_bo_idle(9)amdgpu_vm_bo_reset_state_machine(9)amdgpu_vm_update_shared(9)amdgpu_vm_bo_update_shared(9)amdgpu_vm_update_stats_locked(9)amdgpu_vm_update_stats(9)amdgpu_vm_bo_base_init(9)amdgpu_vm_lock_pd(9)amdgpu_vm_lock_individual(9)amdgpu_vm_move_to_lru_tail(9)amdgpu_vm_generation(9)amdgpu_vm_validate(9)amdgpu_vm_ready(9)amdgpu_vm_check_compute_bug(9)amdgpu_vm_need_pipeline_sync(9)amdgpu_vm_flush(9)amdgpu_vm_bo_find(9)amdgpu_vm_map_gart(9)amdgpu_vm_update_pdes(9)amdgpu_vm_tlb_seq_cb(9)amdgpu_vm_tlb_flush(9)amdgpu_vm_update_range(9)amdgpu_vm_bo_update(9)amdgpu_vm_update_prt_state(9)amdgpu_vm_prt_get(9)amdgpu_vm_prt_put(9)amdgpu_vm_prt_cb(9)amdgpu_vm_add_prt_cb(9)amdgpu_vm_free_mapping(9)amdgpu_vm_prt_fini(9)amdgpu_vm_clear_freed(9)amdgpu_vm_handle_moved(9)amdgpu_vm_flush_compute_tlb(9)amdgpu_vm_bo_add(9)amdgpu_vm_bo_insert_map(9)amdgpu_vm_bo_map(9)amdgpu_vm_bo_replace_map(9)amdgpu_vm_bo_unmap(9)amdgpu_vm_bo_clear_mappings(9)amdgpu_vm_bo_lookup_mapping(9)amdgpu_vm_bo_trace_cs(9)amdgpu_vm_bo_del(9)amdgpu_vm_evictable(9)amdgpu_vm_bo_invalidate(9)amdgpu_vm_bo_move(9)amdgpu_vm_get_block_size(9)amdgpu_vm_adjust_size(9)amdgpu_vm_wait_idle(9)amdgpu_vm_put_task_info(9)amdgpu_vm_get_task_info_vm(9)amdgpu_vm_get_task_info_pasid(9)amdgpu_vm_set_task_info(9)amdgpu_vm_init(9)amdgpu_vm_make_compute(9)amdgpu_vm_fini(9)amdgpu_vm_manager_init(9)amdgpu_vm_manager_fini(9)amdgpu_vm_ioctl(9)amdgpu_vm_handle_fault(9)amdgpu_debugfs_vm_bo_info(9)amdgpu_vm_update_fault_cache(9)
like I said β she knows everyone π iykyk
that's the whole page bestie, go forth and lock those root PDs responsibly π«Ά
and like, credit where it's due β this whole thing lives in ./drivers/gpu/drm/amd/amdgpu, dated October 2026, and yes it's giving very much official Kernel API Manual realness. bye bestie, mwah πβ¨π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms