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

On Thu, Jan 04, 2024 at 01:55:48PM -0800, Welty, Brian wrote:
> 
> 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.

I think after quite a bit of review we landed on EWOULDBLOCK as this
means user space should retry the IOCTL.

Matt 

> 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++)

      reply	other threads:[~2024-01-05  3:33 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 ` [PATCH] " Welty, Brian
2024-01-05  3:32   ` Matthew Brost [this message]

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=ZZd4SpVzH7lnrYZs@DUT025-TGLU.fm.intel.com \
    --to=matthew.brost@intel.com \
    --cc=brian.welty@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --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