]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amdgpu: fix calling VM invalidation in amdgpu_hmm_invalidate_gfx
authorChristian König <christian.koenig@amd.com>
Wed, 18 Feb 2026 11:31:29 +0000 (12:31 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 27 May 2026 14:51:06 +0000 (10:51 -0400)
Otherwise we don't invalidate page tables on next CS.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
Tested-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

index 0a9582da3a33b59a177611150aad63afad577abf..5bfa5a84b09cbe57eff8cec85cff28778cab3775 100644 (file)
@@ -76,6 +76,7 @@ static bool amdgpu_hmm_invalidate_gfx(struct mmu_interval_notifier *mni,
 
        mmu_interval_set_seq(mni, cur_seq);
 
+       amdgpu_vm_bo_invalidate(bo, false);
        r = dma_resv_wait_timeout(bo->tbo.base.resv, DMA_RESV_USAGE_BOOKKEEP,
                                  false, MAX_SCHEDULE_TIMEOUT);
        mutex_unlock(&adev->notifier_lock);
index a99d01f9dc7503d49ef7b013c359b0595ec2f6ec..79efefd25a4fd84e87e97ec5e5444f85c0fbb438 100644 (file)
@@ -1600,6 +1600,7 @@ int amdgpu_vm_handle_moved(struct amdgpu_device *adev,
 {
        struct amdgpu_bo_va *bo_va, *tmp;
        struct dma_resv *resv;
+       struct amdgpu_bo *bo;
        bool clear, unlock;
        int r;
 
@@ -1615,11 +1616,13 @@ int amdgpu_vm_handle_moved(struct amdgpu_device *adev,
        while (!list_empty(&vm->individual.moved)) {
                bo_va = list_first_entry(&vm->individual.moved,
                                         typeof(*bo_va), base.vm_status);
-               resv = bo_va->base.bo->tbo.base.resv;
+               bo = bo_va->base.bo;
+               resv = bo->tbo.base.resv;
                spin_unlock(&vm->individual_lock);
 
                /* Try to reserve the BO to avoid clearing its ptes */
-               if (!adev->debug_vm && dma_resv_trylock(resv)) {
+               if (!adev->debug_vm && !amdgpu_ttm_tt_get_usermm(bo->tbo.ttm) &&
+                   dma_resv_trylock(resv)) {
                        clear = false;
                        unlock = true;
                /* The caller is already holding the reservation lock */