Skip to contentSkip to conversation

drm/scheduler: fix drm_sched_job_add_implicit_dependencies harder

PATCH In review Rob Clark 4 participants 6 messages Nov 16, 2021 – Nov 18, 2021

Subsystems (4)
lore
Share & tools
lore

Rob Clark

author
#0 lore raw

PATCH 1/1 drm/scheduler: fix drm_sched_job_add_implicit_dependencies harder

From: Rob Clark <[email protected]>

drm_sched_job_add_dependency() could drop the last ref, so we need to do the dma_fence_get() first.

Cc Christian König <[email protected]>
Fixes 9c2ba265352a drm/scheduler: ("use new iterator in drm_sched_job_add_implicit_dependencies v2")

---
Applies on top of "drm/scheduler: fix drm_sched_job_add_implicit_dependencies" but I don't think that has a stable commit sha yet.

 drivers/gpu/drm/scheduler/sched_main.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/scheduler/sched_main.c +5 -4
index 94fe51b3caa2..f91fb31ab7a7 100644
@@ -704,12 +704,13 @@ int drm_sched_job_add_implicit_dependencies(struct drm_sched_job *job,
 	int ret;
 
 	dma_resv_for_each_fence(&cursor, obj->resv, write, fence) {
-		ret = drm_sched_job_add_dependency(job, fence);
-		if (ret)
-			return ret;
-
 		/* Make sure to grab an additional ref on the added fence */
 		dma_fence_get(fence);
+		ret = drm_sched_job_add_dependency(job, fence);
+		if (ret) {
+			dma_fence_put(fence);
+			return ret;
+		}
 	}
 	return 0;
 }
Signature · 1 line
2.33.1
Tested-by on v1 1/1
#1 lore raw
Quoted 6 lines · Rob Clark

From: Rob Clark <[email protected]>

drm_sched_job_add_dependency() could drop the last ref, so we need to do the dma_fence_get() first.

It fixed the splats I saw on RB5 (sm8250 | A650). Thanks.

Quoted 35 lines
Cc Christian König <[email protected]>
Fixes 9c2ba265352a drm/scheduler: ("use new iterator in drm_sched_job_add_implicit_dependencies v2")

---
Applies on top of "drm/scheduler: fix drm_sched_job_add_implicit_dependencies" but I don't think that has a stable commit sha yet.

 drivers/gpu/drm/scheduler/sched_main.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/scheduler/sched_main.c +5 -5
index 94fe51b3caa2..f91fb31ab7a7 100644
@@ -704,12 +704,13 @@ int drm_sched_job_add_implicit_dependencies(struct drm_sched_job *job,
        int ret;
 
        dma_resv_for_each_fence(&cursor, obj->resv, write, fence) {
-               ret = drm_sched_job_add_dependency(job, fence);
-               if (ret)
-                       return ret;
-
                /* Make sure to grab an additional ref on the added fence */
                dma_fence_get(fence);
+               ret = drm_sched_job_add_dependency(job, fence);
+               if (ret) {
+                       dma_fence_put(fence);
+                       return ret;
+               }
        }
        return 0;
 }
--

2.33.1

#2 lore raw

Am 16.11.21 um 19:30 schrieb Amit Pundir:

Quoted 9 lines · Rob Clark
Quoted 5 lines

From: Rob Clark <[email protected]>

drm_sched_job_add_dependency() could drop the last ref, so we need to do the dma_fence_get() first.

It fixed the splats I saw on RB5 (sm8250 | A650). Thanks.

I've added my rb, pushed this with the original fix to drm-misc-fixes and cleaned up the obvious fallout between drm-misc-fixes and drm-misc-next in drm-tip.

Thanks for the help and sorry for the noise,
Christian.

Quoted 36 lines
Quoted 36 lines
Cc Christian König <[email protected]>
Fixes 9c2ba265352a drm/scheduler: ("use new iterator in drm_sched_job_add_implicit_dependencies v2")

