[PATCH] drm/xe: Annotate xe_vma_userptr_pin_pages with might_alloc

Matthew Brost matthew.brost at intel.com
Sat Jul 27 01:44:14 UTC 2024


Let's catch corner cases with locking early by annotating
xe_vma_userptr_pin_pages with might_alloc so if it is called with a lock
in the path of reclaim lockdep pops even if the userptr hasn't been
invalidated.

Signed-off-by: Matthew Brost <matthew.brost at intel.com>
---
 drivers/gpu/drm/xe/xe_vm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
index 12d43c35978c..3bd5527b1ec6 100644
--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -71,6 +71,7 @@ int xe_vma_userptr_pin_pages(struct xe_userptr_vma *uvma)
 	struct xe_device *xe = vm->xe;
 
 	lockdep_assert_held(&vm->lock);
+	might_alloc(GFP_KERNEL);
 	xe_assert(xe, xe_vma_is_userptr(vma));
 
 	return xe_hmm_userptr_populate_range(uvma, false);
-- 
2.34.1



More information about the Intel-xe mailing list