Commit e018f44b authored by Matthew Auld's avatar Matthew Auld Committed by Rodrigo Vivi

drm/xe/ggtt: prime ggtt->lock against FS_RECLAIM

Increase the sensitivity of the ggtt->lock by priming it against
FS_RECLAIM, such that allocating memory while holding will result in
lockdep splats.
Signed-off-by: default avatarMatthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
parent 7eed01a9
...@@ -93,6 +93,16 @@ static void ggtt_fini_noalloc(struct drm_device *drm, void *arg) ...@@ -93,6 +93,16 @@ static void ggtt_fini_noalloc(struct drm_device *drm, void *arg)
xe_bo_unpin_map_no_vm(ggtt->scratch); xe_bo_unpin_map_no_vm(ggtt->scratch);
} }
static void primelockdep(struct xe_ggtt *ggtt)
{
if (!IS_ENABLED(CONFIG_LOCKDEP))
return;
fs_reclaim_acquire(GFP_KERNEL);
might_lock(&ggtt->lock);
fs_reclaim_release(GFP_KERNEL);
}
int xe_ggtt_init_noalloc(struct xe_ggtt *ggtt) int xe_ggtt_init_noalloc(struct xe_ggtt *ggtt)
{ {
struct xe_device *xe = tile_to_xe(ggtt->tile); struct xe_device *xe = tile_to_xe(ggtt->tile);
...@@ -140,6 +150,7 @@ int xe_ggtt_init_noalloc(struct xe_ggtt *ggtt) ...@@ -140,6 +150,7 @@ int xe_ggtt_init_noalloc(struct xe_ggtt *ggtt)
drm_mm_init(&ggtt->mm, xe_wopcm_size(xe), drm_mm_init(&ggtt->mm, xe_wopcm_size(xe),
ggtt->size - xe_wopcm_size(xe)); ggtt->size - xe_wopcm_size(xe));
mutex_init(&ggtt->lock); mutex_init(&ggtt->lock);
primelockdep(ggtt);
return drmm_add_action_or_reset(&xe->drm, ggtt_fini_noalloc, ggtt); return drmm_add_action_or_reset(&xe->drm, ggtt_fini_noalloc, ggtt);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment