diff options
author | Matthew Auld <matthew.auld@intel.com> | 2024-09-11 16:55:30 +0100 |
---|---|---|
committer | Matthew Auld <matthew.auld@intel.com> | 2024-09-12 09:27:31 +0100 |
commit | 3b04c2cfd71c54117237c72f2a08ff0ae1f602e2 (patch) | |
tree | 2f08aa923e505708e06ad88a1cde6b727d00f04a /drivers/gpu/drm/xe/xe_bo.c | |
parent | fbd73b7d2ae29ef0f604f376bcc22b886a49329e (diff) | |
download | lwn-3b04c2cfd71c54117237c72f2a08ff0ae1f602e2.tar.gz lwn-3b04c2cfd71c54117237c72f2a08ff0ae1f602e2.zip |
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
Diffstat (limited to 'drivers/gpu/drm/xe/xe_bo.c')
-rw-r--r-- | drivers/gpu/drm/xe/xe_bo.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c index a4dadd5a424c..5f2f1ec46b57 100644 --- a/drivers/gpu/drm/xe/xe_bo.c +++ b/drivers/gpu/drm/xe/xe_bo.c @@ -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: ... |