]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
drm/buddy: Integrate lockdep annotations for gpu buddy manager
authorTejas Upadhyay <tejas.upadhyay@intel.com>
Fri, 8 May 2026 06:55:45 +0000 (12:25 +0530)
committerArunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Fri, 8 May 2026 13:46:19 +0000 (19:16 +0530)
commit35b535db69589ea0025ec3f06df08f2e3faad26f
treeee0bd7a599ed1d738fabc668a2b2c0fee6e23d28
parentc2738d88b624a977e42a1734fad4b15993ac354a
drm/buddy: Integrate lockdep annotations for gpu buddy manager

gpu_buddy APIs are expected to be called with the driver-provided lock
held, but there is no runtime enforcement of this contract. Add lockdep
annotations to catch locking violations early.

Introduce gpu_buddy_driver_set_lock() for the driver to register the
lock that protects the buddy manager. Add gpu_buddy_driver_lock_held()
assertions to all exported gpu_buddy and drm_buddy APIs that
access/modify the manager state. The lock_dep_map field is only compiled
in when CONFIG_LOCKDEP is enabled, adding zero overhead to production
builds.

Wire up xe_ttm_vram_mgr to register its mutex with the buddy manager
after initialization.

Assisted-by: Copilot:claude-opus-4.6
Suggested-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Tejas Upadhyay <tejas.upadhyay@intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Link: https://patch.msgid.link/20260508065544.4049240-2-tejas.upadhyay@intel.com
drivers/gpu/buddy.c
drivers/gpu/drm/drm_buddy.c
drivers/gpu/drm/xe/xe_ttm_vram_mgr.c
include/linux/gpu_buddy.h