All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Summers, Stuart" <stuart.summers@intel.com>
To: "intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>,
	"Brost,  Matthew" <matthew.brost@intel.com>
Cc: "Ghimiray, Himal Prasad" <himal.prasad.ghimiray@intel.com>,
	"thomas.hellstrom@linux.intel.com"
	<thomas.hellstrom@linux.intel.com>
Subject: Re: [PATCH] drm/xe: Don't use drm exec locking in SVM pagefaults
Date: Wed, 11 Jun 2025 19:47:35 +0000	[thread overview]
Message-ID: <4efd6ad0af5f8dc2cd04d85ce8afda53ed6cb2a4.camel@intel.com> (raw)
In-Reply-To: <20250603174012.2195759-1-matthew.brost@intel.com>

On Tue, 2025-06-03 at 10:40 -0700, Matthew Brost wrote:
> Only the VM dma-resv lock is needed in SVM pagefaults so
> xe_vm_lock/unlock can be used instead of drm exec. Micro optimization
> but should save some CPU cycles in a critical path.
> 
> Signed-off-by: Matthew Brost <matthew.brost@intel.com>

Reviewed-by: Stuart Summers <stuart.summers@intel.com>

Looks great, thanks Matt!

> ---
>  drivers/gpu/drm/xe/xe_svm.c | 36 +++++++++++++----------------------
> -
>  1 file changed, 13 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_svm.c
> b/drivers/gpu/drm/xe/xe_svm.c
> index f27fb9b588de..952b75a4264d 100644
> --- a/drivers/gpu/drm/xe/xe_svm.c
> +++ b/drivers/gpu/drm/xe/xe_svm.c
> @@ -858,7 +858,6 @@ int xe_svm_handle_pagefault(struct xe_vm *vm,
> struct xe_vma *vma,
>                         vm->xe->atomic_svm_timeslice_ms : 0,
>         };
>         struct xe_svm_range *range;
> -       struct drm_exec exec;
>         struct dma_fence *fence;
>         struct xe_tile *tile = gt_to_tile(gt);
>         int migrate_try_count = ctx.devmem_only ? 3 : 1;
> @@ -933,30 +932,21 @@ int xe_svm_handle_pagefault(struct xe_vm *vm,
> struct xe_vma *vma,
>         range_debug(range, "PAGE FAULT - BIND");
>  
>  retry_bind:
> -       drm_exec_init(&exec, 0, 0);
> -       drm_exec_until_all_locked(&exec) {
> -               err = drm_exec_lock_obj(&exec, vm->gpuvm.r_obj);
> -               drm_exec_retry_on_contention(&exec);
> -               if (err) {
> -                       drm_exec_fini(&exec);
> -                       goto err_out;
> -               }
> -
> -               fence = xe_vm_range_rebind(vm, vma, range, BIT(tile-
> >id));
> -               if (IS_ERR(fence)) {
> -                       drm_exec_fini(&exec);
> -                       err = PTR_ERR(fence);
> -                       if (err == -EAGAIN) {
> -                               ctx.timeslice_ms <<= 1; /* Double
> timeslice if we have to retry */
> -                               range_debug(range, "PAGE FAULT -
> RETRY BIND");
> -                               goto retry;
> -                       }
> -                       if (xe_vm_validate_should_retry(&exec, err,
> &end))
> -                               goto retry_bind;
> -                       goto err_out;
> +       xe_vm_lock(vm, false);
> +       fence = xe_vm_range_rebind(vm, vma, range, BIT(tile->id));
> +       if (IS_ERR(fence)) {
> +               xe_vm_unlock(vm);
> +               err = PTR_ERR(fence);
> +               if (err == -EAGAIN) {
> +                       ctx.timeslice_ms <<= 1; /* Double timeslice
> if we have to retry */
> +                       range_debug(range, "PAGE FAULT - RETRY
> BIND");
> +                       goto retry;
>                 }
> +               if (xe_vm_validate_should_retry(NULL, err, &end))
> +                       goto retry_bind;
> +               goto err_out;
>         }
> -       drm_exec_fini(&exec);
> +       xe_vm_unlock(vm);
>  
>         dma_fence_wait(fence, false);
>         dma_fence_put(fence);


      parent reply	other threads:[~2025-06-11 19:47 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-03 17:40 [PATCH] drm/xe: Don't use drm exec locking in SVM pagefaults Matthew Brost
2025-06-03 17:43 ` ✓ CI.Patch_applied: success for " Patchwork
2025-06-03 17:43 ` ✓ CI.checkpatch: " Patchwork
2025-06-03 17:44 ` ✗ CI.KUnit: failure " Patchwork
2025-06-05 20:52 ` ✓ CI.Patch_applied: success for drm/xe: Don't use drm exec locking in SVM pagefaults (rev2) Patchwork
2025-06-05 20:53 ` ✓ CI.checkpatch: " Patchwork
2025-06-05 20:54 ` ✓ CI.KUnit: " Patchwork
2025-06-05 21:11 ` ✓ CI.Build: " Patchwork
2025-06-05 21:14 ` ✓ CI.Hooks: " Patchwork
2025-06-05 21:15 ` ✓ CI.checksparse: " Patchwork
2025-06-05 22:21 ` ✓ Xe.CI.BAT: " Patchwork
2025-06-07 15:25 ` ✓ Xe.CI.Full: " Patchwork
2025-06-08  2:41 ` ✗ Xe.CI.Full: failure " Patchwork
2025-06-11 19:25 ` [PATCH] drm/xe: Don't use drm exec locking in SVM pagefaults Maarten Lankhorst
2025-06-11 19:47 ` Summers, Stuart [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=4efd6ad0af5f8dc2cd04d85ce8afda53ed6cb2a4.camel@intel.com \
    --to=stuart.summers@intel.com \
    --cc=himal.prasad.ghimiray@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@intel.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.