]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/xe/bo: add some annotations in bo_put()
authorMatthew Auld <matthew.auld@intel.com>
Wed, 11 Sep 2024 15:55:30 +0000 (16:55 +0100)
committerMatthew Auld <matthew.auld@intel.com>
Thu, 12 Sep 2024 08:27:31 +0000 (09:27 +0100)
If the put() triggers bo destroy then there is at least one potential
sleeping lock. Also annotate bos_lock and ggtt lock.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Cc: Tejas Upadhyay <tejas.upadhyay@intel.com>
Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Tejas Upadhyay <tejas.upadhyay@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240911155527.178910-8-matthew.auld@intel.com
drivers/gpu/drm/xe/xe_bo.c
drivers/gpu/drm/xe/xe_bo.h

index a4dadd5a424cb5f18f1dc5b621072ce2e006e073..5f2f1ec46b57ae9905b2a4fc3c8a3bc67c5d2d22 100644 (file)
@@ -2350,6 +2350,20 @@ void xe_bo_put_commit(struct llist_head *deferred)
                drm_gem_object_free(&bo->ttm.base.refcount);
 }
 
+void xe_bo_put(struct xe_bo *bo)
+{
+       might_sleep();
+       if (bo) {
+#ifdef CONFIG_PROC_FS
+               if (bo->client)
+                       might_lock(&bo->client->bos_lock);
+#endif
+               if (bo->ggtt_node && bo->ggtt_node->ggtt)
+                       might_lock(&bo->ggtt_node->ggtt->lock);
+               drm_gem_object_put(&bo->ttm.base);
+       }
+}
+
 /**
  * xe_bo_dumb_create - Create a dumb bo as backing for a fb
  * @file_priv: ...
index dbfb3209615dfadb090e38d48c0f1f91aca93851..6e4be52306dfc9f85e61b0c4f767e05a80bbde93 100644 (file)
@@ -126,11 +126,7 @@ static inline struct xe_bo *xe_bo_get(struct xe_bo *bo)
        return bo;
 }
 
-static inline void xe_bo_put(struct xe_bo *bo)
-{
-       if (bo)
-               drm_gem_object_put(&bo->ttm.base);
-}
+void xe_bo_put(struct xe_bo *bo);
 
 static inline void __xe_bo_unset_bulk_move(struct xe_bo *bo)
 {