Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [Intel-xe] [PATCH 5/6] drm/xe: Allow num_binds == 0 in VM bind IOCTL
Date: Thu, 21 Sep 2023 18:27:31 +0000	[thread overview]
Message-ID: <ZQyLEw5Hjr30eWJy@DUT025-TGLU.fm.intel.com> (raw)
In-Reply-To: <55c806c5a41472fd063faae222ef74ece36945b4.camel@linux.intel.com>

On Thu, Sep 21, 2023 at 11:32:17AM +0200, Thomas Hellström wrote:
> Hi, Matt!
> 
> On Thu, 2023-09-14 at 13:40 -0700, Matthew Brost wrote:
> > The idea being out-syncs can signal indicating all previous
> > operations
> > on the bind queue are complete. An example use case of this would be
> > support for implementing vkQueueWaitForIdle easily.
> > 
> > Signed-off-by: Matthew Brost <matthew.brost@intel.com>
> 
> One question below.
> 
> > ---
> >  drivers/gpu/drm/xe/xe_vm.c | 30 ++++++++++++++++++------------
> >  1 file changed, 18 insertions(+), 12 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
> > index 49c745d53b41..0e2f3ab453ea 100644
> > --- a/drivers/gpu/drm/xe/xe_vm.c
> > +++ b/drivers/gpu/drm/xe/xe_vm.c
> > @@ -2678,7 +2678,6 @@ static int vm_bind_ioctl_check_args(struct
> > xe_device *xe,
> >         int i;
> >  
> >         if (XE_IOCTL_DBG(xe, args->extensions) ||
> > -           XE_IOCTL_DBG(xe, !args->num_binds) ||
> >             XE_IOCTL_DBG(xe, args->num_binds > MAX_BINDS))
> >                 return -EINVAL;
> >  
> > @@ -2805,7 +2804,7 @@ int xe_vm_bind_ioctl(struct drm_device *dev,
> > void *data, struct drm_file *file)
> >                         goto put_exec_queue;
> >                 }
> >  
> > -               if (XE_IOCTL_DBG(xe, async !=
> > +               if (XE_IOCTL_DBG(xe, args->num_binds && async !=
> >                                  !!(q->flags &
> > EXEC_QUEUE_FLAG_VM_ASYNC))) {
> >                         err = -EINVAL;
> >                         goto put_exec_queue;
> > @@ -2819,7 +2818,7 @@ int xe_vm_bind_ioctl(struct drm_device *dev,
> > void *data, struct drm_file *file)
> >         }
> >  
> >         if (!args->exec_queue_id) {
> > -               if (XE_IOCTL_DBG(xe, async !=
> > +               if (XE_IOCTL_DBG(xe, args->num_binds && async !=
> >                                  !!(vm->flags &
> > XE_VM_FLAG_ASYNC_DEFAULT))) {
> >                         err = -EINVAL;
> >                         goto put_vm;
> > @@ -2856,16 +2855,18 @@ int xe_vm_bind_ioctl(struct drm_device *dev,
> > void *data, struct drm_file *file)
> >                 }
> >         }
> >  
> > -       bos = kzalloc(sizeof(*bos) * args->num_binds, GFP_KERNEL);
> > -       if (!bos) {
> > -               err = -ENOMEM;
> > -               goto release_vm_lock;
> > -       }
> > +       if (args->num_binds) {
> > +               bos = kzalloc(sizeof(*bos) * args->num_binds,
> > GFP_KERNEL);
> > +               if (!bos) {
> > +                       err = -ENOMEM;
> > +                       goto release_vm_lock;
> > +               }
> >  
> > -       ops = kzalloc(sizeof(*ops) * args->num_binds, GFP_KERNEL);
> > -       if (!ops) {
> > -               err = -ENOMEM;
> > -               goto release_vm_lock;
> > +               ops = kzalloc(sizeof(*ops) * args->num_binds,
> > GFP_KERNEL);
> > +               if (!ops) {
> > +                       err = -ENOMEM;
> > +                       goto release_vm_lock;
> > +               }
> >         }
> >  
> >         for (i = 0; i < args->num_binds; ++i) {
> > @@ -2920,6 +2921,11 @@ int xe_vm_bind_ioctl(struct drm_device *dev,
> > void *data, struct drm_file *file)
> >                         goto free_syncs;
> >         }
> >  
> > +       if (!args->num_binds) {
> > +               err = -ENODATA;
> > +               goto free_syncs;
> > +       }
> > +
> 
> Hmm. Here it appears we reject num_binds == 0? 
> 

Below -ENODATA is interrupted as a non-error which signals the
out-fences on the last fence of the queue. Another example of -ENODATA
is doing an unmap operations that doesn't result in any unbinds (e.g.
unmapping a range without any mappings).

Matt

> >         for (i = 0; i < args->num_binds; ++i) {
> >                 u64 range = bind_ops[i].range;
> >                 u64 addr = bind_ops[i].addr;
> 

  reply	other threads:[~2023-09-21 18:33 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-14 20:40 [Intel-xe] [PATCH 0/6] uAPI changes to align with async binds Matthew Brost
2023-09-14 20:40 ` [Intel-xe] [PATCH 1/6] drm/xe/uapi: Kill XE_VM_PROPERTY_BIND_OP_ERROR_CAPTURE_ADDRESS extension Matthew Brost
2023-09-21  8:55   ` Thomas Hellström
2023-09-14 20:40 ` [Intel-xe] [PATCH 2/6] drm/xe/uapi: Kill DRM_XE_UFENCE_WAIT_VM_ERROR Matthew Brost
2023-09-21  8:57   ` Thomas Hellström
2023-09-14 20:40 ` [Intel-xe] [PATCH 3/6] drm/xe: Remove async worker and rework sync binds Matthew Brost
2023-09-21  9:09   ` Thomas Hellström
2023-09-14 20:40 ` [Intel-xe] [PATCH 4/6] drm/xe: Fix VM bind out-sync signaling ordering Matthew Brost
2023-09-21  9:15   ` Thomas Hellström
2023-09-14 20:40 ` [Intel-xe] [PATCH 5/6] drm/xe: Allow num_binds == 0 in VM bind IOCTL Matthew Brost
2023-09-21  9:32   ` Thomas Hellström
2023-09-21 18:27     ` Matthew Brost [this message]
2023-09-14 20:40 ` [Intel-xe] [PATCH 6/6] drm/xe: Allow num_batch_buffer == 0 in exec IOCTL Matthew Brost
2023-09-21  9:42   ` Thomas Hellström
2023-09-21 18:33     ` Matthew Brost
2023-09-14 22:22 ` [Intel-xe] ✓ CI.Patch_applied: success for uAPI changes to align with async binds Patchwork
2023-09-14 22:22 ` [Intel-xe] ✗ CI.checkpatch: warning " Patchwork
2023-09-14 22:23 ` [Intel-xe] ✓ CI.KUnit: success " Patchwork
2023-09-14 22:30 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-09-14 22:31 ` [Intel-xe] ✓ CI.Hooks: " Patchwork
2023-09-14 22:32 ` [Intel-xe] ✓ CI.checksparse: " 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=ZQyLEw5Hjr30eWJy@DUT025-TGLU.fm.intel.com \
    --to=matthew.brost@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=thomas.hellstrom@linux.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