All of 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
Cc: thomas.hellstrom@linux.intel.com, himal.prasad.ghimiray@intel.com
Subject: Re: [PATCH] drm/xe: Don't use drm exec locking in SVM pagefaults
Date: Wed, 11 Jun 2025 21:25:49 +0200	[thread overview]
Message-ID: <3ebdd4d0-caeb-4d1a-a56a-a572e0685d8e@linux.intel.com> (raw)
In-Reply-To: <20250603174012.2195759-1-matthew.brost@intel.com>



On 2025-06-03 19:40, 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>
> ---
>  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);
>  
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>

  parent reply	other threads:[~2025-06-11 19:25 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 ` Maarten Lankhorst [this message]
2025-06-11 19:47 ` [PATCH] drm/xe: Don't use drm exec locking in SVM pagefaults Summers, Stuart

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=3ebdd4d0-caeb-4d1a-a56a-a572e0685d8e@linux.intel.com \
    --to=maarten.lankhorst@linux.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.