Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Welty, Brian" <brian.welty@intel.com>
To: Matthew Brost <matthew.brost@intel.com>,
	<intel-xe@lists.freedesktop.org>
Cc: Sai Gowtham Ch <sai.gowtham.ch@intel.com>
Subject: Re: [PATCH] drm/xe: Fix exec IOCTL long running exec queue ring full condition
Date: Thu, 4 Jan 2024 13:55:48 -0800	[thread overview]
Message-ID: <69ff1c8d-d844-44b2-af42-cbccc035ebfc@intel.com> (raw)
In-Reply-To: <20240104080909.1271480-1-matthew.brost@intel.com>


On 1/4/2024 12:09 AM, Matthew Brost wrote:
> The intent is to return -EWOULDBLOCK to the user if a long running exec
> queue is full during the exec IOCTL. -EWOULDBLOCK aliases to -EAGAIN
> which results in the exec IOCTL doing a retry loop. Fix this by ensuring
> the retry loop is broken when returning -EWOULDBLOCK.
> 
> Fixes: 8ae8a2e8dd21 ("drm/xe: Long running job update")
> Reported-by: Sai Gowtham Ch <sai.gowtham.ch@intel.com>
> Signed-off-by: Matthew Brost <matthew.brost@intel.com>
> ---
>   drivers/gpu/drm/xe/xe_exec.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_exec.c b/drivers/gpu/drm/xe/xe_exec.c
> index d30c0d0689bc..c68e1bd15e6a 100644
> --- a/drivers/gpu/drm/xe/xe_exec.c
> +++ b/drivers/gpu/drm/xe/xe_exec.c
> @@ -115,7 +115,7 @@ int xe_exec_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
>   	struct xe_sched_job *job;
>   	struct dma_fence *rebind_fence;
>   	struct xe_vm *vm;
> -	bool write_locked;
> +	bool write_locked, skip_eagain = false;
>   	ktime_t end = 0;
>   	int err = 0;
>   
> @@ -227,7 +227,8 @@ int xe_exec_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
>   	}
>   
>   	if (xe_exec_queue_is_lr(q) && xe_exec_queue_ring_full(q)) {
> -		err = -EWOULDBLOCK;
> +		err = -EWOULDBLOCK;	/* Aliased to -EAGAIN */
> +		skip_eagain = true;

Would using another error code be more clean and avoid confusion in 
user-space as well?   Such as -EBUSY here?

But if you feel strongly about using EWOULDBLOCK, fix looks good to me.
Reviewed-by: Brian Welty <brian.welty@intel.com>

>   		goto err_exec;
>   	}
>   
> @@ -337,7 +338,7 @@ int xe_exec_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
>   		up_write(&vm->lock);
>   	else
>   		up_read(&vm->lock);
> -	if (err == -EAGAIN)
> +	if (err == -EAGAIN && !skip_eagain)
>   		goto retry;
>   err_syncs:
>   	for (i = 0; i < num_syncs; i++)

  parent reply	other threads:[~2024-01-04 21:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-04  8:09 [PATCH] drm/xe: Fix exec IOCTL long running exec queue ring full condition Matthew Brost
2024-01-04 17:21 ` ✓ CI.Patch_applied: success for " Patchwork
2024-01-04 17:21 ` ✗ CI.checkpatch: warning " Patchwork
2024-01-04 17:22 ` ✓ CI.KUnit: success " Patchwork
2024-01-04 17:30 ` ✓ CI.Build: " Patchwork
2024-01-04 17:30 ` ✓ CI.Hooks: " Patchwork
2024-01-04 17:31 ` ✓ CI.checksparse: " Patchwork
2024-01-04 18:06 ` ✓ CI.BAT: " Patchwork
2024-01-04 21:55 ` Welty, Brian [this message]
2024-01-05  3:32   ` [PATCH] " Matthew Brost

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=69ff1c8d-d844-44b2-af42-cbccc035ebfc@intel.com \
    --to=brian.welty@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@intel.com \
    --cc=sai.gowtham.ch@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