Skip to contentSkip to conversation

drm/ttm: cleanup the resource of ghost objects after locking them

PATCH In review Christian König 2 participants 5 messages Sep 7, 2022 – Sep 8, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/ttm: cleanup the resource of ghost objects after locking them

Otherwise lockdep will complain about cleaning up the bulk_move.

Not even compile tested.

---
 drivers/gpu/drm/ttm/ttm_bo_util.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/ttm/ttm_bo_util.c +5 -5
index 57a27847206f..911141d16e95 100644
@@ -236,6 +236,11 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
 	if (bo->type != ttm_bo_type_sg)
 		fbo->base.base.resv = &fbo->base.base._resv;
 
+	dma_resv_init(&fbo->base.base._resv);
+	fbo->base.base.dev = NULL;
+	ret = dma_resv_trylock(&fbo->base.base._resv);
+	WARN_ON(!ret);
+
 	if (fbo->base.resource) {
 		ttm_resource_set_bo(fbo->base.resource, &fbo->base);
 		bo->resource = NULL;
@@ -244,11 +249,6 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
 		fbo->base.bulk_move = NULL;
 	}
 
-	dma_resv_init(&fbo->base.base._resv);
-	fbo->base.base.dev = NULL;
-	ret = dma_resv_trylock(&fbo->base.base._resv);
-	WARN_ON(!ret);
-
 	ret = dma_resv_reserve_fences(&fbo->base.base._resv, 1);
 	if (ret) {
 		kfree(fbo);
Signature · 1 line
2.25.1
#1 lore raw
Quoted 6 lines · Christian König

Otherwise lockdep will complain about cleaning up the bulk_move.

Not even compile tested.

Can we quickly resend with [email protected] to trigger a CI run? It will even compile test it for you, and confirm if this fixes the issue or not :)

Quoted 35 lines
---
 drivers/gpu/drm/ttm/ttm_bo_util.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/ttm/ttm_bo_util.c +5 -6
index 57a27847206f..911141d16e95 100644
@@ -236,6 +236,11 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
        if (bo->type != ttm_bo_type_sg)
                fbo->base.base.resv = &fbo->base.base._resv;
 
+       dma_resv_init(&fbo->base.base._resv);
+       fbo->base.base.dev = NULL;
+       ret = dma_resv_trylock(&fbo->base.base._resv);
+       WARN_ON(!ret);
+
        if (fbo->base.resource) {
                ttm_resource_set_bo(fbo->base.resource, &fbo->base);
                bo->resource = NULL;
@@ -244,11 +249,6 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
                fbo->base.bulk_move = NULL;
        }
 
-       dma_resv_init(&fbo->base.base._resv);
-       fbo->base.base.dev = NULL;
-       ret = dma_resv_trylock(&fbo->base.base._resv);
-       WARN_ON(!ret);
-
        ret = dma_resv_reserve_fences(&fbo->base.base._resv, 1);
        if (ret) {
                kfree(fbo);
--

2.25.1

Reviewed-by on v1 1/1
#2 lore raw
In reply to Christian König
Quoted 6 lines · Christian König

Otherwise lockdep will complain about cleaning up the bulk_move.

Not even compile tested.

Looks reasonable to me,

Quoted 35 lines
---
 drivers/gpu/drm/ttm/ttm_bo_util.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/ttm/ttm_bo_util.c +5 -6
index 57a27847206f..911141d16e95 100644
@@ -236,6 +236,11 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
        if (bo->type != ttm_bo_type_sg)
                fbo->base.base.resv = &fbo->base.base._resv;
 
+       dma_resv_init(&fbo->base.base._resv);
+       fbo->base.base.dev = NULL;
+       ret = dma_resv_trylock(&fbo->base.base._resv);
+       WARN_ON(!ret);
+
        if (fbo->base.resource) {
                ttm_resource_set_bo(fbo->base.resource, &fbo->base);
                bo->resource = NULL;
@@ -244,11 +249,6 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
                fbo->base.bulk_move = NULL;
        }
 
-       dma_resv_init(&fbo->base.base._resv);
-       fbo->base.base.dev = NULL;
-       ret = dma_resv_trylock(&fbo->base.base._resv);
-       WARN_ON(!ret);
-
        ret = dma_resv_reserve_fences(&fbo->base.base._resv, 1);
        if (ret) {
                kfree(fbo);
--

2.25.1

#3 lore raw
Quoted 4 lines · Matthew Auld
Quoted 1 line · Christian König
Quoted 8 lines
Quoted 5 lines

Otherwise lockdep will complain about cleaning up the bulk_move.

Not even compile tested.

Looks reasonable to me,

Christian, are you going to go ahead and push this one?

Quoted 36 lines
Quoted 36 lines
---
 drivers/gpu/drm/ttm/ttm_bo_util.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/ttm/ttm_bo_util.c +5 -6
index 57a27847206f..911141d16e95 100644
@@ -236,6 +236,11 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
        if (bo->type != ttm_bo_type_sg)
                fbo->base.base.resv = &fbo->base.base._resv;
 
+       dma_resv_init(&fbo->base.base._resv);
+       fbo->base.base.dev = NULL;
+       ret = dma_resv_trylock(&fbo->base.base._resv);
+       WARN_ON(!ret);
+
        if (fbo->base.resource) {
                ttm_resource_set_bo(fbo->base.resource, &fbo->base);
                bo->resource = NULL;
@@ -244,11 +249,6 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
                fbo->base.bulk_move = NULL;
        }
 
-       dma_resv_init(&fbo->base.base._resv);
-       fbo->base.base.dev = NULL;
-       ret = dma_resv_trylock(&fbo->base.base._resv);
-       WARN_ON(!ret);
-
        ret = dma_resv_reserve_fences(&fbo->base.base._resv, 1);
        if (ret) {
                kfree(fbo);
--

2.25.1

#4 lore raw

Am 08.09.22 um 09:46 schrieb Matthew Auld:

Quoted 4 lines
Quoted 2 lines · Matthew Auld

On Wed, 7 Sept 2022 at 11:00, Christian König
<[email protected]> wrote:

Quoted 8 lines
Quoted 7 lines
Quoted 5 lines

Otherwise lockdep will complain about cleaning up the bulk_move.

Not even compile tested.

Looks reasonable to me,

Christian, are you going to go ahead and push this one?

Pushed. Thanks for the reminder, just forgot to do that yesterday.

Christian.

Quoted 36 lines
Quoted 36 lines
Quoted 36 lines
---
  drivers/gpu/drm/ttm/ttm_bo_util.c | 10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/ttm/ttm_bo_util.c +5 -6
index 57a27847206f..911141d16e95 100644
@@ -236,6 +236,11 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
         if (bo->type != ttm_bo_type_sg)
                 fbo->base.base.resv = &fbo->base.base._resv;
 
+       dma_resv_init(&fbo->base.base._resv);
+       fbo->base.base.dev = NULL;
+       ret = dma_resv_trylock(&fbo->base.base._resv);
+       WARN_ON(!ret);
+
         if (fbo->base.resource) {
                 ttm_resource_set_bo(fbo->base.resource, &fbo->base);
                 bo->resource = NULL;
@@ -244,11 +249,6 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
                 fbo->base.bulk_move = NULL;
         }
 
-       dma_resv_init(&fbo->base.base._resv);
-       fbo->base.base.dev = NULL;
-       ret = dma_resv_trylock(&fbo->base.base._resv);
-       WARN_ON(!ret);
-
         ret = dma_resv_reserve_fences(&fbo->base.base._resv, 1);
         if (ret) {
                 kfree(fbo);
--

2.25.1