Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: Matthew Brost <matthew.brost@intel.com>, intel-xe@lists.freedesktop.org
Subject: Re: [Intel-xe] [PATCH v4 1/9] drm/xe: Ban a VM if rebind worker hits an error
Date: Tue, 11 Jul 2023 15:40:35 +0200	[thread overview]
Message-ID: <bf91ed1d-dd49-1500-69f3-32d24a343db1@linux.intel.com> (raw)
In-Reply-To: <20230630175804.1096370-2-matthew.brost@intel.com>

Hey,

Just a nitpick, but ECANCELED seems to mean

"An asynchronous operation was canceled before it completed."

Could we still use -EIO instead?

On 2023-06-30 19:57, Matthew Brost wrote:
> We cannot recover a VM if a rebind worker hits an error, ban the VM if
> happens to ensure we do not attempt to place this VM on the hardware
> again.
>
> A follow up will inform the user if this happens.
>
> v2: Return -ECANCELED in exec VM closed or banned, check for closed or
> banned within VM lock.
> v3: Fix lockdep splat by looking engine outside of vm->lock
> v4: Fix error path when engine lookup fails
>
> Signed-off-by: Matthew Brost <matthew.brost@intel.com>
> ---
>   drivers/gpu/drm/xe/xe_engine.c     | 13 +++++
>   drivers/gpu/drm/xe/xe_exec.c       |  6 +-
>   drivers/gpu/drm/xe/xe_trace.h      |  5 ++
>   drivers/gpu/drm/xe/xe_vm.c         | 92 ++++++++++++++++++------------
>   drivers/gpu/drm/xe/xe_vm.h         | 11 ++++
>   drivers/gpu/drm/xe/xe_vm_madvise.c |  2 +-
>   drivers/gpu/drm/xe/xe_vm_types.h   |  5 +-
>   7 files changed, 92 insertions(+), 42 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_engine.c b/drivers/gpu/drm/xe/xe_engine.c
> index 6e6b2913f766..ada2986c33a2 100644
> --- a/drivers/gpu/drm/xe/xe_engine.c
> +++ b/drivers/gpu/drm/xe/xe_engine.c
> @@ -597,10 +597,23 @@ int xe_engine_create_ioctl(struct drm_device *dev, void *data,
>   		if (XE_IOCTL_ERR(xe, !vm))
>   			return -ENOENT;
>   
> +		err = down_read_interruptible(&vm->lock);
> +		if (err) {
> +			xe_vm_put(vm);
> +			return err;
> +		}
> +
> +		if (XE_IOCTL_ERR(xe, xe_vm_is_closed_or_banned(vm))) {
> +			up_read(&vm->lock);
> +			xe_vm_put(vm);
> +			return -ENOENT;
> +		}

We're returning -ENOENT if !vm is true, I think this should be the case 
for vm_is_closed too.

For banned, we should probably return ECANCELED to be consistent with 
the other callers.

> +
>   		e = xe_engine_create(xe, vm, logical_mask,
>   				     args->width, hwe,
>   				     xe_vm_no_dma_fences(vm) ? 0 :
>   				     ENGINE_FLAG_PERSISTENT);
> +		up_read(&vm->lock);
>   		xe_vm_put(vm);
>   		if (IS_ERR(e))
>   			return PTR_ERR(e);

.


> diff --git a/drivers/gpu/drm/xe/xe_exec.c b/drivers/gpu/drm/xe/xe_exec.c
> index c52edff9a358..bdf00e59e7a4 100644
> --- a/drivers/gpu/drm/xe/xe_exec.c
> +++ b/drivers/gpu/drm/xe/xe_exec.c
> @@ -297,9 +297,9 @@ int xe_exec_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
>   	if (err)
>   		goto err_unlock_list;
>   
> -	if (xe_vm_is_closed(engine->vm)) {
> -		drm_warn(&xe->drm, "Trying to schedule after vm is closed\n");
> -		err = -EIO;
> +	if (xe_vm_is_closed_or_banned(engine->vm)) {
> +		drm_warn(&xe->drm, "Trying to schedule after vm is closed or banned\n");
> +		err = -ECANCELED;
>   		goto err_engine_end;
>   	}

Same here..

Because of this, I don't know if in the current form, a 
is_closed_or_banned adds much compared to checking separately.

Otherwise looks good. Hoping for a new revision soon. :)



  parent reply	other threads:[~2023-07-11 13:40 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-30 17:57 [Intel-xe] [PATCH v4 0/9] GPUVA with no uAPI changes Matthew Brost
2023-06-30 17:57 ` [Intel-xe] [PATCH v4 1/9] drm/xe: Ban a VM if rebind worker hits an error Matthew Brost
2023-07-06 10:31   ` Thomas Hellström
2023-07-06 15:01     ` Matthew Brost
2023-07-06 17:49       ` Thomas Hellström
2023-07-11 13:40   ` Maarten Lankhorst [this message]
2023-06-30 17:57 ` [Intel-xe] [PATCH v4 2/9] drm/xe: Add helpers to hide struct xe_vma internals Matthew Brost
2023-07-06 13:22   ` Thomas Hellström
2023-07-06 15:06     ` Matthew Brost
2023-06-30 17:57 ` [Intel-xe] [PATCH v4 3/9] maple_tree: Export mas_preallocate Matthew Brost
2023-07-06 17:51   ` Thomas Hellström
2023-07-07  5:45     ` Matthew Brost
2023-06-30 17:57 ` [Intel-xe] [PATCH v4 4/9] maple_tree: split up MA_STATE() macro Matthew Brost
2023-06-30 17:58 ` [Intel-xe] [PATCH v4 5/9] drm: manager to keep track of GPUs VA mappings Matthew Brost
2023-06-30 17:58 ` [Intel-xe] [PATCH v4 6/9] drm: debugfs: provide infrastructure to dump a DRM GPU VA space Matthew Brost
2023-06-30 17:58 ` [Intel-xe] [PATCH v4 7/9] drm/xe: Remove __xe_vm_bind forward declaration Matthew Brost
2023-07-06 17:54   ` Thomas Hellström
2023-06-30 17:58 ` [Intel-xe] [PATCH v4 8/9] drm/xe: Port Xe to GPUVA Matthew Brost
2023-07-07 15:38   ` Thomas Hellström
2023-06-30 17:58 ` [Intel-xe] [PATCH v4 9/9] drm/xe: Avoid doing rebinds Matthew Brost
2023-06-30 18:35 ` [Intel-xe] ✓ CI.Patch_applied: success for GPUVA with no uAPI changes Patchwork
2023-06-30 18:35 ` [Intel-xe] ✗ CI.checkpatch: warning " Patchwork
2023-06-30 18:37 ` [Intel-xe] ✓ CI.KUnit: success " Patchwork
2023-06-30 18:41 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-06-30 18:41 ` [Intel-xe] ✓ CI.Hooks: " Patchwork
2023-06-30 18:42 ` [Intel-xe] ✗ CI.checksparse: warning " Patchwork
2023-06-30 19:27 ` [Intel-xe] ○ CI.BAT: info " 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=bf91ed1d-dd49-1500-69f3-32d24a343db1@linux.intel.com \
    --to=maarten.lankhorst@linux.intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@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