From: Matthew Brost <matthew.brost@intel.com>
To: <intel-xe@lists.freedesktop.org>
Subject: [PATCH 2/2] drm/xe: Pick correct userptr VMA to repin on REMAP op failure
Date: Wed, 31 Jan 2024 16:48:49 -0800 [thread overview]
Message-ID: <20240201004849.2219558-3-matthew.brost@intel.com> (raw)
In-Reply-To: <20240201004849.2219558-1-matthew.brost@intel.com>
A REMAP op is composed of 3 VMA's - unmap, prev map, and next map. When
op_execute fails with -EAGAIN we need to update the local VMA pointer to
the current op state and then repin the VMA if it is a userptr.
Fixes a failure seen in xe_vm.munmap-style-unbind-userptr-one-partial.
Fixes: b06d47be7c83 ("drm/xe: Port Xe to GPUVA")
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
---
drivers/gpu/drm/xe/xe_vm.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
index e55161136490..2ab863fe7d0a 100644
--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -2506,13 +2506,25 @@ static int __xe_vma_op_execute(struct xe_vm *vm, struct xe_vma *vma,
}
drm_exec_fini(&exec);
- if (err == -EAGAIN && xe_vma_is_userptr(vma)) {
+ if (err == -EAGAIN) {
lockdep_assert_held_write(&vm->lock);
- err = xe_vma_userptr_pin_pages(vma);
- if (!err)
- goto retry_userptr;
- trace_xe_vma_fail(vma);
+ if (op->base.op == DRM_GPUVA_OP_REMAP) {
+ if (!op->remap.unmap_done)
+ vma = gpuva_to_vma(op->base.remap.unmap->va);
+ else if (op->remap.prev)
+ vma = op->remap.prev;
+ else
+ vma = op->remap.next;
+ }
+
+ if (xe_vma_is_userptr(vma)) {
+ err = xe_vma_userptr_pin_pages(vma);
+ if (!err)
+ goto retry_userptr;
+
+ trace_xe_vma_fail(vma);
+ }
}
return err;
--
2.34.1
next prev parent reply other threads:[~2024-02-01 0:48 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-01 0:48 [PATCH 0/2] A couple of VM bind fixes Matthew Brost
2024-02-01 0:48 ` [PATCH 1/2] drm/xe: Take a reference in xe_exec_queue_last_fence_get() Matthew Brost
2024-02-01 19:15 ` Maarten Lankhorst
2024-02-01 0:48 ` Matthew Brost [this message]
2024-02-01 19:18 ` [PATCH 2/2] drm/xe: Pick correct userptr VMA to repin on REMAP op failure Maarten Lankhorst
2024-02-01 19:26 ` Matthew Brost
2024-02-01 20:00 ` Maarten Lankhorst
2024-02-02 8:37 ` Maarten Lankhorst
2024-02-01 1:46 ` ✓ CI.Patch_applied: success for A couple of VM bind fixes Patchwork
2024-02-01 1:47 ` ✗ CI.checkpatch: warning " Patchwork
2024-02-01 1:48 ` ✓ CI.KUnit: success " Patchwork
2024-02-01 1:55 ` ✓ CI.Build: " Patchwork
2024-02-01 1:55 ` ✓ CI.Hooks: " Patchwork
2024-02-01 1:57 ` ✓ CI.checksparse: " Patchwork
2024-02-01 2:20 ` ✓ CI.BAT: " 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=20240201004849.2219558-3-matthew.brost@intel.com \
--to=matthew.brost@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