All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/amdgpu: fix prime teardown order
@ 2018-03-09 13:46 Christian König
       [not found] ` <20180309134604.2390-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Christian König @ 2018-03-09 13:46 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

We unmapped imported DMA-bufs when the GEM handle was dropped, not when the
hardware was done with the buffere.

Signed-off-by: Christian König <christian.koenig@amd.com>
CC: stable@vger.kernel.org
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c    | 2 --
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
index bb9b21266b67..46b9ea4e6103 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
@@ -36,8 +36,6 @@ void amdgpu_gem_object_free(struct drm_gem_object *gobj)
 	struct amdgpu_bo *robj = gem_to_amdgpu_bo(gobj);
 
 	if (robj) {
-		if (robj->gem_base.import_attach)
-			drm_prime_gem_destroy(&robj->gem_base, robj->tbo.sg);
 		amdgpu_mn_unregister(robj);
 		amdgpu_bo_unref(&robj);
 	}
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index b44b65117e18..48e0115d4f76 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -56,6 +56,8 @@ static void amdgpu_ttm_bo_destroy(struct ttm_buffer_object *tbo)
 
 	amdgpu_bo_kunmap(bo);
 
+	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);
 	if (!list_empty(&bo->shadow_list)) {
-- 
2.14.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] drm/radeon: fix prime teardown order
       [not found] ` <20180309134604.2390-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>
@ 2018-03-09 13:46   ` Christian König
  2018-03-09 14:05   ` [PATCH 1/2] drm/amdgpu: " Michel Dänzer
  1 sibling, 0 replies; 4+ messages in thread
From: Christian König @ 2018-03-09 13:46 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

We unmapped imported DMA-bufs when the GEM handle was dropped, not when the
hardware was done with the buffere.

Signed-off-by: Christian König <christian.koenig@amd.com>
CC: stable@vger.kernel.org
---
 drivers/gpu/drm/radeon/radeon_gem.c    | 2 --
 drivers/gpu/drm/radeon/radeon_object.c | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c
index a9962ffba720..27d8e7dd2d06 100644
--- a/drivers/gpu/drm/radeon/radeon_gem.c
+++ b/drivers/gpu/drm/radeon/radeon_gem.c
@@ -34,8 +34,6 @@ void radeon_gem_object_free(struct drm_gem_object *gobj)
 	struct radeon_bo *robj = gem_to_radeon_bo(gobj);
 
 	if (robj) {
-		if (robj->gem_base.import_attach)
-			drm_prime_gem_destroy(&robj->gem_base, robj->tbo.sg);
 		radeon_mn_unregister(robj);
 		radeon_bo_unref(&robj);
 	}
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
index 38431f682ed0..edbb4cd519fd 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -82,6 +82,8 @@ static void radeon_ttm_bo_destroy(struct ttm_buffer_object *tbo)
 	mutex_unlock(&bo->rdev->gem.mutex);
 	radeon_bo_clear_surface_reg(bo);
 	WARN_ON_ONCE(!list_empty(&bo->va));
+	if (bo->gem_base.import_attach)
+		drm_prime_gem_destroy(&bo->gem_base, bo->tbo.sg);
 	drm_gem_object_release(&bo->gem_base);
 	kfree(bo);
 }
-- 
2.14.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] drm/amdgpu: fix prime teardown order
       [not found] ` <20180309134604.2390-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>
  2018-03-09 13:46   ` [PATCH 2/2] drm/radeon: " Christian König
@ 2018-03-09 14:05   ` Michel Dänzer
       [not found]     ` <d0c896ef-de5f-ff95-ea2b-14eb51064c4d-otUistvHUpPR7s880joybQ@public.gmane.org>
  1 sibling, 1 reply; 4+ messages in thread
From: Michel Dänzer @ 2018-03-09 14:05 UTC (permalink / raw)
  To: Christian König; +Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On 2018-03-09 02:46 PM, Christian König wrote:
> We unmapped imported DMA-bufs when the GEM handle was dropped, not when the
> hardware was done with the buffere.

Good catch! I guess that explains some oddities I sometimes saw with
PRIME. Both patches are

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] drm/amdgpu: fix prime teardown order
       [not found]     ` <d0c896ef-de5f-ff95-ea2b-14eb51064c4d-otUistvHUpPR7s880joybQ@public.gmane.org>
@ 2018-03-09 14:07       ` Christian König
  0 siblings, 0 replies; 4+ messages in thread
From: Christian König @ 2018-03-09 14:07 UTC (permalink / raw)
  To: Michel Dänzer; +Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Am 09.03.2018 um 15:05 schrieb Michel Dänzer:
> On 2018-03-09 02:46 PM, Christian König wrote:
>> We unmapped imported DMA-bufs when the GEM handle was dropped, not when the
>> hardware was done with the buffere.
> Good catch! I guess that explains some oddities I sometimes saw with
> PRIME. Both patches are

Yeah and it took me a month to hunt that down. Thanks to IOMMU or 
otherwise I wouldn't have even noticed that something is wrong.

> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>

Thanks,
Christian.
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-03-09 14:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-09 13:46 [PATCH 1/2] drm/amdgpu: fix prime teardown order Christian König
     [not found] ` <20180309134604.2390-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-03-09 13:46   ` [PATCH 2/2] drm/radeon: " Christian König
2018-03-09 14:05   ` [PATCH 1/2] drm/amdgpu: " Michel Dänzer
     [not found]     ` <d0c896ef-de5f-ff95-ea2b-14eb51064c4d-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-03-09 14:07       ` Christian König

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.