Skip to content

Commit ddc73c4

Browse files
matt-auldlucasdemarchi
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 <[email protected]> Cc: Himal Prasad Ghimiray <[email protected]> Cc: Tejas Upadhyay <[email protected]> Cc: "Thomas Hellström" <[email protected]> Reviewed-by: Matthew Brost <[email protected]> Reviewed-by: Tejas Upadhyay <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit 3b04c2c) Signed-off-by: Lucas De Marchi <[email protected]>
1 parent 73d10c7 commit ddc73c4

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

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)