[PATCH 3/4] drm/sched: Check locking in drm_sched_job_add_implicit_dependencies

Daniel Vetter daniel.vetter at ffwll.ch
Thu Mar 31 20:46:50 UTC 2022


You really need to hold the reservation here or all kinds of funny
things can happen between grabbing the dependencies and inserting the
new fences.

v2: Fix commit summary (Christian)

Acked-by: Melissa Wen <mwen at igalia.com>
Reviewed-by: "Christian König" <christian.koenig at amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
Cc: "Christian König" <christian.koenig at amd.com>
Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
Cc: Luben Tuikov <luben.tuikov at amd.com>
Cc: Andrey Grodzovsky <andrey.grodzovsky at amd.com>
Cc: Alex Deucher <alexander.deucher at amd.com>
---
 drivers/gpu/drm/scheduler/sched_main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
index 157d4cf360f8..ba121f87cd2e 100644
--- a/drivers/gpu/drm/scheduler/sched_main.c
+++ b/drivers/gpu/drm/scheduler/sched_main.c
@@ -708,6 +708,8 @@ int drm_sched_job_add_implicit_dependencies(struct drm_sched_job *job,
 	struct dma_fence *fence;
 	int ret;
 
+	dma_resv_assert_held(obj->resv);
+
 	dma_resv_for_each_fence(&cursor, obj->resv, write, fence) {
 		/* Make sure to grab an additional ref on the added fence */
 		dma_fence_get(fence);
-- 
2.34.1



More information about the dri-devel mailing list