From: Pallavi Mishra <pallavi.mishra@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: matthew.auld@intel.com
Subject: [Intel-xe] [PATCH] drm/xe: Prevent return with locked vm
Date: Tue, 29 Aug 2023 23:43:35 +0530 [thread overview]
Message-ID: <20230829181335.779696-1-pallavi.mishra@intel.com> (raw)
Reorder vm_id check after the one for VISIBLE_VRAM. This should
prevent returning with locked vm in error scenario.
Signed-off-by: Pallavi Mishra <pallavi.mishra@intel.com>
---
drivers/gpu/drm/xe/xe_bo.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
index 1ab682d61e3c..6a8a41dafe88 100644
--- a/drivers/gpu/drm/xe/xe_bo.c
+++ b/drivers/gpu/drm/xe/xe_bo.c
@@ -1785,17 +1785,6 @@ int xe_gem_create_ioctl(struct drm_device *dev, void *data,
if (XE_IOCTL_DBG(xe, args->size & ~PAGE_MASK))
return -EINVAL;
- if (args->vm_id) {
- vm = xe_vm_lookup(xef, args->vm_id);
- if (XE_IOCTL_DBG(xe, !vm))
- return -ENOENT;
- err = xe_vm_lock(vm, &ww, 0, true);
- if (err) {
- xe_vm_put(vm);
- return err;
- }
- }
-
if (args->flags & XE_GEM_CREATE_FLAG_DEFER_BACKING)
bo_flags |= XE_BO_DEFER_BACKING;
@@ -1811,6 +1800,17 @@ int xe_gem_create_ioctl(struct drm_device *dev, void *data,
bo_flags |= XE_BO_NEEDS_CPU_ACCESS;
}
+ if (args->vm_id) {
+ vm = xe_vm_lookup(xef, args->vm_id);
+ if (XE_IOCTL_DBG(xe, !vm))
+ return -ENOENT;
+ err = xe_vm_lock(vm, &ww, 0, true);
+ if (err) {
+ xe_vm_put(vm);
+ return err;
+ }
+ }
+
bo = xe_bo_create(xe, NULL, vm, args->size, ttm_bo_type_device,
bo_flags);
if (IS_ERR(bo)) {
--
2.25.1
next reply other threads:[~2023-08-29 18:06 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-29 18:13 Pallavi Mishra [this message]
2023-08-29 18:40 ` [Intel-xe] ✓ CI.Patch_applied: success for drm/xe: Prevent return with locked vm Patchwork
2023-08-29 18:41 ` [Intel-xe] ✗ CI.checkpatch: warning " Patchwork
2023-08-29 18:42 ` [Intel-xe] ✓ CI.KUnit: success " Patchwork
2023-08-29 18:49 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-08-29 18:49 ` [Intel-xe] ✗ CI.Hooks: failure " Patchwork
2023-08-30 1:02 ` [Intel-xe] [PATCH] " Matthew Brost
2023-08-30 14:34 ` [Intel-xe] ✓ CI.Patch_applied: success for drm/xe: Prevent return with locked vm (rev2) Patchwork
2023-08-30 14:34 ` [Intel-xe] ✗ CI.checkpatch: warning " Patchwork
2023-08-30 14:35 ` [Intel-xe] ✓ CI.KUnit: success " Patchwork
2023-08-30 14:42 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-08-30 14:42 ` [Intel-xe] ✗ CI.Hooks: failure " Patchwork
2023-08-30 14:43 ` [Intel-xe] ✗ CI.checksparse: warning " Patchwork
2023-08-30 15:15 ` [Intel-xe] ✓ CI.BAT: 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=20230829181335.779696-1-pallavi.mishra@intel.com \
--to=pallavi.mishra@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.auld@intel.com \
/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