Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: Pallavi Mishra <pallavi.mishra@intel.com>
Cc: intel-xe@lists.freedesktop.org, matthew.auld@intel.com
Subject: Re: [Intel-xe] [PATCH] drm/xe: Prevent return with locked vm
Date: Wed, 30 Aug 2023 01:02:27 +0000	[thread overview]
Message-ID: <ZO6VI51suZq0AnNN@DUT025-TGLU.fm.intel.com> (raw)
In-Reply-To: <20230829181335.779696-1-pallavi.mishra@intel.com>

On Tue, Aug 29, 2023 at 11:43:35PM +0530, Pallavi Mishra wrote:
> 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>

Reviewed-by: Matthew Brost <matthew.brost@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
> 

  parent reply	other threads:[~2023-08-30  1:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-29 18:13 [Intel-xe] [PATCH] drm/xe: Prevent return with locked vm Pallavi Mishra
2023-08-29 18:40 ` [Intel-xe] ✓ CI.Patch_applied: success for " 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 ` Matthew Brost [this message]
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=ZO6VI51suZq0AnNN@DUT025-TGLU.fm.intel.com \
    --to=matthew.brost@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    --cc=pallavi.mishra@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