Skip to content

Commit

Permalink
drm/xe/bo: add some annotations in bo_put()
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
matt-auld authored and lucasdemarchi committed Sep 18, 2024
1 parent 73d10c7 commit ddc73c4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
14 changes: 14 additions & 0 deletions drivers/gpu/drm/xe/xe_bo.c
Original file line number Diff line number Diff line change
Expand Up @@ -2320,6 +2320,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: ...
Expand Down
6 changes: 1 addition & 5 deletions drivers/gpu/drm/xe/xe_bo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit ddc73c4

Please sign in to comment.