Skip to contentSkip to conversation

drm/amdgpu: amdgpu_device_recover_vram got NULL of shadow->parent

PATCH In review wentalou 2 participants 2 messages Apr 16, 2019 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

wentalou

author
#0 lore raw

PATCH 1/1 drm/amdgpu: amdgpu_device_recover_vram got NULL of shadow->parent

amdgpu_bo_destroy had a bug by calling amdgpu_bo_unref outside mutex_lock. If amdgpu_device_recover_vram executed between amdgpu_bo_unref and list_del_init, it would get NULL of shadow->parent, then caused Call Trace and GPU reset failed.

Change-Id I41d7b54605e613e87ee03c3ad89c191063c19230
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +3 -1
index ec9e450..93b2c5a 100644
@@ -88,12 +88,14 @@ static void amdgpu_bo_destroy(struct ttm_buffer_object *tbo)
 	if (bo->gem_base.import_attach)
 		drm_prime_gem_destroy(&bo->gem_base, bo->tbo.sg);
 	drm_gem_object_release(&bo->gem_base);
-	amdgpu_bo_unref(&bo->parent);
+	/* in case amdgpu_device_recover_vram got NULL of bo->parent */
 	if (!list_empty(&bo->shadow_list)) {
 		mutex_lock(&adev->shadow_list_lock);
 		list_del_init(&bo->shadow_list);
 		mutex_unlock(&adev->shadow_list_lock);
 	}
+	amdgpu_bo_unref(&bo->parent);
+
 	kfree(bo->metadata);
 	kfree(bo);
 }
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1555411616-18423-1-git-send-email-Wentao.Lou-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#2 lore raw

Am 16.04.19 um 12:46 schrieb wentalou:

Quoted 6 lines

amdgpu_bo_destroy had a bug by calling amdgpu_bo_unref outside mutex_lock. If amdgpu_device_recover_vram executed between amdgpu_bo_unref and list_del_init, it would get NULL of shadow->parent, then caused Call Trace and GPU reset failed.

Change-Id I41d7b54605e613e87ee03c3ad89c191063c19230
Quoted 14 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1 -1
index ec9e450..93b2c5a 100644
@@ -88,12 +88,14 @@ static void amdgpu_bo_destroy(struct ttm_buffer_object *tbo)
  	if (bo->gem_base.import_attach)
  		drm_prime_gem_destroy(&bo->gem_base, bo->tbo.sg);
  	drm_gem_object_release(&bo->gem_base);
-	amdgpu_bo_unref(&bo->parent);
+	/* in case amdgpu_device_recover_vram got NULL of bo->parent */

drivers/gpu/drm/amd/amdgpu/amdgpu_object.c static void amdgpu_bo_destroy(struct ttm_buffer_object *tbo) · line 101

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2 -0
  	if (!list_empty(&bo->shadow_list)) {
  		mutex_lock(&adev->shadow_list_lock);
  		list_del_init(&bo->shadow_list);
  		mutex_unlock(&adev->shadow_list_lock);
  	}
+	amdgpu_bo_unref(&bo->parent);
+
  	kfree(bo->metadata);
  	kfree(bo);
  }

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx