[Intel-xe] [PATCH 1/1] drm/xe: don't repin a userptr if mm is closed

fei.yang at intel.com fei.yang at intel.com
Wed Oct 4 23:47:21 UTC 2023


From: Fei Yang <fei.yang at intel.com>

Ran into a problem where xe_vma_userptr_pin_pages failed with -EFAULT
due to the mmu_notifier.mm had been closed. In such case, the userptr
vma should not had been added to the invalidated list in the first
place.

Signed-off-by: Fei Yang <fei.yang at intel.com>
---
 drivers/gpu/drm/xe/xe_vm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
index ea17d026546c..14ba3fb9defd 100644
--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -715,11 +715,13 @@ static bool vma_userptr_invalidate(struct mmu_interval_notifier *mni,
 	 * userptr.
 	 */
 	if (!xe_vm_in_fault_mode(vm) &&
+	    mmget_not_zero(vma->userptr.notifier.mm) &&
 	    !(vma->gpuva.flags & XE_VMA_DESTROYED) && vma->tile_present) {
 		spin_lock(&vm->userptr.invalidated_lock);
 		list_move_tail(&vma->userptr.invalidate_link,
 			       &vm->userptr.invalidated);
 		spin_unlock(&vm->userptr.invalidated_lock);
+		mmput(vma->userptr.notifier.mm);
 	}
 
 	up_write(&vm->userptr.notifier_lock);
-- 
2.25.1



More information about the Intel-xe mailing list