Skip to content

drm/amdgpu: fixes for the VM critical section and page fault rework

Huang Yu amd-gfx 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest13 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/13drm/amdgpu: start to move VM internals into amdgpu_vm_internal.hdrivers/gpu/drm/amd/amdgpu/amdgpu_trace.h drivers/gpu/drm/amd/amdgpu/amdgpu_trace_points.c drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +5 more+162 -1161 reply
2/13drm/amdgpu: remove unecessary parameters from trace_amdgpu_vm_update_ptesdrivers/gpu/drm/amd/amdgpu/amdgpu_trace.h drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c+6 -91 reply
3/13drm/amdgpu: allocate and fill dummy PDs/PTsdrivers/gpu/drm/amd/amdgpu/amdgpu_vm.c drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h drivers/gpu/drm/amd/amdgpu/amdgpu_vm_internal.h +1 more+73 -21 reply
4/13drm/amdgpu: add amdgpu_vm_pt_leaves()drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c drivers/gpu/drm/amd/amdgpu/amdgpu_vm_internal.h drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c+105 -151 reply
5/13drm/amdgpu: drop immediate updates from amdgpu_vm_update_rangedrivers/gpu/drm/amd/amdgpu/amdgpu_vm.c drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h drivers/gpu/drm/amd/amdgpu/amdgpu_vm_internal.h +2 more+24 -360 replies
6/13drm/amdgpu: split amdgpu_vm_update_rangedrivers/gpu/drm/amd/amdgpu/amdgpu_job.h drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +2 more+120 -600 replies
7/13drm/amdgpu: nuke most amdgpu_vm_eviction_(try)lock usesdrivers/gpu/drm/amd/amdgpu/amdgpu_vm.c drivers/gpu/drm/amd/amdgpu/amdgpu_vm_internal.h+12 -240 replies
8/13drm/amdgpu: rework eviction lock handling into critical section v2drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h drivers/gpu/drm/amd/amdgpu/amdgpu_vm_internal.h +1 more+58 -480 replies
9/13drm/amdgpu: free PT when VM critical section cannot resumedrivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c+6 -20 replies
10/13drm/amdgpu: fix the HMM range handling for KFD SVMdrivers/gpu/drm/amd/amdgpu/amdgpu_vm.c drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h drivers/gpu/drm/amd/amdgpu/amdgpu_vm_internal.h +1 more+34 -220 replies
11/13drm/amdgpu: update the PTB itself in amdgpu_vm_pt_leaves()drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c+15 -60 replies
12/13drm/amdgpu: pass an exclusive end to amdgpu_vm_pt_leaves()drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c+2 -20 replies
13/13drm/amdgpu: use directory flags for dummy PDEsdrivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c+27 -120 replies

Reviews trailers per patch

3 of 13 patches have a Reviewed-by or Acked-by.

PatchYu HuangTimur Kristóf
1/13R-b
2/13R-b
3/13R-b
4/13
5/13
6/13
7/13
8/13
9/13
10/13
11/13
12/13
13/13Authored-by

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 00/13] drm/amdgpu: fixes for the VM critical section and page fault rework

Hi Christian,

patches 1-8 and 10 are your VM rework. The other four are fixes found while testing it with KFD SVM on top:

1. patch 09: amdgpu_vm_pt_alloc() leaks the new PT BO when the allocation succeeds but the VM is evicting once the critical section is re-entered. Release the unpublished BO, keep the critical section owned by the caller.

2. patch 11: amdgpu_vm_pt_leaves() always updated cursor.parent->bo, so a walk stopping at an allocated PTB wrote a PDE in the parent instead of the PTEs in the leaf. Use the entry's own BO and level, and go through amdgpu_vm_pte_update_flags().

3. patch 12: both callers passed an inclusive last address, but amdgpu_vm_pt_leaves() works on a half-open range. That dropped the last page in amdgpu_vm_unmap_range(), and made amdgpu_vm_handle_fault() skip the loop entirely, so AMDGPU_VM_NORETRY_FLAGS were never written and the wave kept retrying.

4. patch 13: for a redirect to the dummy hierarchy above the PTE level the entry points to the next-level dummy PD/PT, but amdgpu_vm_pte_update_flags() treats everything above PTB as a leaf and applies AMDGPU_PDE_PTE_FLAG(). Encode it with amdgpu_gmc_get_pde_for_bo() instead.

One question on patch 13: it special cases the dummy PDE inside amdgpu_vm_pt_leaves(), which adds a second update path next to amdgpu_vm_pte_update_flags(). The alternatives are to let amdgpu_vm_pte_update_flags() encode a directory entry when the level is not AMDGPU_VM_PTB, or to pass already encoded dummy PDEs in dst[] from amdgpu_vm_handle_fault(). Which one do you prefer?

Thanks,
Yu

Christian König (9):
drm/amdgpu: start to move VM internals into amdgpu_vm_internal.h drm/amdgpu: remove unecessary parameters from
trace_amdgpu_vm_update_ptes
drm/amdgpu: allocate and fill dummy PDs/PTs
drm/amdgpu: add amdgpu_vm_pt_leaves()
drm/amdgpu: drop immediate updates from amdgpu_vm_update_range drm/amdgpu: split amdgpu_vm_update_range
drm/amdgpu: nuke most amdgpu_vm_eviction_(try)lock uses drm/amdgpu: rework eviction lock handling into critical section v2 drm/amdgpu: fix the HMM range handling for KFD SVM

Yu Huang (4):
drm/amdgpu: free PT when VM critical section cannot resume drm/amdgpu: update the PTB itself in amdgpu_vm_pt_leaves() drm/amdgpu: pass an exclusive end to amdgpu_vm_pt_leaves() drm/amdgpu: use directory flags for dummy PDEs

Signature · 1 line
2.53.0