drm/amdgpu: fix VM page table reference counting
Subsystems (2)
PATCH 1/1 drm/amdgpu: fix VM page table reference counting
From: Christian König <[email protected]>
We use the reservation object of the page directory for the page tables as well, because of this the page directory should be freed last. Ensure that by keeping a reference from the page tables to the directory.
Signed-off-by Christian König <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 5 +++++ 3 files changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -538,6 +538,7 @@ struct amdgpu_bo {/* Constant after initialization */ struct amdgpu_device *adev;struct drm_gem_object gem_base; +struct amdgpu_bo *parent;struct ttm_bo_kmap_obj dma_buf_vmap;pid_t pid;
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1 -0
@@ -100,6 +100,7 @@ static void amdgpu_ttm_bo_destroy(struct ttm_buffer_object *tbo)list_del_init (&bo->list);mutex_unlock (&bo->adev->gem.mutex);drm_gem_object_release (&bo->gem_base); +amdgpu_bo_unref (&bo->parent);kfree (bo->metadata);kfree (bo); }
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +5 -0
@@ -1076,6 +1076,11 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev,if (r) goto error_free; +/* Keep a reference to the page table to avoid freeing +* them up in the wrong order. +*/ + pt->parent =amdgpu_bo_ref (vm->page_directory); + r =amdgpu_vm_clear_bo (adev, pt);if (r) {amdgpu_bo_unref (&pt);
Signature · 6 lines
2.5.0 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Alex Deucher
AppliedQuoted 7 lines · Christian König
From: Christian König <[email protected]>
We use the reservation object of the page directory for the page tables as well, because of this the page directory should be freed last. Ensure that by keeping a reference from the page tables to the directory.
Signed-off-by Christian König <[email protected]>
Applied. Thanks!
Alex
Quoted 47 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 5 +++++ 3 files changed, 7 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0@@ -538,6 +538,7 @@ struct amdgpu_bo {/* Constant after initialization */ struct amdgpu_device *adev;struct drm_gem_object gem_base; +struct amdgpu_bo *parent;struct ttm_bo_kmap_obj dma_buf_vmap;pid_t pid;drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1
-0@@ -100,6 +100,7 @@ static void amdgpu_ttm_bo_destroy(struct ttm_buffer_object *tbo)list_del_init (&bo->list);mutex_unlock (&bo->adev->gem.mutex);drm_gem_object_release (&bo->gem_base); +amdgpu_bo_unref (&bo->parent);kfree (bo->metadata);kfree (bo); }drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +5
-1@@ -1076,6 +1076,11 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev,if (r) goto error_free; +/* Keep a reference to the page table to avoid freeing +* them up in the wrong order. +*/ + pt->parent =amdgpu_bo_ref (vm->page_directory); + r =amdgpu_vm_clear_bo (adev, pt);if (r) {amdgpu_bo_unref (&pt); --
Quoted 2 lines
2.5.0
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel