@@ -1854,6 +1854,7 @@ int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu(
18541854err_bo_create :
18551855 amdgpu_amdkfd_unreserve_mem_limit (adev , aligned_size , flags , xcp_id );
18561856err_reserve_limit :
1857+ amdgpu_sync_free (& (* mem )-> sync );
18571858 mutex_destroy (& (* mem )-> lock );
18581859 if (gobj )
18591860 drm_gem_object_put (gobj );
@@ -2900,13 +2901,12 @@ int amdgpu_amdkfd_gpuvm_restore_process_bos(void *info, struct dma_fence __rcu *
29002901
29012902 amdgpu_sync_create (& sync_obj );
29022903
2903- /* Validate BOs and map them to GPUVM (update VM page tables). */
2904+ /* Validate BOs managed by KFD */
29042905 list_for_each_entry (mem , & process_info -> kfd_bo_list ,
29052906 validate_list ) {
29062907
29072908 struct amdgpu_bo * bo = mem -> bo ;
29082909 uint32_t domain = mem -> domain ;
2909- struct kfd_mem_attachment * attachment ;
29102910 struct dma_resv_iter cursor ;
29112911 struct dma_fence * fence ;
29122912
@@ -2931,6 +2931,25 @@ int amdgpu_amdkfd_gpuvm_restore_process_bos(void *info, struct dma_fence __rcu *
29312931 goto validate_map_fail ;
29322932 }
29332933 }
2934+ }
2935+
2936+ if (failed_size )
2937+ pr_debug ("0x%lx/0x%lx in system\n" , failed_size , total_size );
2938+
2939+ /* Validate PDs, PTs and evicted DMABuf imports last. Otherwise BO
2940+ * validations above would invalidate DMABuf imports again.
2941+ */
2942+ ret = process_validate_vms (process_info , & exec .ticket );
2943+ if (ret ) {
2944+ pr_debug ("Validating VMs failed, ret: %d\n" , ret );
2945+ goto validate_map_fail ;
2946+ }
2947+
2948+ /* Update mappings managed by KFD. */
2949+ list_for_each_entry (mem , & process_info -> kfd_bo_list ,
2950+ validate_list ) {
2951+ struct kfd_mem_attachment * attachment ;
2952+
29342953 list_for_each_entry (attachment , & mem -> attachments , list ) {
29352954 if (!attachment -> is_mapped )
29362955 continue ;
@@ -2947,18 +2966,6 @@ int amdgpu_amdkfd_gpuvm_restore_process_bos(void *info, struct dma_fence __rcu *
29472966 }
29482967 }
29492968
2950- if (failed_size )
2951- pr_debug ("0x%lx/0x%lx in system\n" , failed_size , total_size );
2952-
2953- /* Validate PDs, PTs and evicted DMABuf imports last. Otherwise BO
2954- * validations above would invalidate DMABuf imports again.
2955- */
2956- ret = process_validate_vms (process_info , & exec .ticket );
2957- if (ret ) {
2958- pr_debug ("Validating VMs failed, ret: %d\n" , ret );
2959- goto validate_map_fail ;
2960- }
2961-
29622969 /* Update mappings not managed by KFD */
29632970 list_for_each_entry (peer_vm , & process_info -> vm_list_head ,
29642971 vm_list_node ) {
0 commit comments