[PATCH 23/24] drm/syncobj: Don't take locks in drm_syncobj_free
Jason Ekstrand
jason at jlekstrand.net
Wed Apr 21 18:42:26 UTC 2021
drm_syncobj_put() can potentially happen in weird places and, when we
call drm_syncobj_replace_fence(), it takes the syncobj lock which may
not be valid. It's safer if we hand-roll the put and don't take any
locks.
Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>
---
drivers/gpu/drm/drm_syncobj.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
index fdd2ec87cdd14..a0e3b67e9546c 100644
--- a/drivers/gpu/drm/drm_syncobj.c
+++ b/drivers/gpu/drm/drm_syncobj.c
@@ -462,7 +462,9 @@ void drm_syncobj_free(struct kref *kref)
struct drm_syncobj *syncobj = container_of(kref,
struct drm_syncobj,
refcount);
- drm_syncobj_replace_fence(syncobj, NULL);
+ dma_fence_put(rcu_dereference_protected(syncobj->fence,
+ lockdep_is_held(&syncobj->lock)));
+ WARN_ON(!list_empty(&syncobj->cb_list));
kfree(syncobj);
}
EXPORT_SYMBOL(drm_syncobj_free);
--
2.31.1
More information about the Intel-gfx-trybot
mailing list