Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: fei.yang@intel.com
To: intel-xe@lists.freedesktop.org
Subject: [Intel-xe] [PATCH 1/1] drm/xe: don't repin a userptr if mm is closed
Date: Wed,  4 Oct 2023 16:47:21 -0700	[thread overview]
Message-ID: <20231004234721.2076190-2-fei.yang@intel.com> (raw)
In-Reply-To: <20231004234721.2076190-1-fei.yang@intel.com>

From: Fei Yang <fei.yang@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@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


  reply	other threads:[~2023-10-04 23:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-04 23:47 [Intel-xe] [PATCH 0/1] drm/xe: don't repin a userptr if mm is closed fei.yang
2023-10-04 23:47 ` fei.yang [this message]
2023-10-05 18:39   ` [Intel-xe] [PATCH 1/1] " Matthew Brost
2023-10-18 15:10     ` Yang, Fei
2023-10-05  0:31 ` [Intel-xe] ✓ CI.Patch_applied: success for " Patchwork
2023-10-05  0:31 ` [Intel-xe] ✓ CI.checkpatch: " Patchwork
2023-10-05  0:33 ` [Intel-xe] ✓ CI.KUnit: " Patchwork
2023-10-05  0:40 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-10-05  0:40 ` [Intel-xe] ✗ CI.Hooks: failure " Patchwork
2023-10-05  0:41 ` [Intel-xe] ✓ CI.checksparse: success " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231004234721.2076190-2-fei.yang@intel.com \
    --to=fei.yang@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox