All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH v3 4/4] drm/xe: Bump prefetch BO LRU for already-valid ranges
Date: Fri, 25 Sep 2026 18:57:37 -0700	[thread overview]
Message-ID: <arcmkTBpBaB0v1bV@gsse-cloud1.jf.intel.com> (raw)
In-Reply-To: <20260922043759.3057442-10-himal.prasad.ghimiray@intel.com>

On Tue, Sep 22, 2026 at 10:08:04AM +0530, Himal Prasad Ghimiray wrote:
> A valid prefetch range skips migration and binding, so nothing refreshes
> its backing BOs on the LRU. Add xe_svm_range_prefetch_lru_bump(), which
> re-faults with no_dma_map and bumps each backing BO, and call it on the
> valid path.
> 
> v2
> - Make function failsafe (Matt/Sashiko AI comment)
> - Add stub for function
> 
> Suggested-by: Matthew Brost <matthew.brost@intel.com>

Reviewed-by: Matthew Brost <matthew.brost@intel.com>

> Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_svm.c | 34 ++++++++++++++++++++++++++++++++++
>  drivers/gpu/drm/xe/xe_svm.h | 11 +++++++++++
>  drivers/gpu/drm/xe/xe_vm.c  |  5 +++++
>  3 files changed, 50 insertions(+)
> 
> diff --git a/drivers/gpu/drm/xe/xe_svm.c b/drivers/gpu/drm/xe/xe_svm.c
> index 018836ecbb06..10f81086f183 100644
> --- a/drivers/gpu/drm/xe/xe_svm.c
> +++ b/drivers/gpu/drm/xe/xe_svm.c
> @@ -1655,6 +1655,40 @@ void xe_svm_devmem_lru_bump(struct drm_pagemap_devmem *devmem_allocation)
>  #endif
>  }
>  
> +/**
> + * xe_svm_range_prefetch_lru_bump() - Bump the TTM LRU for an already-valid range
> + * @vm: Pointer to the struct xe_vm
> + * @vma: Pointer to the VMA covering the range
> + * @range: Pointer to the xe SVM range structure
> + * @dpagemap: Target pagemap of the prefetch, or %NULL for system memory
> + *
> + * A valid range skips migration and binding, so nothing else refreshes its
> + * backing BOs on the LRU. Re-fault the CPU pages without touching the DMA
> + * mappings (@no_dma_map) and move each backing BO to the LRU tail.
> + *
> + * Prefetching is a best-effort optimization, so any failure is ignored; a
> + * later fault will refault the range.
> + */
> +void xe_svm_range_prefetch_lru_bump(struct xe_vm *vm, struct xe_vma *vma,
> +				    struct xe_svm_range *range,
> +				    struct drm_pagemap *dpagemap)
> +{
> +	struct drm_gpusvm_ctx ctx = {
> +		.read_only = xe_vma_read_only(vma),
> +		.device_private_page_owner =
> +			xe_svm_private_page_owner(vm, !dpagemap),
> +		.no_dma_map = 1,
> +		.devmem_fn = xe_svm_devmem_lru_bump,
> +	};
> +
> +	guard(mutex)(&range->lock);
> +
> +	if (xe_svm_range_is_removed(range))
> +		return;
> +
> +	xe_svm_range_get_pages(vm, range, &ctx);
> +}
> +
>  /**
>   * xe_svm_ranges_zap_ptes_in_range - clear ptes of svm ranges in input range
>   * @vm: Pointer to the xe_vm structure
> diff --git a/drivers/gpu/drm/xe/xe_svm.h b/drivers/gpu/drm/xe/xe_svm.h
> index 585ad64b672b..ffc1cc808102 100644
> --- a/drivers/gpu/drm/xe/xe_svm.h
> +++ b/drivers/gpu/drm/xe/xe_svm.h
> @@ -130,6 +130,10 @@ int xe_svm_range_get_pages(struct xe_vm *vm, struct xe_svm_range *range,
>  
>  void xe_svm_devmem_lru_bump(struct drm_pagemap_devmem *devmem_allocation);
>  
> +void xe_svm_range_prefetch_lru_bump(struct xe_vm *vm, struct xe_vma *vma,
> +				    struct xe_svm_range *range,
> +				    struct drm_pagemap *dpagemap);
> +
>  bool xe_svm_range_needs_migrate_to_vram(struct xe_svm_range *range, struct xe_vma *vma,
>  					const struct drm_pagemap *dpagemap);
>  
> @@ -363,6 +367,13 @@ void xe_svm_devmem_lru_bump(struct drm_pagemap_devmem *devmem_allocation)
>  {
>  }
>  
> +static inline
> +void xe_svm_range_prefetch_lru_bump(struct xe_vm *vm, struct xe_vma *vma,
> +				    struct xe_svm_range *range,
> +				    struct drm_pagemap *dpagemap)
> +{
> +}
> +
>  static inline struct xe_svm_range *to_xe_range(struct drm_gpusvm_range *r)
>  {
>  	return NULL;
> diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
> index 0fdc740f1a41..3d5c5f3788bd 100644
> --- a/drivers/gpu/drm/xe/xe_vm.c
> +++ b/drivers/gpu/drm/xe/xe_vm.c
> @@ -2584,6 +2584,11 @@ vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_vma_ops *vops,
>  						  dpagemap, &valid_pages)) {
>  				xe_svm_range_debug(svm_range, "PREFETCH - RANGE IS VALID");
>  				xe_assert(vm->xe, valid_pages);
> +
> +				if (dpagemap)
> +					xe_svm_range_prefetch_lru_bump(vm, vma, svm_range,
> +								       dpagemap);
> +
>  				need_put = true;
>  				goto check_next_range;
>  			}
> -- 
> 2.43.0
> 

  reply	other threads:[~2026-09-26  1:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-22  4:38 [PATCH v3 0/4] Refresh TTM LRU on SVM prefetch Himal Prasad Ghimiray
2026-09-22  4:38 ` [PATCH v3 1/4] drm/pagemap: Add helper to access backing devmem allocation Himal Prasad Ghimiray
2026-09-22  4:38 ` [PATCH v3 2/4] drm/gpusvm: Add devmem callback to get_pages Himal Prasad Ghimiray
2026-09-26  1:42   ` Matthew Brost
2026-09-22  4:38 ` [PATCH v3 3/4] drm/xe: Bump prefetch BO LRU via GPUSVM devmem callback Himal Prasad Ghimiray
2026-09-26  1:56   ` Matthew Brost
2026-09-26  1:59     ` Matthew Brost
2026-09-28  3:42       ` Ghimiray, Himal Prasad
2026-09-22  4:38 ` [PATCH v3 4/4] drm/xe: Bump prefetch BO LRU for already-valid ranges Himal Prasad Ghimiray
2026-09-26  1:57   ` Matthew Brost [this message]
2026-09-22  4:43 ` ✓ CI.KUnit: success for Refresh TTM LRU on SVM prefetch (rev3) Patchwork
2026-09-22  5:39 ` ✗ Xe.CI.BAT: failure " Patchwork
2026-09-22 13:40 ` ✓ Xe.CI.FULL: success " Patchwork
2026-09-26  0:38 ` ✓ Xe.CI.BAT: success for Refresh TTM LRU on SVM prefetch (rev4) Patchwork
2026-09-26  9:48 ` ✓ Xe.CI.FULL: " 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=arcmkTBpBaB0v1bV@gsse-cloud1.jf.intel.com \
    --to=matthew.brost@intel.com \
    --cc=himal.prasad.ghimiray@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    /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.