---
Applies on top of "drm/scheduler: fix drm_sched_job_add_implicit_dependencies" but I don't think that has a stable commit sha yet.

  drivers/gpu/drm/scheduler/sched_main.c | 9 +++++----
  1 file changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/scheduler/sched_main.c +5 -5
index 94fe51b3caa2..f91fb31ab7a7 100644
@@ -704,12 +704,13 @@ int drm_sched_job_add_implicit_dependencies(struct drm_sched_job *job,
         int ret;
 
         dma_resv_for_each_fence(&cursor, obj->resv, write, fence) {
-               ret = drm_sched_job_add_dependency(job, fence);
-               if (ret)
-                       return ret;
-
                 /* Make sure to grab an additional ref on the added fence */
                 dma_fence_get(fence);
+               ret = drm_sched_job_add_dependency(job, fence);
+               if (ret) {
+                       dma_fence_put(fence);
+                       return ret;
+               }
         }
         return 0;
  }
--

2.33.1

#3 lore raw
Quoted 7 lines · Christian König

Am 16.11.21 um 19:30 schrieb Amit Pundir:

Quoted 6 lines · Rob Clark
Quoted 5 lines

From: Rob Clark <[email protected]>

drm_sched_job_add_dependency() could drop the last ref, so we need to do the dma_fence_get() first.

Quoted 9 lines
Quoted 3 lines

It fixed the splats I saw on RB5 (sm8250 | A650). Thanks.

I've added my rb, pushed this with the original fix to drm-misc-fixes and cleaned up the obvious fallout between drm-misc-fixes and drm-misc-next in drm-tip.

Thanks for the help and sorry for the noise,
Christian.

I've run into this splat on the Lenovo Yoga C630 on 5.16-rc1 - are these 2 patches (which fix it) going to be heading to 5.16 or were they targeted at 5.17?

-- steev

author
#4 lore raw
Quoted 19 lines · Steev Klimaszewski
Quoted 16 lines · Christian König

Am 16.11.21 um 19:30 schrieb Amit Pundir:

Quoted 10 lines · Rob Clark
Quoted 6 lines

From: Rob Clark <[email protected]>

drm_sched_job_add_dependency() could drop the last ref, so we need to do
the dma_fence_get() first.

It fixed the splats I saw on RB5 (sm8250 | A650). Thanks.

I've added my rb, pushed this with the original fix to drm-misc-fixes and cleaned up the obvious fallout between drm-misc-fixes and drm-misc-next in drm-tip.

Quoted 6 lines
Quoted 3 lines

Thanks for the help and sorry for the noise,
Christian.

I've run into this splat on the Lenovo Yoga C630 on 5.16-rc1 - are these 2 patches (which fix it) going to be heading to 5.16 or were they targeted at 5.17?

these should be for v5.16

BR,
-R

#5 lore raw

Am 18.11.21 um 04:09 schrieb Rob Clark:

Quoted 18 lines · Steev Klimaszewski
Quoted 17 lines · Christian König
Quoted 15 lines

Am 16.11.21 um 19:30 schrieb Amit Pundir:

Quoted 10 lines · Rob Clark
Quoted 6 lines

From: Rob Clark <[email protected]>

drm_sched_job_add_dependency() could drop the last ref, so we need to do
the dma_fence_get() first.

It fixed the splats I saw on RB5 (sm8250 | A650). Thanks.

I've added my rb, pushed this with the original fix to drm-misc-fixes and cleaned up the obvious fallout between drm-misc-fixes and drm-misc-next in drm-tip.

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

Thanks for the help and sorry for the noise,
Christian.

I've run into this splat on the Lenovo Yoga C630 on 5.16-rc1 - are these 2 patches (which fix it) going to be heading to 5.16 or were they targeted at 5.17?

these should be for v5.16

Yeah, they are already queued up for -rc2.

Regards,
Christian.

Quoted 3 lines

BR,
-R