Skip to content

Commit ddc73c4

Browse files
matt-auldLucas De Marchi
authored andcommitted
drm/xe/bo: add some annotations in bo_put()
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 (cherry picked from commit 3b04c2c) Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
1 parent 73d10c7 commit ddc73c4

2 files changed

Lines changed: 15 additions & 5 deletions

File tree

drivers/gpu/drm/xe/xe_bo.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2320,6 +2320,20 @@ void xe_bo_put_commit(struct llist_head *deferred)
23202320
drm_gem_object_free(&bo->ttm.base.refcount);
23212321
}
23222322

2323+
void xe_bo_put(struct xe_bo *bo)
2324+
{
2325+
might_sleep();
2326+
if (bo) {
2327+
#ifdef CONFIG_PROC_FS
2328+
if (bo->client)
2329+
might_lock(&bo->client->bos_lock);
2330+
#endif
2331+
if (bo->ggtt_node && bo->ggtt_node->ggtt)
2332+
might_lock(&bo->ggtt_node->ggtt->lock);
2333+
drm_gem_object_put(&bo->ttm.base);
2334+
}
2335+
}
2336+
23232337
/**
23242338
* xe_bo_dumb_create - Create a dumb bo as backing for a fb
23252339
* @file_priv: ...

drivers/gpu/drm/xe/xe_bo.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,7 @@ static inline struct xe_bo *xe_bo_get(struct xe_bo *bo)
126126
return bo;
127127
}
128128

129-
static inline void xe_bo_put(struct xe_bo *bo)
130-
{
131-
if (bo)
132-
drm_gem_object_put(&bo->ttm.base);
133-
}
129+
void xe_bo_put(struct xe_bo *bo);
134130

135131
static inline void __xe_bo_unset_bulk_move(struct xe_bo *bo)
136132
{

0 commit comments

Comments
 (0)