]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
drm/amd/amdgpu: move eviction counting to amdgpu_bo_move_notify
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Thu, 15 Dec 2016 16:26:42 +0000 (17:26 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 27 Jan 2017 16:13:16 +0000 (11:13 -0500)
This catches evictions of shadow page tables from the GART. Since shadow
page tables are always stored in system memory, amdgpu_bo_move is never
called for them.

This fixes a crash during command submission that occurs when only a shadow
page table and no other BOs were evicted since the last submission.

Fixes: 1baa439fb2f4e586 ("drm/amdgpu: allocate shadow for pd/pt bo V2")
Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c

index c29db99f9048b6ae153de09e5d3e73b888d797af..d94cdeff061795e68fc759f8afb210b6abae56ea 100644 (file)
@@ -862,6 +862,10 @@ void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,
        abo = container_of(bo, struct amdgpu_bo, tbo);
        amdgpu_vm_bo_invalidate(adev, abo);
 
+       /* remember the eviction */
+       if (evict)
+               atomic64_inc(&adev->num_evictions);
+
        /* update statistics */
        if (!new_mem)
                return;
index c695b6c55361bf8474e1e7093ad721f23775188b..25568079fda442bc8af026b6af5674978b5ee224 100644 (file)
@@ -466,10 +466,6 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo,
 
        adev = amdgpu_ttm_adev(bo->bdev);
 
-       /* remember the eviction */
-       if (evict)
-               atomic64_inc(&adev->num_evictions);
-
        if (old_mem->mem_type == TTM_PL_SYSTEM && bo->ttm == NULL) {
                amdgpu_move_null(bo, new_mem);
                return 0;