Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+15 -5
+14
drivers/gpu/drm/xe/xe_bo.c
··· 2350 2350 drm_gem_object_free(&bo->ttm.base.refcount); 2351 2351 } 2352 2352 2353 + void xe_bo_put(struct xe_bo *bo) 2354 + { 2355 + might_sleep(); 2356 + if (bo) { 2357 + #ifdef CONFIG_PROC_FS 2358 + if (bo->client) 2359 + might_lock(&bo->client->bos_lock); 2360 + #endif 2361 + if (bo->ggtt_node && bo->ggtt_node->ggtt) 2362 + might_lock(&bo->ggtt_node->ggtt->lock); 2363 + drm_gem_object_put(&bo->ttm.base); 2364 + } 2365 + } 2366 + 2353 2367 /** 2354 2368 * xe_bo_dumb_create - Create a dumb bo as backing for a fb 2355 2369 * @file_priv: ...
+1 -5
drivers/gpu/drm/xe/xe_bo.h
··· 126 126 return bo; 127 127 } 128 128 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); 134 130 135 131 static inline void __xe_bo_unset_bulk_move(struct xe_bo *bo) 136 132 {